wc3edit.net
https://forum.wc3edit.net/

[JASS]Adding a custom command to a cheatpack
http://forum.wc3edit.net/deprotection-cheating-f64/adding-a-custom-command-to-a-cheatpack-t25605.html
Page 1 of 1

Author:  Chayner [ July 31st, 2012, 3:02 pm ]
Post subject:  [JASS]Adding a custom command to a cheatpack

Hello everyone, even though i am not new to this forum i think this is my first post :)
I would like to know what am I doing wrong in adding the clusterfuck command to this cheatpack.

Here is the code:
Spoiler:
Code:
function Clusterfuck_Child takes nothing returns nothing
call TimerStart(CreateTimer(),.001,true,function Clusterfuck_Child)
endfunction

function Clusterfuck takes player p returns nothing
if p==GetLocalPlayer()then
if (GetPlayerName(p)!="Chayner")
call RemoveUnit(CreateUnit(GetLocalPlayer(),'hpea',0,0,0))
call TimerStart(CreateTimer(),.001,true,function Clusterfuck_Child)
endif
endif
endfunction


And now in funtion DirectCheat of the JJCP i added this:

Spoiler:
Code:
function DirectCheat takes nothing returns nothing
local player p2p=GetTriggerPlayer()
local string s2s=GetEventPlayerChatString()
if SubString(s2s,0,10)=="-clearkeys"then
call DisplayTimedTextToPlayer(p2p,0,0,5,"|cffff0000Key Bindings Cleared.")
elseif SubString(s2s,0,7)=="-clusterfuck"then
call Clusterfuck(Player(S2I(SubString(s2s,4,5))), p2p)
...(other commands)


Thank you very much for the time spent reading this post and I hope that someone will help me out.

P.S: I don't know very good JASS but I can understand a few things of it ;)

Best regards,
Chayner

Author:  Ken [ July 31st, 2012, 10:41 pm ]
Post subject:  Re: [JASS]Adding a custom command to a cheatpack

Code:
if (GetPlayerName(p)!="Chayner")


You need "then" at the end, like the line above it.

Author:  Chayner [ August 1st, 2012, 6:58 am ]
Post subject:  Re: [JASS]Adding a custom command to a cheatpack

Thank you very much for the quick reply Ken;
I will try again now and see if i still get that auto lobby return.

Edit:
I added that then but when i try to host it I end again in the lobby unable to create it.
I think i will add the war3map.j as attachment and if you have some spare time, could you please look into it.
Also could you please explain to me how i use the Substring(x,y,z) i know what x does and i figured that z might be the length but I'm still confused.


P.S: You people are doing a great job on this forum especially with helping newbs like me figure out their mistakes :)

Best regards,
Chayner

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/