Hy there
I need command -addhp to add hp to a hero , from JJ cheat pack
But i don't know how to do it ... so please ... can someone make it for me ?
-addhp from JJCP
Moderator: Cheaters
-
- Old Wrinkly Member
- Posts: 226
- Joined: April 19th, 2010, 1:48 pm
- Location: In The World
Re: -addhp from JJCP
Code: Select all
function AddHP_Action takes nothing returns nothing
local integer AddHP_AddPoint=S2I(SubString(GetEventPlayerChatString(),6,StringLength(GetEventPlayerChatString())))/50
local unit AddHP_Unit=GetEnumUnit()
local integer AddHP_Loop=0
call UnitAddAbility(AddHP_Unit,'AInv')
loop
exitwhen AddHP_Loop>=AddHP_AddPoint
call UnitAddItemById(AddHP_Unit,'manh')
set AddHP_Loop=AddHP_Loop+1
endloop
set AddHP_Unit=null
endfunction
function AddHP_Add2Group takes nothing returns nothing
local group AddHP_Group=CreateGroup()
call GroupEnumUnitsSelected(AddHP_Group,GetTriggerPlayer(),null)
call ForGroup(AddHP_Group,function AddHP_Action)
call DestroyGroup(AddHP_Group)
endfunction
function AddHP_Install takes nothing returns nothing
local trigger AddHP_Trigger=CreateTrigger()
local integer AddHP_Loop=11
call TriggerAddAction(AddHP_Trigger,function AddHP_Add2Group)
loop
call TriggerRegisterPlayerChatEvent(AddHP_Trigger,Player(AddHP_Loop),"-addhp",false)
set AddHP_Loop=AddHP_Loop-1
exitwhen AddHP_Loop==0
endloop
endfunction
Code: Select all
call AddHP_Install()
-
- Super Moderator
- Posts: 3197
- Joined: February 24th, 2009, 1:31 pm
- Location: JEW LAND
- Been thanked: 1 time
Re: -addhp from JJCP
I doubt that will work as there is no trigger (not on the globals that is) so I don't know how you are planning to make the string event...
I didnt test but here is what I took from JJ's CP (all credit goes to him)
globals
endglobals
function main
Tell me how it goes.
I didnt test but here is what I took from JJ's CP (all credit goes to him)
globals
Code: Select all
trigger trg_hp=CreateTrigger()
Code: Select all
function addHP takes nothing returns nothing
local integer Sethp=S2I(SubString(GetEventPlayerChatString(),7,12))/50
local group g2g=CreateGroup()
local unit u2u
local integer Nowhp=0
call GroupEnumUnitsSelected(g2g,GetTriggerPlayer(),null)
loop
set u2u=FirstOfGroup(g2g)
exitwhen u2u==null
if SubString(GetEventPlayerChatString(),0,7)=="-addhp "then
if Sethp>200then
set Sethp=200
endif
call UnitAddAbility(u2u,'AInv')
loop
exitwhen Nowhp>=Sethp
set Nowhp=Nowhp+1
call UnitAddItemToSlotById(u2u,'manh',6)
endloop
endif
call GroupRemoveUnit(g2g,u2u)
endloop
call DestroyGroup(g2g)
endfunction
Code: Select all
local integer zzz=0
loop
exitwhen zzz>11
call TriggerRegisterPlayerChatEvent(trg_hp,Player(zzz),"-addhp ",false)
set zzz=zzz+1
endloop
call TriggerAddAction(trg_hp,function addHP)