narko
vertrauenswürdig ~
Hi there! I hope someone can help me out with this as I've already tried for hours. I was trying to make a weapon that has a duration. As it is now, the weapon starts counting the duration once I create it. What I want to achieve is that the duration starts counting once the player equips the item and stop counting when it deEquip, this can be done using two different ID's but I wonder if this can be done using the same item ID.
Here's a script of what I tried to do, ofc it didn't work.
Thanks in advance.
Here's a script of what I tried to do, ofc it didn't work.
LUA:
function onEquip(cid, item, slot)
local player = Player(cid)
local slots = getPlayerSlotItem(cid,slot)
if slots.itemid ~= item.itemid then
return true
end
local item = player:getSlotItem(CONST_SLOT_LEFT)
print(item)
item:setAttribute(ITEM_ATTRIBUTE_DECAYSTATE, true)
print("Start duration!")
end
function onDeEquip(cid, item, slot)
local player = Player(cid)
local item = player:getSlotItem(CONST_SLOT_LEFT)
print(item)
item:setAttribute(ITEM_ATTRIBUTE_DECAYSTATE, false)
print("Stop duration!")
end
Thanks in advance.
Last edited: