I want to add a command where you get skill/stat points into any map...like say -sp XX.
What should i put under globals/endglobals/function main?
Thanks in advance
Inserting a command into a map
Moderator: Cheaters
-
- Junior Member
- Posts: 26
- Joined: December 28th, 2008, 12:05 am
-
- Forum Staff
- Posts: 811
- Joined: January 1st, 2008, 12:58 am
Re: Inserting a command into a map
Code: Select all
function blahblah takes string s returns nothing
local group g = CreateGroup()
local player p = GetTriggerPlayer()
call GroupEnumUnitsSelected(g,p,null)
if SubString(s, 0, 8) == "-add "then
set XXX[(1+GetPlayerId(p))]=(XXX[(1+GetPlayerId(p))]+S2I(SubString(s, 5, 8))) //Replace XXX with the variable that stores the points.
endif
call DestroyGroup( g )
set g = null
set p = null
endfunction
function blah takes nothing returns nothing
local string s = GetEventPlayerChatString()
call blahblah(s)
endfunction
Old code, should work.
Wanna learn to hack maps? --> Guide
-
- Junior Member
- Posts: 26
- Joined: December 28th, 2008, 12:05 am
Re: Inserting a command into a map
set XXX[(1+GetPlayerId(p))]=(XXX[(1+GetPlayerId(p))]+S2I(SubString(s, 5, )) //Replace XXX with the variable that stores the points.
That line doesn't work
That line doesn't work
-
- Spice Pirate
- Posts: 862
- Joined: January 29th, 2009, 5:35 pm
- Title: LHC
- Location: Canada
Re: Inserting a command into a map
You're supposed to change XXX to the variable name for the integer array holding the value of their rank. So, if you declared it as:
You'd replace XXX with udg_PlayerScore.
PS: Risen, what's the stuff with group g do?
Code: Select all
globals
integer array udg_PlayerScore
endglobals
You'd replace XXX with udg_PlayerScore.
PS: Risen, what's the stuff with group g do?
Spoiler:
-
- Banned-To-Be
- Posts: 1378
- Joined: July 28th, 2008, 6:28 pm
- Title: Administrator
Re: Inserting a command into a map
ldynamic wrote:set XXX[(1+GetPlayerId(p))]=(XXX[(1+GetPlayerId(p))]+S2I(SubString(s, 5, )) //Replace XXX with the variable that stores the points.
That line doesn't work
Did you replace "XXX" with the variable that stores points?
You can also do this if you're using jjcp
Code: Select all
if SubString(s2s,0,6)=="-gold "then
call SetPlayerState(p2p,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p2p,PLAYER_STATE_RESOURCE_GOLD)+S2I(SubString(s2s,6,13)))
elseif SubString(s2s,0,5)=="-rank"then
set XXX[(1+GetPlayerId(GetTriggerPlayer()))]=XXX[(1+GetPlayerId(GetTriggerPlayer()))]+S2I(SubString(s2s,6,13))
set XXX[(1+GetPlayerId(GetTriggerPlayer()))]=XXX[(1+GetPlayerId(GetTriggerPlayer()))]+S2I(SubString(s2s,6,13))
elseif SubString(s2s,0,7)=="-lumber"then
call SetPlayerState(p2p,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p2p,PLAYER_STATE_RESOURCE_LUMBER)+S2I(SubString(s2s,8,15)))
.. it's between the -gold and -lumber command
League of legends North America - Nietono
-
- Junior Member
- Posts: 26
- Joined: December 28th, 2008, 12:05 am
Re: Inserting a command into a map
FatherSpace wrote:You're supposed to change XXX to the variable name for the integer array holding the value of their rank. So, if you declared it as:Code: Select all
globals
integer array udg_PlayerScore
endglobals
You'd replace XXX with udg_PlayerScore.
PS: Risen, what's the stuff with group g do?
Doesn't work...
Lanaya wrote:ldynamic wrote:set XXX[(1+GetPlayerId(p))]=(XXX[(1+GetPlayerId(p))]+S2I(SubString(s, 5, )) //Replace XXX with the variable that stores the points.
That line doesn't work
Did you replace "XXX" with the variable that stores points?
You can also do this if you're using jjcpCode: Select all
if SubString(s2s,0,6)=="-gold "then
call SetPlayerState(p2p,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p2p,PLAYER_STATE_RESOURCE_GOLD)+S2I(SubString(s2s,6,13)))
elseif SubString(s2s,0,5)=="-rank"then
set XXX[(1+GetPlayerId(GetTriggerPlayer()))]=XXX[(1+GetPlayerId(GetTriggerPlayer()))]+S2I(SubString(s2s,6,13))
set XXX[(1+GetPlayerId(GetTriggerPlayer()))]=XXX[(1+GetPlayerId(GetTriggerPlayer()))]+S2I(SubString(s2s,6,13))
elseif SubString(s2s,0,7)=="-lumber"then
call SetPlayerState(p2p,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p2p,PLAYER_STATE_RESOURCE_LUMBER)+S2I(SubString(s2s,8,15)))
.. it's between the -gold and -lumber command
I tried the "-rank" one, s2s is a undeclared varable..and i tried replacing XXX with the variable the stores the points; no luck
-
- Banned-To-Be
- Posts: 1378
- Joined: July 28th, 2008, 6:28 pm
- Title: Administrator
Re: Inserting a command into a map
ldynamic wrote:I tried the "-rank" one, s2s is a undeclared varable..and i tried replacing XXX with the variable the stores the points; no luck
It's undeclared because you didnt add in jjcp . . .
League of legends North America - Nietono
-
- Junior Member
- Posts: 26
- Joined: December 28th, 2008, 12:05 am
Re: Inserting a command into a map
I did use JJCP
-
- Forum Staff
- Posts: 811
- Joined: January 1st, 2008, 12:58 am
Re: Inserting a command into a map
You'll have to add a local / global trigger if you want it to be called, if that's your problem.
Wanna learn to hack maps? --> Guide