Helladen Posted June 9, 2010 Author Share Posted June 9, 2010 This fixes a small overflow bug and adds an extra message if you are trying to set your own access. Easily implementation.If you try to say /setaccess playername -1 or lower it would crash the client and say overflow.**Difficulty:** (1/5)**Server**Replace HandleSetAccess with this:```Sub HandleSetAccess(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim n As Long Dim I As Long Dim Buffer As clsBuffer Set Buffer = New clsBuffer Buffer.WriteBytes Data() ' Prevent hacking If GetPlayerAccess(index) < ADMIN_CREATOR Then Exit Sub End If ' The index n = FindPlayer(Buffer.ReadString) 'Parse(1)) ' The access I = Buffer.ReadLong 'CLng(Parse(2)) Set Buffer = Nothing ' Check for invalid access level If I >= 0 Or I <= 3 Then ' Check if player is on If n > 0 Then 'check to see if same level access is trying to change another access of the very same level and boot them if they are. If GetPlayerName(n) = GetPlayerName(index) Then Call PlayerMsg(index, "You can't change your own access!", Red) Exit Sub End If If GetPlayerAccess(n) = GetPlayerAccess(index) Then Call PlayerMsg(index, "Invalid access level.", Red) Exit Sub End If If GetPlayerAccess(n) <= 0 Then Call GlobalMsg(GetPlayerName(n) & " has been blessed with administrative access.", BrightBlue) End If Call SetPlayerAccess(n, I) Call SendPlayerData(n) Call AddLog(GetPlayerName(index) & " has modified " & GetPlayerName(n) & "'s access.", ADMIN_LOG) Else Call PlayerMsg(index, "Player is not online.", White) End If Else Call PlayerMsg(index, "Invalid access level.", Red) End IfEnd Sub```**Client**Commands: ``` Case "/setaccess" If GetPlayerAccess(MyIndex) < ADMIN_CREATOR Then AddText "You need to be a high enough staff member to do this!", AlertColor GoTo Continue End If If UBound(Command) < 2 Then AddText "Usage: /setaccess playername #", AlertColor GoTo Continue End If If IsNumeric(Command(1)) Or Not IsNumeric(Command(2)) Then AddText "Usage: /setaccess playername #", AlertColor GoTo Continue End If If Command(2) < 0 Then AddText "Invalid access level.", AlertColor GoTo Continue End If SendSetAccess Command(1), CLng(Command(2))``` 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