Officer Johnson Posted July 27, 2014 Author Share Posted July 27, 2014 Now i know this had been made before but in the tutorials i saw none of them worked or had bugs*****Updated on August 20, 2014*******Didn't work as good as it could have before so making it a bit better also making it when check box is clicked the players get auto kicked!****ServerSide****Step 1****ModGlobals**add this at bottom:```Public AdminOnly as boolean```Step 2Create a checkbox on the server form wherever you wantName it **chkAdminOnly**click it and **input this:**```Dim i as longAdminOnly = Not AdminOnlyIf AdminOnly then For i = 1 to Player_HighIndex If Player(i).access = 0 then if isplaying(i) then Call AlertMsg(i, "The server is for admin only") end if end if nextend if```now go to handlenewaccount**before:**```' Prevent hacking```**add:**```If AdminOnly Then Call alertmsg(index, "The Server is for admin only")end if```at handlelogin**before:**```' Check if character data has been created```**add:**```If AdminOnly Then If Player(index).Access = 0 then call alertmsg(index, "The Server is for admin only") end ifend if```ok compile and enjoy :) let me know if it don't work or if theres bugs Link to comment Share on other sites More sharing options...
Smited Posted July 27, 2014 Share Posted July 27, 2014 Nice tut King. I have something similar to this on my server. Otherwise I would use. Should be helpful to others though. Link to comment Share on other sites More sharing options...
Colonello Posted July 28, 2014 Share Posted July 28, 2014 This is perfect for games! This allows someone to make a public beta and after it's over keep this box checked all the time until the official release. Link to comment Share on other sites More sharing options...
Officer Johnson Posted July 29, 2014 Author Share Posted July 29, 2014 > This is perfect for games! This allows someone to make a public beta and after it's over keep this box checked all the time until the official release.yea lol anyone wanna test this and confirm it works properly Link to comment Share on other sites More sharing options...
abhi2011 Posted July 29, 2014 Share Posted July 29, 2014 Have you tested your code? You're missing two end ifs. Not sure if vb6 will make a fuss of it but you should still add it in. Also remeber never to use hard coded values. Always use variables/constants where possible. Instead of checking if the player access is 1 you could check it against the constant Admin_Monitor. **Note: **I don't think giving your players a message "Only the server admins" is going to be enough. My revised/fixed code. ```If frmServer.chkGMOnly.Value = vbChecked Then ' You can use 1\. Everyone uses 1\. If Player(index).Access < Admin_monitor Then Call AlertMsg(index, "Sorry. The server is accessible to admins only.") end if end if```Also your instructions to add a form control aren't clear enough. You might want to **bold out statements or properties** names(Caption/Name). Not trying to demoralize your or anything. Just giving you some pointers for your next tutorial. Link to comment Share on other sites More sharing options...
Officer Johnson Posted July 29, 2014 Author Share Posted July 29, 2014 > Have you tested your code? > > You're missing two end ifs. Not sure if vb6 will make a fuss of it but you should still add it in. Also remeber never to use hard coded values. Always use variables/constants where possible. Instead of checking if the player access is 1 you could check it against the constant Admin_Monitor. > > **Note: **> > I don't think giving your players a message "Only the server admins" is going to be enough. > > > > My revised/fixed code. > > ```> If frmServer.chkGMOnly.Value = vbChecked Then ' You can use 1\. Everyone uses 1\. > If Player(index).Access < Admin_monitor Then> Call AlertMsg(index, "Sorry. The server is accessible to admins only.")> end if > end if> > ```> Also your instructions to add a form control aren't clear enough. You might want to **bold out statements or properties** names(Caption/Name). > > > > Not trying to demoralize your or anything. Just giving you some pointers for your next tutorial.yea nothing taking by it but what do you mean it won't be enough care to explain? Link to comment Share on other sites More sharing options...
abhi2011 Posted July 29, 2014 Share Posted July 29, 2014 > yea nothing taking by it but what do you mean it won't be enough care to explain?Kinda bland. But that's just my opinion. Each person will have a different opinion about it. Link to comment Share on other sites More sharing options...
Officer Johnson Posted July 30, 2014 Author Share Posted July 30, 2014 > Kinda bland. But that's just my opinion. Each person will have a different opinion about it.alright Link to comment Share on other sites More sharing options...
Officer Johnson Posted August 20, 2014 Author Share Posted August 20, 2014 just realized this tutorial ain't done as good as it could be currently it only stops new users from registering and logging in and from account owners but it doesnt kick the people who are online already soim updating main post with new tut redo this if you used it!this update should make it auto kick when checkbox is clickedand should improve the registering account and prevent loggin in better if you've done it simply delete the code we added from ismulti accoutnts (underneath it) and the one we added in handlenewaccountthen redo the tutorial enjoy :) Link to comment Share on other sites More sharing options...
Colonello Posted August 20, 2014 Share Posted August 20, 2014 Great :D Link to comment Share on other sites More sharing options...
Mohenjo Daro Posted August 20, 2014 Share Posted August 20, 2014 Hmm, I found a problem, not sure if it's just the version I'm using or what, but if I have someone as an admin then revoke the adminship they can still get on. Link to comment Share on other sites More sharing options...
hisherwin Posted August 21, 2014 Share Posted August 21, 2014 > Hmm, I found a problem, not sure if it's just the version I'm using or what, but if I have someone as an admin then revoke the adminship they can still get on.Of course.. According to the code, It only kick players that are admin at that time, if it was revoked after being kicked then they can still play.. it's not done on a loop timer so it can't check if the player is admin or not everytime.To do the looping thing, on ServerLoop use the code that kick the player Link to comment Share on other sites More sharing options...
Mohenjo Daro Posted August 21, 2014 Share Posted August 21, 2014 No, I mean if I have an account that is admin and they have the admin access taken away then they can still log on after logging off or being kicked or whatever. They are immune to this. Link to comment Share on other sites More sharing options...
hisherwin Posted August 21, 2014 Share Posted August 21, 2014 He forgot to add the exit sub on this line```If AdminOnly Then If Player(index).Access = 0 then call alertmsg(index, "The Server is for admin only") end ifend if```and here```If AdminOnly Then Call alertmsg(index, "The Server is for admin only")end if```it must be ```If AdminOnly Then If Player(index).Access = 0 then call alertmsg(index, "The Server is for admin only") exit sub end ifend if```and here```If AdminOnly Then Call alertmsg(index, "The Server is for admin only") exit subend if``` Link to comment Share on other sites More sharing options...
Mohenjo Daro Posted August 21, 2014 Share Posted August 21, 2014 Well, I'm not sure what this does, so can you please enlighten us? But it doesn't fix the problem of a once admin and now player being able to login. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now