• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Change player name

Status
Not open for further replies.
Level 4
Joined
Jan 30, 2012
Messages
61
Hello,

i need help...again xD

I want that if anyone enters a text he shall get this entered text to his name
example: Player Name: I_Master_I

-name Gamer

then his name is: I_Master_I (Gamer)

^^


Best Regards ^^
 
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set PlayerBaseName[(Integer A)] = (Name of (Player((Integer A))))
  • ChangeName
    • Events
      • Joueur - Joueur 1 (Rouge) types a chat message containing -name as A sub-string
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (String((Entered chat string)) as Lower-case) Equals to (==) -name
        • Then - Actions
          • Player - Set name of (Triggering player) to PlayerBaseName[(Player number of (Triggering player))]
        • Else - Actions
          • Player - Set name of (Triggering player) to (PlayerBaseName[(Player number of (Triggering player))] + " (" + Substring((Entered chat string), 7, (Length of (Entered chat string))) + ")" )
PlayerBaseName is an array string variable.
This way, it won't add a new name every time the player uses the command and he can get his default name by just typing "-name".

I removed some parenthesis in the trigger and I put "" for better readability. I guess you'll get the point.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
  • Melee Initialization
    • Events
      • Player - Player 1 (Red) types a chat message containing -name as A substring
    • Conditions
    • Actions
      • Player - Set name of Player 1 (Red) to (Substring((Entered chat string), 7, (Length of (Entered chat string))))
 
Level 4
Joined
Jan 30, 2012
Messages
61
Illidans911 i did the same but i did at Event not " as a substring "... i did "as an exaxt match" :D

Thanks to you two ^^
 
Status
Not open for further replies.
Top