Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Name Change.


Ertzel
 Share

Recommended Posts

```
' Executed whenever a slash command is sent to the server.
Sub Commands(Index)
Dim TextSay
Dim PlayerID
Dim MapNum

' Get the command and arguments from the cache.
TextSay = Trim(GetVar("Scripts\Command.ini", "TEMP", "Text" & Index))

' Split the command into an array. All arguments are seperated by spaces.
TextSay = Split(TextSay)

Select Case TextSay(0)
Case "/testscripts"
Call TestMain(Index)

Exit Sub

Case "/help"
Call PlayerMsg(Index, "Social Commands:", WHITE)
Call PlayerMsg(Index, "'msghere = Broadcast Message", WHITE)
Call PlayerMsg(Index, "-msghere = Emote Message", WHITE)
Call PlayerMsg(Index, "!namehere msghere = Player Message", WHITE)
Call PlayerMsg(Index, "Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /party, /join, /leave, /refresh", WHITE)

Exit Sub 

Case "/calladmins"
If GetPlayerAccess(Index) = 0 Then
Call AdminMsg(GetPlayerName(Index) & " needs your help!", BRIGHTGREEN)
Else
Call PlayerMsg(Index, "You are an admin! You cannot call for help!", BRIGHTGREEN)
End If

Exit Sub 

Case "/admin"
If GetPlayerAccess(Index) > 0 Then
Call PlayerMsg(Index, "Social Commands:", WHITE)
Call PlayerMsg(Index, """msghere = Global Admin Message", WHITE)
Call PlayerMsg(Index, "=msghere = Private Admin Message", WHITE)
Call PlayerMsg(Index, "Available Commands: /admin, /setname, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /kick, /ban, /edititem, /respawn, /editnpc, /motd, /editshop, /ban, /editspell", WHITE)
End If

Exit Sub

Case "/warpmeto"
If GetPlayerAccess(Index) > 0 Then
PlayerID = FindPlayer(TextSay(1))

If PlayerID > 0 Then
Call PlayerWarp(Index, GetPlayerMap(PlayerID), GetPlayerX(PlayerID), GetPlayerY(PlayerID))
Call PlayerMsg(Index, "You have been warped to " & GetPlayerName(PlayerID) & ".", BROWN)
Else
Call PlayerMsg(Index, "Player is not online.", WHITE)
End If
End If

Exit Sub

Case "/warptome"
If GetPlayerAccess(Index) > 0 Then
PlayerID = FindPlayer(TextSay(1))

If PlayerID > 0 Then
Call PlayerWarp(PlayerID, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))
Call PlayerMsg(PlayerID, "You have been warped to " & GetPlayerName(Index) & ".", BROWN)
Else
Call PlayerMsg(Index, "Player is not online.", WHITE)
End If
End If

Exit Sub

Case "/warpto"
If GetPlayerAccess(Index) > 0 Then
MapNum = TextSay(1)

If MapNum > 0 And MapNum <= MAX_MAPS Then
Call PlayerWarp(Index, MapNum, GetPlayerX(Index), GetPlayerY(Index))
Call PlayerMsg(Index, "You have been warped to map #" & MapNum & ".", BRIGHTBLUE)
Else
Call PlayerMsg(Index, "Invalid map number.", BRIGHTRED)
End If
End If

Exit Sub

Case "/setname"
If GetPlayerAccess(Index) < 3 Then
If UBound(TextSay) < 1 Then
Call PlayerMsg(Index, "The command is: " & TextSay(0) & " name", BRIGHTRED)

Exit Sub
End If

Call SetPlayerName(Index, CStr(TextSay(1)))
Call SendPlayerData(Index)

Exit Sub
End If

If GetPlayerTarget(Index) > 0 Then
If UBound(TextSay) < 1 Then
Call PlayerMsg(Index, "The command is: " & TextSay(0) & " name", BRIGHTRED)

Exit Sub
End If

Call SetPlayerName(GetPlayerTarget(Index), CStr(TextSay(1)))
Call SendPlayerData(GetPlayerTarget(Index))

Exit Sub
End If

If UBound(TextSay) < 2 Then
Call PlayerMsg(Index, "The command is: " & TextSay(0) & " current name", BRIGHTRED)

Exit Sub
End If

Dim Target

Target = FindPlayer(CStr(TextSay(1)))

If Target > 0 Then
Call SetPlayerName(Target, CStr(TextSay(2)))
Call SendPlayerData(Target)

Exit Sub
End If

Call PlayerMsg(Index, TextSay(1) " is either offline or doesn't exist.", BRIGHTRED)
End Select

Call PlayerMsg(Index, "That is not a valid command.", BRIGHTRED)
End Sub
```

