How can I insert a simple change name Command
That requires no activation
And evry one can use it
Simple Change name Command?
Moderator: Cheaters
-
- Forum Fanatic
- Posts: 342
- Joined: October 8th, 2008, 4:21 pm
-
- Forum Staff
- Posts: 811
- Joined: January 1st, 2008, 12:58 am
Re: Simple Change name Command?
Here's the one I wrote for my map, You'll need JNGP to compile it.
Spoiler:
-
- Forum Fanatic
- Posts: 342
- Joined: October 8th, 2008, 4:21 pm
Re: Simple Change name Command?
Yeah but I am not going to insert it in my map
I want to insert it from JassCraft
I want to insert it from JassCraft
Spoiler:
-
- Forum Staff
- Posts: 811
- Joined: January 1st, 2008, 12:58 am
-
- Spice Pirate
- Posts: 862
- Joined: January 29th, 2009, 5:35 pm
- Title: LHC
- Location: Canada
Re: Simple Change name Command?
This should work, probably. Works like "-name x" where x is the new name you want.
Code: Select all
globals
Trigger trg_NameChange = CreateTrigger()
// the rest of your globals
endglobals
function NameChange_Actions takes nothing returns nothing
local string s = GetEventPlayerChatString()
local string s2 = SubString(s, 6, StringLength(s)+1)
if SubString( s, 0, 6) == "-name " then
call SetPlayerName( GetTriggerPlayer(), s2 )
endfunction
// the rest of your functions
function Main takes nothing returns nothing
// function main locals
local integer ii = 0
loop
exitwhen ii > 11
call TriggerRegisterPlayerChatEvent( trg_NameChange, Player(ii), "-name ", false )
endloop
call TriggerAddAction( trg_NameChange, function NameChange_Actions )
// the rest of function main
Spoiler:
-
- Forum Fanatic
- Posts: 342
- Joined: October 8th, 2008, 4:21 pm
-
- Spice Pirate
- Posts: 862
- Joined: January 29th, 2009, 5:35 pm
- Title: LHC
- Location: Canada
-
- Senior Member
- Posts: 136
- Joined: June 9th, 2007, 11:27 pm
- Location: Indonesia
Re: Simple Change name Command?
with your code you loop it forever at ii=0
fixed
Code: Select all
globals
Trigger trg_NameChange = CreateTrigger()
// the rest of your globals
endglobals
function NameChange_Actions takes nothing returns nothing
local string s = GetEventPlayerChatString()
local string s2 = SubString(s, 6, StringLength(s)+1)
if SubString( s, 0, 6) == "-name " then
call SetPlayerName( GetTriggerPlayer(), s2 )
endif
endfunction
// the rest of your functions
function Main takes nothing returns nothing
// function main locals
local integer ii = 0
loop
exitwhen ii > 11
call TriggerRegisterPlayerChatEvent( trg_NameChange, Player(ii), "-name ", false )
set ii=ii+1
endloop
call TriggerAddAction( trg_NameChange, function NameChange_Actions )
// the rest of function main
