I tried with logic, but it still can't, can you tell me what's missing from the command that I made?
Code:
function beta_test takes nothing returns nothing
local player beta_trigger = GetTriggerPlayer()
local string beta_chat = GetEventPlayerChatString()
local string beta_cmd = SubString(src,0,6)
local unit beta_unit
if(beta_cmd == "-item ")then
call SetItemCharges(UnitAddItemByIdSwapped('I001',beta_unit),99)
endif
endfunction
function beta_item_init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
exitwhen i > 24
call TriggerRegisterPlayerChatEvent(t, Player(i), "-item ", false)
set i = i + 1
endloop
call TriggerAddAction(t, function beta_test)
set t = null
endfunction
function main takes nothing returns nothing
call beta_item_init()
endfunction
other test command
Code:
function beta_test takes nothing returns nothing
local player beta_trigger = GetTriggerPlayer()
local string beta_chat = GetEventPlayerChatString()
local string beta_cmd = SubString(src,0,6)
local unit beta_unit
if(beta_cmd == "-item ")then
call SetItemCharges(UnitAddItemByIdSwapped('I001',beta_unit),99)
endif
endfunction
function main takes nothing returns nothing
call beta_test()
endfunction
other test #2
Code:
function beta_test takes nothing returns nothing
local player beta_trigger = GetTriggerPlayer()
local string beta_chat = GetEventPlayerChatString()
local string beta_cmd = SubString(src,0,6)
local unit beta_unit
if(beta_cmd == "-item ")then
call SetItemCharges(UnitAddItemByIdSwapped('I001',beta_unit),99)
endif
set beta_trigger=null
set beta_chat=null
set beta_cmd=null
set betaunit=null
endfunction
function beta_item_init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
exitwhen i > 24
call TriggerRegisterPlayerChatEvent(t, Player(i), "-item ", false)
set i = i + 1
endloop
call TriggerAddAction(t, function beta_test)
set t = null
endfunction
function main takes nothing returns nothing
call beta_item_init()
endfunction
Sorry if I asked a lot, oot from the forum rules, if possible please rewrite this script so that I can understand, thank you. My respect to the forum wc3edit.net forum.
Sorry if my posts double posts / triple posts, if my posts violate the rules tell me and delete my posts, if possible don't ban me T ^ T. thank you.