Ertzel Posted August 26, 2009 Author Share Posted August 26, 2009 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 More sharing options...
Godlord Posted August 26, 2009 Share Posted August 26, 2009 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 More sharing options...
Ertzel Posted August 26, 2009 Author Share Posted August 26, 2009 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 Link to comment Share on other sites More sharing options...
Godlord Posted August 26, 2009 Share Posted August 26, 2009 @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 :PYou 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 More sharing options...
Ertzel Posted August 26, 2009 Author Share Posted August 26, 2009 @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 More sharing options...
Godlord Posted August 26, 2009 Share Posted August 26, 2009 @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 More sharing options...
Ertzel Posted August 26, 2009 Author Share Posted August 26, 2009 @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 More sharing options...
Godlord Posted August 26, 2009 Share Posted August 26, 2009 Click on "view plain", copy the code and paste it. I don't think "copy to clipboard" works, although it didn't last time I tried.Regards, Godlord. Link to comment Share on other sites More sharing options...
Ertzel Posted August 26, 2009 Author Share Posted August 26, 2009 Ok and how do I use this ingame?Anyone Access 3 or up just types in something like…/setname Player Newname ? Link to comment Share on other sites More sharing options...
Godlord Posted August 26, 2009 Share Posted August 26, 2009 @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 More sharing options...
Ertzel Posted August 26, 2009 Author Share Posted August 26, 2009 When I put this in, it makes all of my slash commands not work :( Link to comment Share on other sites More sharing options...
Godlord Posted August 26, 2009 Share Posted August 26, 2009 @Ertzel:> When I put this in, it makes all of my slash commands not work :(Try enabling the scripting errors in Data.ini.Regards, Godlord. Link to comment Share on other sites More sharing options...
Ertzel Posted August 26, 2009 Author Share Posted August 26, 2009 @Godlord:> Try enabling the scripting errors in Data.ini.> > Regards,> Godlord.Ok, I did but that doesn't fix anything, it just tells me there is an error with the /setname script.. Link to comment Share on other sites More sharing options...
Godlord Posted August 26, 2009 Share Posted August 26, 2009 @Ertzel:> Ok, I did but that doesn't fix anything, it just tells me there is an error with the /setname script..Which is exactly why I wanted you to turn it on. What does the error say?Regards, Godlord. Link to comment Share on other sites More sharing options...
Ertzel Posted August 26, 2009 Author Share Posted August 26, 2009 @Godlord:> Which is exactly why I wanted you to turn it on. What does the error say?> > Regards,> Godlord.TYPE: Expected StatementLINE: 69COLUMN: 0CODE: Case"/setname" Link to comment Share on other sites More sharing options...
Admiral Refuge Posted August 26, 2009 Share Posted August 26, 2009 Shouldn't:Case"/setname"Be:Case "/setname"? Link to comment Share on other sites More sharing options...
Godlord Posted August 26, 2009 Share Posted August 26, 2009 @Ã…ÃÂüiÑÂôζ:> Shouldn't:> Case"/setname"> Be:> Case "/setname"> ?Yes, my fault. I hate this keyboard because the keys are stickier than what I'm used to.Regards, Godlord. Link to comment Share on other sites More sharing options...
Ertzel Posted August 26, 2009 Author Share Posted August 26, 2009 adding the space still brought up the same error. only the error message had a space in it now also. Link to comment Share on other sites More sharing options...
Godlord Posted August 26, 2009 Share Posted August 26, 2009 @Ertzel:> adding the space still brought up the same error. only the error message had a space in it now also.Sounds like you added it to the wrong place or something. Do you mind showing up your Sub Commands?Regards, Godlord. Link to comment Share on other sites More sharing options...
Lam3r Posted August 26, 2009 Share Posted August 26, 2009 @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 More sharing options...
Ertzel Posted August 27, 2009 Author Share Posted August 27, 2009 @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 More sharing options...
Godlord Posted August 27, 2009 Share Posted August 27, 2009 @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 More sharing options...
Ertzel Posted August 27, 2009 Author Share Posted August 27, 2009 ```' 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 SelectCase "/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 More sharing options...
Bobosk Posted August 27, 2009 Share Posted August 27, 2009 Cases go BEFORE the End Select…. Link to comment Share on other sites More sharing options...
Ertzel Posted August 27, 2009 Author Share Posted August 27, 2009 Ok I changed that but it still wont work >.< 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