eyez
Member
- Joined
- Oct 11, 2016
- Messages
- 129
- Reaction score
- 19
Anybody could help me to finish my action item to add exp bonus temporally?
Add 50% exp bonus for 1 hour.
Add 50% exp bonus for 1 hour.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getCreatureCondition(cid, CONDITION_INFIGHT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can not use this item in fight!")
return true
end
local exhaustedvoucher = 3024775
if(os.time() < getCreatureStorage(cid, exhaustedvoucher)) then
doPlayerSendCancel(cid, "You can only use it once every 20 hours! You will be able to use this item again on: " .. os.date("%B", getPlayerStorageValue(cid, exhaustedvoucher)) .. "-" .. os.date("%d", getPlayerStorageValue(cid, exhaustedvoucher)) .. "-" .. os.date("%Y", getPlayerStorageValue(cid, exhaustedvoucher)) .. " " .. os.date("%X", getPlayerStorageValue(cid, exhaustedvoucher)) .. ".")
return true
end
-- add 50% exp bonus for 1 hour
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Now you have 50% EXP bonus for 1 hour.")
doRemoveItem(item.uid)
doCreatureSetStorage(cid, exhaustedvoucher, os.time() + (1*20*60*60))
doSendMagicEffect(getCreaturePosition(cid), 14)
return true
end