noshirtstan
New Member
- Joined
- Aug 2, 2020
- Messages
- 68
- Reaction score
- 2
So hey guys, back again. I would like to have my script start counting down when you use the item, then after 5 min, remove the item. I thought I had the syntax correct, but I can't seem to get it. It either deletes it right away or deletes it on the second click.
Here is what I have so far
Any thoughts?
So I thought of a better solution instead lol.
Thank you =)
Admin please delete this post.
Thank you
Here is what I have so far
Lua:
local mineGone = os.time()
function onUse(player, item, fromPosition, itemEx, toPosition)
if item.itemid == 26405 and isInArray({50605, 50602, 50603, 50604}, item.actionid) then
if mineGone == os.time() then
elseif mineGone < os.time() then
item:remove(26405)
end
if player:getCondition(player, CONDITION_COOLDOWN, 160) then
player:sendCancelMessage("You are already gathering!")
return true
end
if not player:isGatheringJob(item.actionid) then
player:sendCancelMessage("You must learn "..craftingGatheringJobConfig[item.actionid].skillName.." before using this.")
return true
end
if player:isGatheringJob(item.actionid) then
if player:getStorageValue(205000) > os.time() then
player:sendCancelMessage("You must wait before mining this again!")
return true
end
if player:getItemCount(2553) >= 1 then -- check for pick
mathCheck = math.floor(math.random() * 100) + 1
if mathCheck >= 50 then
player:addItem(26410, math.floor(math.random() * 3) + 1)
elseif mathCheck <= 49 then
player:addItem(26409, math.floor(math.random() * 3)+ 1)
end
else
player:sendCancelMessage("You need a pick to use this!")
return true
end
end
player:setStorageValue(205000, os.time() + 5)
mineGone = os.time() + 300
Any thoughts?
Post automatically merged:
So I thought of a better solution instead lol.
Thank you =)
Post automatically merged:
Admin please delete this post.
Thank you
Last edited: