wc3edit.net

United Warcraft 3 map hacking!
It is currently April 28th, 2024, 2:20 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: May 10th, 2009, 2:57 pm 
Offline
Forum Fanatic
User avatar

Joined: October 8th, 2008, 4:21 pm
Posts: 367
How can I insert a simple change name Command
That requires no activation
And evry one can use it

_________________
Spoiler:
Image
Kidn


Top
 Profile  
 
PostPosted: May 10th, 2009, 4:55 pm 
Offline
Forum Staff
User avatar

Joined: January 1st, 2008, 12:58 am
Posts: 862
Here's the one I wrote for my map, You'll need JNGP to compile it.
Spoiler:
Code:
scope ChangeName initializer init

    globals
        private constant string        TRIGGER     = "-" // The activator E.G. "-name"
        private constant string        COMMAND     = "name" //The Cmd E.G. "-changename"
        private constant integer       LENGTH      = StringLength( TRIGGER ) + StringLength( COMMAND )
        private constant integer       MAX_LENGTH  = 16 // Maximum characters E.G. "-name 123456789123456"

        private          string  array pSaveListed
        private          integer       pSaveCount  = 0
    endglobals

    private function addSaveListed takes string s returns nothing
        set pSaveCount              = pSaveCount + 1
        set pSaveListed[pSaveCount] = StringCase( s, false )
    endfunction

    private function RegisterChatEvent takes trigger t, string s returns nothing
        local integer i = 0
           loop
              exitwhen i > 11
              call TriggerRegisterPlayerChatEvent( t, Player(i), s, false )
              set i = i + 1
          endloop
    endfunction

    private function isSaveListed takes string s returns boolean
        local integer i = 0

        set s = StringCase( s, false )
        loop
            set i = i + 1
            exitwhen i > pSaveCount

            if s == pSaveListed[i] then
                return true
            endif
        endloop

        return false
    endfunction

    private function conditions takes nothing returns boolean
        return SubString( GetEventPlayerChatString(), 0, LENGTH ) == TRIGGER + COMMAND
    endfunction

    private function actions takes nothing returns nothing
        local string  e = GetEventPlayerChatString()
        local string  s = SubString( e, LENGTH + 1, StringLength( e ) )
        local integer l = StringLength( s )
        local player  p = GetTriggerPlayer()

        if l > 0 and l < MAX_LENGTH then

            if isSaveListed( s ) then
                call DisplayTextToPlayer( p, 0, 0, "You can't change your name to an Administrator." )
            else
                call SetPlayerName( p, s )
            endif
        endif
        set p = null
    endfunction

    //===========================================================================
    private function init takes nothing returns nothing
        local trigger t = CreateTrigger(  )
        call RegisterChatEvent( t, TRIGGER + COMMAND )
        call TriggerAddCondition( t, Condition( function conditions ) )
        call TriggerAddAction( t, function actions )
        call addSaveListed( "The_Risen_One" )
        set t = null
    endfunction

endscope

_________________
Image
Wanna learn to hack maps? --> Guide


Top
 Profile  
 
PostPosted: May 11th, 2009, 1:26 pm 
Offline
Forum Fanatic
User avatar

Joined: October 8th, 2008, 4:21 pm
Posts: 367
Yeah but I am not going to insert it in my map
I want to insert it from JassCraft

_________________
Spoiler:
Image
Kidn


Top
 Profile  
 
PostPosted: May 11th, 2009, 8:42 pm 
Offline
Forum Staff
User avatar

Joined: January 1st, 2008, 12:58 am
Posts: 862
There should be a built one in a few cheatpacks.

_________________
Image
Wanna learn to hack maps? --> Guide


Top
 Profile  
 
PostPosted: May 13th, 2009, 9:42 pm 
Offline
Spice Pirate
User avatar

Joined: January 29th, 2009, 5:35 pm
Posts: 949
Location: Canada
Title: LHC
This should work, probably. Works like "-name x" where x is the new name you want.

