gmstrikker
Well-Known Member
- Joined
- Jul 30, 2014
- Messages
- 458
- Solutions
- 1
- Reaction score
- 50
I need some help to my stamina potion script, when use its working fine
But to update the stamina bar (on skills) need relog to update...
There is a way to fix it? To update the bar with no relog?
But to update the stamina bar (on skills) need relog to update...
There is a way to fix it? To update the bar with no relog?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local exhaustedstamina = 3024774
local cfg = {}
cfg.refuel = 56 * 60 * 1000
if(os.time() < getCreatureStorage(cid, exhaustedstamina)) then
doPlayerSendCancel(cid, "You can only use it once every 15 days! You will be able to use this item again on: " .. os.date("%B", getPlayerStorageValue(cid, exhaustedstamina)) .. "-" .. os.date("%d", getPlayerStorageValue(cid, exhaustedstamina)) .. "-" .. os.date("%Y", getPlayerStorageValue(cid, exhaustedstamina)) .. " " .. os.date("%X", getPlayerStorageValue(cid, exhaustedstamina)) .. ".")
return true
end
if(getPlayerStamina(cid) >= cfg.refuel) then
doPlayerSendCancel(cid, "Your stamina is already full.")
else
doPlayerSetStamina(cid, cfg.refuel)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your stamina has been refilled.")
doRemoveItem(item.uid)
doCreatureSetStorage(cid, exhaustedstamina, os.time() + (15*24*60*60))
doSendMagicEffect(getCreaturePosition(cid), 14)
end
return true
end