Inserting a command into a map

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

ldynamic
Junior Member
Posts: 26
Joined: December 28th, 2008, 12:05 am

Inserting a command into a map

Post by ldynamic »

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
User avatar
Risen
Forum Staff
Posts: 811
Joined: January 1st, 2008, 12:58 am

Re: Inserting a command into a map

Post by Risen »

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.
Image
Wanna learn to hack maps? --> Guide
ldynamic
Junior Member
Posts: 26
Joined: December 28th, 2008, 12:05 am

Re: Inserting a command into a map

Post by ldynamic »

set XXX[(1+GetPlayerId(p))]=(XXX[(1+GetPlayerId(p))]+S2I(SubString(s, 5, 8))) //Replace XXX with the variable that stores the points.

That line doesn't work
User avatar
Ken
Spice Pirate
Posts: 862
Joined: January 29th, 2009, 5:35 pm
Title: LHC
Location: Canada

Re: Inserting a command into a map

Post by Ken »

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?
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.
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?
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??
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?
UndeadxAssassin: If I thought of a random one...
UndeadxAssassin: Like....
UndeadxAssassin: I'll get back to you on that
User avatar
Lanaya
Banned-To-Be
Posts: 1378
Joined: July 28th, 2008, 6:28 pm
Title: Administrator

Re: Inserting a command into a map

Post by Lanaya »

ldynamic wrote:set XXX[(1+GetPlayerId(p))]=(XXX[(1+GetPlayerId(p))]+S2I(SubString(s, 5, 8))) //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
Image
League of legends North America - Nietono
ldynamic
Junior Member
Posts: 26
Joined: December 28th, 2008, 12:05 am

Re: Inserting a command into a map

Post by ldynamic »

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, 8))) //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


I tried the "-rank" one, s2s is a undeclared varable..and i tried replacing XXX with the variable the stores the points; no luck
User avatar
Lanaya
Banned-To-Be
Posts: 1378
Joined: July 28th, 2008, 6:28 pm
Title: Administrator

Re: Inserting a command into a map

Post by Lanaya »

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 . . .
Image
League of legends North America - Nietono
ldynamic
Junior Member
Posts: 26
Joined: December 28th, 2008, 12:05 am

Re: Inserting a command into a map

Post by ldynamic »

I did use JJCP
User avatar
Risen
Forum Staff
Posts: 811
Joined: January 1st, 2008, 12:58 am

Re: Inserting a command into a map

Post by Risen »

You'll have to add a local / global trigger if you want it to be called, if that's your problem.
Image
Wanna learn to hack maps? --> Guide