Regards,
  Godlord.
Link to comment
Share on other sites

Ok lol sorry for being such a nub at this, but I just noticed the code I just posted was not for the game im trying to use..

This is the code thats not working with my game…

```
' Executed whenever a slash command is sent to the server.
Sub Commands(Index)
Dim TextSay
Dim PlayerID
Dim MapNum

' Get the command and arguments from the cache.
TextSay = Trim(GetVar("Scripts\Command.ini", "TEMP", "Text" & Index))

' Split the command into an array. All arguments are seperated by spaces.
TextSay = Split(TextSay)

Select Case TextSay(0)
Case "/testscripts"
Call TestMain(Index)
Exit Sub

Case "/help"
Call PlayerMsg(Index, "Social Commands:", YELLOW)
Call PlayerMsg(Index, "'msghere = Broadcast Message", YELLOW)
Call PlayerMsg(Index, "-msghere = Emote Message", YELLOW)
Call PlayerMsg(Index, "!namehere msghere = Player Message", YELLOW)
Call PlayerMsg(Index, "Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /party, /join, /leave, /refresh", YELLOW)
Exit Sub

Case "/calladmins"
If GetPlayerAccess(Index) = 0 Then
Call AdminMsg(GetPlayerName(Index) & " needs your help!", BRIGHTGREEN)
Else
Call PlayerMsg(Index, "You are an admin! You cannot call for help!", BRIGHTGREEN)
End If
Exit Sub

Case "/dev"
If GetPlayerAccess(Index) > 0 Then
Call PlayerMsg(Index, "Social Commands:", WHITE)
Call PlayerMsg(Index, """msghere = Global Admin Message", WHITE)
Call PlayerMsg(Index, "=msghere = Private Admin Message", WHITE)
Call PlayerMsg(Index, "Available Commands: /admin, /kick, /ban, /jail, /spawn, /lvl, /namz, /setname, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /edititem, /respawn, /editnpc, /motd, /editshop, /editspell", WHITE)
End If
Exit Sub

Case "/warpmeto"
If GetPlayerAccess(Index) > 0 Then
PlayerID = FindPlayer(TextSay(1))

If PlayerID > 0 Then
Call PlayerWarp(Index, GetPlayerMap(PlayerID), GetPlayerX(PlayerID), GetPlayerY(PlayerID))
Call PlayerMsg(Index, "You have been warped to " & GetPlayerName(PlayerID) & ".", BROWN)
Else
Call PlayerMsg(Index, "Player is not online.", WHITE)
End If
End If
Exit Sub

Case "/warptome"
If GetPlayerAccess(Index) > 0 Then
PlayerID = FindPlayer(TextSay(1))

If PlayerID > 0 Then
Call PlayerWarp(PlayerID, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))
Call PlayerMsg(PlayerID, "You have been warped to " & GetPlayerName(Index) & ".", BROWN)
Else
Call PlayerMsg(Index, "Player is not online.", WHITE)
End If
End If
Exit Sub

Case "/warpto"
If GetPlayerAccess(Index) > 0 Then
MapNum = TextSay(1)

If MapNum > 0 And MapNum <= MAX_MAPS Then
Call PlayerWarp(Index, MapNum, GetPlayerX(Index), GetPlayerY(Index))
Call PlayerMsg(Index, "You have been warped to map #" & MapNum & ".", BRIGHTBLUE)
Else
Call PlayerMsg(Index, "Invalid map number.", BRIGHTRED)
End If
End If
Exit Sub

Case "/setname"
If GetPlayerAccess(Index) < 3 Then
If UBound(TextSay) < 1 Then
Call PlayerMsg(Index, "The command is: " & TextSay(0) & " name", BRIGHTRED)

Exit Sub
End If

Call SetPlayerName(Index, CStr(TextSay(1)))
Call SendPlayerData(Index)

Exit Sub
End If

If GetPlayerTarget(Index) > 0 Then
If UBound(TextSay) < 1 Then
Call PlayerMsg(Index, "The command is: " & TextSay(0) & " name", BRIGHTRED)

Exit Sub
End If

Call SetPlayerName(GetPlayerTarget(Index), CStr(TextSay(1)))
Call SendPlayerData(GetPlayerTarget(Index))

Exit Sub
End If

If UBound(TextSay) < 2 Then
Call PlayerMsg(Index, "The command is: " & TextSay(0) & " current name", BRIGHTRED)

Exit Sub
End If

Dim Target

Target = FindPlayer(CStr(TextSay(1)))

If Target > 0 Then
Call SetPlayerName(Target, CStr(TextSay(2)))
Call SendPlayerData(Target)

Exit Sub
End If

Call PlayerMsg(Index, TextSay(1) " is either offline or doesn't exist.", BRIGHTRED)

Case "/namz"
          namez = TextSay(1)
          If GetPlayerAccess(Index) > 3 Then
          Call SetPlayerName(Index, namez )
call sendplayerdata(index)
          Else
          Call playermsg(index, "You can't use this script", YELLOW)
          End if
          Exit sub

Case "/lvl"
If GetPlayerAccess(Index) > 3 Then
PlayerID = FindPlayer(TextSay(1))
PlayerLevel = TextSay(2)
If PlayerID > 0 Then
Call SetPlayerLevel(PlayerID, Playerlevel)
Call SetPlayerEXP(PlayerID, "0")
Call PlayerMsg(Index, "You set " & GetPlayerName(PlayerID) & " level to " & Playerlevel & ".", BRIGHTGREEN)
Call PlayerMsg(PlayerID, GetPlayerName(Index) & ", has set your level to " & PlayerLevel & " re-log for the change to take effect.", BRIGHTGREEN)
Else
Call PlayerMsg(Index, GetPlayerName(PlayerID) & ", is not online.", BRIGHTRED)
End If
End If
Exit Sub

case "/spawn"
          itemz = TextSay(1)
          itemz2 = TextSay(2)
          If GetPlayerAccess(Index) = 5 Then
          Call SpawnItemOnMap(GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index), itemz, itemz2, -1)
          Else
          Call playermsg(index, "You can't use this script", YELLOW)
          end if
          exit sub

Case "/jail"
        If GetPlayerAccess(Index) > 0 Then
            If LBound(TextSay) > 0 Then
              Dim Target

              Target = FindPlayer(TextSay(1))

              If Target = 0 Then
                  Call PlayerWarp(Target, 16, 16, 14)
                  Call PlayerMsg(Target, "You have been jailed!", BRIGHTGREEN)
                  Call PlayerMsg(Index, GetPlayerName(Target) & " has been jailed!", BRIGHTGREEN)
              Else
                  Call PlayerMsg(Index, "The player " & TextSay(1) & " is either offline or doesn't exist.", BRIGHTRED)
              End If
            Else
              Call PlayerMsg(Index, "The command is /jail player", BRIGHTRED)
            End If
        End If

        Exit Sub

Case "/gm"
If GetPlayerAccess(Index) > 0 Then
Call PlayerMsg(Index, "Social Commands:", RED)
Call PlayerMsg(Index, """msghere = Global Admin Message", RED)
Call PlayerMsg(Index, "=msghere = Private Admin Message", RED)
Call PlayerMsg(Index, "Available Commands: /admin, /jail, /kick, /warpmeto, /warptome, /warpto", RED)
  End If
Exit Sub 

End Select

Call PlayerMsg(Index, "That is not a valid command.", BRIGHTRED)
End Sub

```

Also, how the code starts with < 3

Shouldn't it be > 3?
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...