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

Name Change.


Ertzel
 Share

Recommended Posts

Ok so I found this script - http://www.touchofdeathforums.com/smf/index.php/topic,37312.0.html

```
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
```And was wondering how I can change it to let me change anyones name.

Right now it only changes the name of the person who types it. But I want anyone access < 3 to beable to change normal players names ingame with this command. Can anyone tell me what to change?
Link to comment
Share on other sites

Something like this?
```
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)
```

Regards,
  Godlord.
Link to comment
Share on other sites

@Ertzel:

> Is that a code I can put just right in under the slash commands in my Main.ini folder? Or is it like a vb6 code thing? cuz it doesnt look like any of my other codes :P

You can just add it to Sub Commands. It either doesn't look like it because of the fixes included or because of the syntax highlighting (colours).

Regards,
  Godlord.
Link to comment
Share on other sites

@Godlord:

> You can just add it to Sub Commands. It either doesn't look like it because of the fixes included or because of the syntax highlighting (colours).
>
> Regards,
>   Godlord.

Ya all the things in color look nothing like anything I have in any of my codes lol
Link to comment
Share on other sites

@Ertzel:

> Ya all the things in color look nothing like anything I have in any of my codes lol

[Syntax highlighting](http://en.wikipedia.org/wiki/Syntax_highlighting) is IDE-dependant or in this case it's built-in in the forum.

Regards,
  Godlord.
Link to comment
Share on other sites

@Godlord:

> [Syntax highlighting](http://en.wikipedia.org/wiki/Syntax_highlighting) is IDE-dependant or in this case it's built-in in the forum.
>
> Regards,
>   Godlord.

So I can just take this code and add it to my slash commands and it will work? Or do I need to edit it?
Link to comment
Share on other sites

@Ertzel:

> Ok and how do I use this ingame?
>
> Anyone Access 3 or up just types in something like…
>
> /setname Player Newname ?

You can select the player as target. In that case you use /setname newname. If you want to specify the target then do it like: /setname target newname.

Regards,
  Godlord.
Link to comment
Share on other sites

@Ertzel:

> Right now it only changes the name of the person who types it. But I want anyone **access < 3** to beable to change normal players names ingame with this command. Can anyone tell me what to change?

In case you didn't notice that will make everyone with access LESS THAN 3 have access to this. "<" needs to change to ">". ;)
Link to comment
Share on other sites

@Lam3r:

> In case you didn't notice that will make everyone with access LESS THAN 3 have access to this. "<" needs to change to ">". ;)

lol woops wow, thats the 2nd time I've messed those up >.<

So is Godlords script right, or do I have to change it now to get it to work?
Link to comment
Share on other sites

@Ertzel:

> lol woops wow, thats the 2nd time I've messed those up >.<
>
> So is Godlords script right, or do I have to change it now to get it to work?

My script should be fine. I'm staying at this:
@Godlord:

> **Sounds like you added it to the wrong place or something.** Do you mind showing up your Sub Commands?
>
> Regards,
>   Godlord.

Regards,
  Godlord.
Link to comment
Share on other sites

```
' 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
End Select

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)

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

```
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...