[TRIGGER=GUI Trigger]
Player - Player 1 (Red) types a chat message containing -set name as A substring
Player - Player 2 (Blue) types a chat message containing -set name as A substring
Player - Player 3 (Teal) types a chat message containing -set name as A substring
Set s = (Substring((Entered chat string), 11, (Length of (Entered chat string))))
Player - Set name of (Triggering player) to s
Game - Display to (All players) the text: (Name of (Triggering player))
[/TRIGGER]
[JASS=JASS Script]
function Trig_Melee_Initialization_Copy_Actions takes nothing returns nothing
local string s = SubString(GetEventPlayerChatString(),11-1,StringLength(GetEventPlayerChatString()))
call SetPlayerName( GetTriggerPlayer(), s )
call DisplayTextToForce( GetPlayersAll(), GetPlayerName(GetTriggerPlayer()) )
endfunction
//===========================================================================
function InitTrig_Melee_Initialization_Copy takes nothing returns nothing
set gg_trg_Melee_Initialization_Copy = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Melee_Initialization_Copy, Player(0), "-set name ", false )
call TriggerRegisterPlayerChatEvent( gg_trg_Melee_Initialization_Copy, Player(1), "-set name ", false )
call TriggerRegisterPlayerChatEvent( gg_trg_Melee_Initialization_Copy, Player(2), "-set name ", false )
call TriggerAddAction( gg_trg_Melee_Initialization_Copy, function Trig_Melee_Initialization_Copy_Actions )
endfunction
[/code]