Code:
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:
xkiska wrote:
BARTIMEAUS is more understandable then u
Senethior459 wrote:
Wow, Dream Theatre reminds me of Dragonforce, but with real skill.
Ozzapoo wrote:
We laughed, we cried. Trashed.
Quote:
FatherSpace: You don't find smart chicks hawt?
GeorgeMots: not anymore, im fed up with that kind of girls
FatherSpace: lol
FatherSpace: What happened?
GeorgeMots: most smart girls find out that i date/do/see other girls....
FatherSpace: ...
FatherSpace: So monogamy is your enemy?
Quote:
Bartimaeus: Hmm, well, I hope my sister hasn't been kidnapped.
FatherSpace: What happened, Bart?
Bartimaeus: She walked out of the house saying that she was going over to some friends, and it's been like two hours, and my mom is trying to get a hold of her, which she's been unable to.
Bartimaeus: I can also hear three car alarms going off.
GeorgeMots: how old is she?
Bartimaeus: I haven't a clue. Probably 17.
UndeadxAssassin: wut
AbusivePie: You don't know how old your sister is?
Bartimaeus: Nope.
UndeadxAssassin: Epic fail
GeorgeMots: is she cute??
Quote:
Bartimaeus: So, uh, how about you get into the Christmas spirit and put that avatar on before I do it myself and take away your bloody avatar-changin' rights?
Quote:
UndeadxAssassin: If I thought of a random one...
UndeadxAssassin: Like....
UndeadxAssassin: I'll get back to you on that


Top
 Profile  
 
PostPosted: May 14th, 2009, 12:28 pm 
Offline
Forum Fanatic
User avatar

Joined: October 8th, 2008, 4:21 pm
Posts: 367
Try it.It doesn't work

_________________
Spoiler:
Image
Kidn


Top
 Profile  
 
PostPosted: May 14th, 2009, 6:45 pm 
Offline
Spice Pirate
User avatar

Joined: January 29th, 2009, 5:35 pm
Posts: 949
Location: Canada
Title: LHC
Ops, no endif.

Just add in an endif above the endfunction. :D

_________________
Spoiler:
xkiska wrote:
BARTIMEAUS is more understandable then u
Senethior459 wrote:
Wow, Dream Theatre reminds me of Dragonforce, but with real skill.
Ozzapoo wrote:
We laughed, we cried. Trashed.
Quote:
FatherSpace: You don't find smart chicks hawt?
GeorgeMots: not anymore, im fed up with that kind of girls
FatherSpace: lol
FatherSpace: What happened?
GeorgeMots: most smart girls find out that i date/do/see other girls....
FatherSpace: ...
FatherSpace: So monogamy is your enemy?
Quote:
Bartimaeus: Hmm, well, I hope my sister hasn't been kidnapped.
FatherSpace: What happened, Bart?
Bartimaeus: She walked out of the house saying that she was going over to some friends, and it's been like two hours, and my mom is trying to get a hold of her, which she's been unable to.
Bartimaeus: I can also hear three car alarms going off.
GeorgeMots: how old is she?
Bartimaeus: I haven't a clue. Probably 17.
UndeadxAssassin: wut
AbusivePie: You don't know how old your sister is?
Bartimaeus: Nope.
UndeadxAssassin: Epic fail
GeorgeMots: is she cute??
Quote:
Bartimaeus: So, uh, how about you get into the Christmas spirit and put that avatar on before I do it myself and take away your bloody avatar-changin' rights?
Quote:
UndeadxAssassin: If I thought of a random one...
UndeadxAssassin: Like....
UndeadxAssassin: I'll get back to you on that


Top
 Profile  
 
PostPosted: May 15th, 2009, 12:34 pm 
Offline
Senior Member
User avatar

Joined: June 9th, 2007, 11:27 pm
Posts: 144
Location: Indonesia
with your code you loop it forever at ii=0
Code:
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

fixed

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)