|
globals
integer array wp
integer array wph
gamecache gc
endglobals
function h2i takes handle h returns integer
return h   
return 0   
endfunction
function i2u takes integer i returns unit
return i
return null
endfunction
function i2it takes integer i returns item
return i
return null
endfunction
function ljwp takes nothing returns nothing
local timer tm=GetExpiredTimer()
local unit u=i2u(GetStoredInteger(gc,"dw",I2S(h2i(tm))))
local item wp1=i2it(GetStoredInteger(gc,"wp1",I2S(h2i(tm))))
local integer wp0=GetStoredInteger(gc,"wp",I2S(h2i(tm)))
local integer ljxh=0
local integer wp5
loop
if(wp[ljxh]==wp0)then
call RemoveItem(wp1)
set wp5=wph[ljxh]
call UnitAddItemByIdSwapped(wp5,u)
endif
exitwhen ljxh==1
set ljxh=ljxh+1
endloop
set tm=null
set u=null
set wp1=null
endfunction
function ljjs takes nothing returns nothing
local timer tm=CreateTimer()
local integer ljxh=0
local integer wp0
loop
if(GetItemTypeId(GetManipulatedItem())==wp[ljxh])then
set wp0=wp[ljxh]
call RemoveItem(GetManipulatedItem())
call UnitAddItemByIdSwapped('rnsp',GetTriggerUnit())
call TimerStart(tm,15,false,function ljwp)
call StoreInteger(gc,"wp",I2S(h2i(tm)),wp0)
call StoreInteger(gc,"dw",I2S(h2i(tm)),h2i(GetTriggerUnit()))
call StoreInteger(gc,"wp1",I2S(h2i(tm)),h2i(GetLastCreatedItem()))
endif
exitwhen ljxh==1
set ljxh=ljxh+1
endloop
set tm=null
endfunction
function ljsy takes nothing returns nothing
local trigger lj=CreateTrigger()
local integer ljxh=0
set wp[0]='desc'
set wp[1]='crys'
set wph[0]='ckng'
set wph[1]='ratf'
loop
call TriggerRegisterPlayerUnitEvent(lj,Player(ljxh),EVENT_PLAYER_UNIT_USE_ITEM,null)
exitwhen ljxh==11
set ljxh=ljxh+1
endloop
call TriggerAddAction(lj,function ljjs)
endfunction
为什么没用呢创建了物品15秒后不见删除也不见创建… |
|