SholT Posted March 16, 2012 Author Share Posted March 16, 2012 Hi. This is my first tutorial, so please bear with us. Tutorial is written by me. This is a tutorial through which we can do to get the server to be available only for admins. Let's go :)**Only Server-Side**Add CheckBox in "Control", Name: chkGMOnly, Caption: Only GM's.Now we add a script**modHandleData**, find:```      If IsMultiAccounts(Name) Then        Call AlertMsg(index, "Multiple account logins is not authorized.")        Exit Sub      End If```and add below:```      If frmServer.chkGMOnly.Value = 1 Then      If Player(index).Access < 1 Then        Call AlertMsg(index, "Only the server admins.")      Exit Sub      End If      End If```Script work 100%, tested by me :) I greet!**Forbid copying tutorial without my knowledge** Link to comment Share on other sites More sharing options...
juvanio Posted March 16, 2012 Share Posted March 16, 2012 This is pretty nice :) On your next tutorial, don't Center the codes please? And edit your post to un - center it. But pretty nice contribution for people who needs it. Link to comment Share on other sites More sharing options...
Anonymious Posted March 16, 2012 Share Posted March 16, 2012 It works, it's easy, good idea and thanks. Link to comment Share on other sites More sharing options...
Peter120 Posted March 16, 2012 Share Posted March 16, 2012 You sure If Player(index).Access < 1 Then ? Link to comment Share on other sites More sharing options...
SholT Posted March 16, 2012 Author Share Posted March 16, 2012 @Peter120:> You sure If Player(index).Access < 1 Then ?For your available :)Here are the accesses:    0\. Player    1\. Monitor    2\. Mapper    3\. Developer    4\. Creator Link to comment Share on other sites More sharing options...
Peter120 Posted March 16, 2012 Share Posted March 16, 2012 I got it, thanks Link to comment Share on other sites More sharing options...
Justn Posted March 16, 2012 Share Posted March 16, 2012 You are looking at it backwards peter it kicks u if ur access in less than 1 Link to comment Share on other sites More sharing options...
Domino_ Posted March 16, 2012 Share Posted March 16, 2012 If im a new player and I register then I can get in even if your server is closed for normal players.Add same in HandleNewAccount ;) But cool code I like :) Link to comment Share on other sites More sharing options...
abhi2011 Posted March 26, 2012 Share Posted March 26, 2012 Wont work!!!!!!!!!!!!!!!! I cant even login with admin!@ JustnI cant even login in with standard player!! Link to comment Share on other sites More sharing options...
Domino_ Posted March 26, 2012 Share Posted March 26, 2012 @abhi2011:> Wont work!!!!!!!!!!!!!!!! I cant even login with admin!> @ Justn> > I cant even login in with standard player!!You'r doing something wrong…. Link to comment Share on other sites More sharing options...
abhi2011 Posted March 26, 2012 Share Posted March 26, 2012 What wrong is there to do? Link to comment Share on other sites More sharing options...
Domino_ Posted March 26, 2012 Share Posted March 26, 2012 @abhi2011:> What wrong is there to do?I dont know, you have problemt with it…Make " Add CheckBox in "Control", Name: chkGMOnly, Caption: Only GM's. "And change Private Sub HandleLogin To```Private Sub HandleLogin(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)  Dim Buffer As clsBuffer  Dim Name As String  Dim Password As String  Dim i As Long  Dim n As Long  If Not IsPlaying(Index) Then    If Not IsLoggedIn(Index) Then      Set Buffer = New clsBuffer      Buffer.WriteBytes Data()      ' Get the data      Name = Buffer.ReadString      Password = Buffer.ReadString      ' Check versions      If Buffer.ReadLong < CLIENT_MAJOR Or Buffer.ReadLong < CLIENT_MINOR Or Buffer.ReadLong < CLIENT_REVISION Then        Call AlertMsg(Index, "Version outdated, please visit " & Options.Website)        Exit Sub      End If      If isShuttingDown Then        Call AlertMsg(Index, "Server is either rebooting or being shutdown.")        Exit Sub      End If      If Len(Trim$(Name)) < 3 Or Len(Trim$(Password)) < 3 Then        Call AlertMsg(Index, "Your name and password must be at least three characters in length")        Exit Sub      End If      If Not AccountExist(Name) Then        Call AlertMsg(Index, "That account name does not exist.")        Exit Sub      End If      If Not PasswordOK(Name, Password) Then        Call AlertMsg(Index, "Incorrect password.")        Exit Sub      End If      If IsMultiAccounts(Name) Then        Call AlertMsg(Index, "Multiple account logins is not authorized.")        Exit Sub      End If      If frmServer.chkGMOnly.Value = 1 Then      If Player(Index).Access < 1 Then        Call AlertMsg(Index, "Server is closed!")      Exit Sub      End If      End If      ' Load the player      Call LoadPlayer(Index, Name)      ClearBank Index      LoadBank Index, Name      ' Check if character data has been created      If LenB(Trim$(Player(Index).Name)) > 0 Then        ' we have a char!        HandleUseChar Index      Else        ' send new char shit        If Not IsPlaying(Index) Then          Call SendNewCharClasses(Index)        End If      End If      ' Show the player up on the socket status      Call AddLog(GetPlayerLogin(Index) & " has logged in from " & GetPlayerIP(Index) & ".", PLAYER_LOG)      Call TextAdd(GetPlayerLogin(Index) & " has logged in from " & GetPlayerIP(Index) & ".")      Set Buffer = Nothing    End If  End IfEnd Sub``` Link to comment Share on other sites More sharing options...
abhi2011 Posted March 26, 2012 Share Posted March 26, 2012 Nope no use. Is there that possible can conflict with this? Let me try a vanilla copyEdit: Okay the vanilla copy didnt work. Thought of reading the code. And I finally found the cause of the error. Coding mistake in the Author's part. If we have a higher access then 1 then the login will be denied. Just as Justn specified. Though Domino I still don't understand how u did it with access level set higher than 1 and logged in. Link to comment Share on other sites More sharing options...
Domino_ Posted March 26, 2012 Share Posted March 26, 2012 @abhi2011:> Nope no use. Is there that possible can conflict with this? Let me try a vanilla copy> > Edit: Okay the vanilla copy didnt work. Thought of reading the code. And I finally found the cause of the error. Coding mistake in the Author's part. If we have a higher access then 1 then the login will be denied. Just as Justn specified. Though Domino I still don't understand how u did it with access level set higher than 1 and logged in.Before you login you need to be access more than 1 before closing server go in and make your character/account as admin access 5 … Link to comment Share on other sites More sharing options...
abhi2011 Posted March 26, 2012 Share Posted March 26, 2012 Actually there is a coding mistake. Player access < 1 means that if the player access is smaller then 1 then it denies ur login else it will accpt ur login. But Player access > 1 means that if the players access is greater then 1 then it will accpt ur login else it will deny u. Link to comment Share on other sites More sharing options...
PD Posted March 26, 2012 Share Posted March 26, 2012 @abhi2011:> Actually there is a coding mistake. Player access < 1 means that if the player access is smaller then 1 then it denies ur login else it will accpt ur login. But Player access > 1 means that if the players access is greater then 1 then it will accpt ur login else it will deny u.Where is the **coding** mistake in that? Only problem with that is, player's with access 1 (Monitors) won't be able to login ;) Link to comment Share on other sites More sharing options...
abhi2011 Posted March 26, 2012 Share Posted March 26, 2012 Well it actually worked when i interchanged the greater than less than side. Now can u explain how that worked? Link to comment Share on other sites More sharing options...
DarrellLeon Posted April 4, 2012 Share Posted April 4, 2012 You must of had it the wrong way round in the first place, it's a simple:Is the checkbox ticked? YesIs player less than a Mod? YesCancel login process.Very simple, very nice tutorial… Good job. Link to comment Share on other sites More sharing options...
bunny123 Posted June 13, 2012 Share Posted June 13, 2012 [Click for advanced version I made.](http://www.touchofdeathforums.com/smf2/index.php/topic,80733.msg864314.html) Link to comment Share on other sites More sharing options...
Joost Posted June 13, 2012 Share Posted June 13, 2012 It is kind of funny how many people here try to add tutorials without even knowing extremely basic code like this tutorial. No offense intended for the OP though, good first tutorial, certainly has it's uses. Link to comment Share on other sites More sharing options...
hisherwin Posted December 19, 2012 Share Posted December 19, 2012 > Hi. This is my first tutorial, so please bear with us. Tutorial is written by me. This is a tutorial through which we can do to get the server to be available only for admins. Let's go ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)> > **Only Server-Side**> > Add CheckBox in "Control", Name: chkGMOnly, Caption: Only GM's.> > Now we add a script> > **modHandleData**, find:> > ```> If IsMultiAccounts(Name) Then> > Call AlertMsg(index, "Multiple account logins is not authorized.")> > Exit Sub> > End If> ```> and add below:> > ```> If frmServer.chkGMOnly.Value = 1 Then> > If Player(index).Access < 1 Then> > Call AlertMsg(index, "Only the server admins.")> > Exit Sub> > End If> > End If> ```> > Script work 50%, tested by me ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) I not bad!> > **Forbid copying tutorial without my knowledge**> > **(Not if i have a mistake)**Fixed your post , and here is the working version of itMake a Checkbox name it chkGMOnlyNext find this at handleLogin```' Load the playerCall LoadPlayer(Index, Name)ClearBank IndexLoadBank Index, Name```add this below it```If frmServer.chkGMOnly.Value = 1 ThenIf Player(index).Access < 1 ThenCall AlertMsg(index, "Only the server admins.")Exit SubEnd IfEnd If``` Link to comment Share on other sites More sharing options...
Slasheree Posted December 19, 2012 Share Posted December 19, 2012 Cool, I made a similar system, but it's more of a whitelist style, on login it goes to a .txt get the name of the players allowed to enter. Gonna use it for the Closed-Beta of my game ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) 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