Mr Noxi
Noxus Otserver
Hey!
So i have a exp scroll that uses storage
Script below for to check how long time the +exp scroll has left.
First off i would like it to change from seconds to minutes instead since its for 1 hour.
Other then that the script works just fine. Its just showing seconds instead of minutes.
Second issue i have is that i got a global exp booster.
i tried to apply same script above to this other global exp boost also without any success.
Ofc i changed the storage to the storage used by global booster but when i use command to check if any global exp booster is active it says that there is none active.
Global exp boost script
So i have a exp scroll that uses storage
Script below for to check how long time the +exp scroll has left.
Lua:
function onSay(cid, words, param)
local player = Player(cid)
local remaining = getPlayerStorageValue(cid, 9997) - os.time()
if remaining <= 0 then
player:sendCancelMessage("You do not have any experience boosts active!")
else
doCreatureSay(cid, "You have " .. remaining .. " seconds remaining until your extra experience expires.", TALKTYPE_ORANGE_1, true, cid)
end
return false
end
First off i would like it to change from seconds to minutes instead since its for 1 hour.
Other then that the script works just fine. Its just showing seconds instead of minutes.
Second issue i have is that i got a global exp booster.
i tried to apply same script above to this other global exp boost also without any success.
Ofc i changed the storage to the storage used by global booster but when i use command to check if any global exp booster is active it says that there is none active.
Global exp boost script
Code:
_GLOBAL_EXP_BOOST_RATE = 0.5 --- rate 2.0 mean 2x exp
_GLOBAL_EXP_BOOST_STORAGE = 66574 --- storage
_GLOBAL_EXP_BOOST_TIME = 1 --- how many hours
local cfg = {
_useEffect = true,
effect = 28
}
function endGlobalExpRate(cid)
setGlobalStorageValue(cid, _GLOBAL_EXP_BOOST_STORAGE, -1)
end
function onUse(cid, item, fromPosition, target, toPosition, isHotkey)
local player = Player(cid)
if getGlobalStorageValue(_GLOBAL_EXP_BOOST_STORAGE) > 0 then
player:say('Global Exp boost is activated you cant use this scroll at this moment.', TALKTYPE_MONSTER_SAY)
return true
end
if getGlobalStorageValue(_GLOBAL_EXP_BOOST_STORAGE) < os.time() then
setGlobalStorageValue(_GLOBAL_EXP_BOOST_STORAGE, os.time() + _GLOBAL_EXP_BOOST_TIME * 3600)
addEvent(endGlobalExpRate, _GLOBAL_EXP_BOOST_TIME * 3600 * 1000, cid.uid)
broadcastMessage(player:getName() .. " have activated the global exp boost. You will gain + 50% exp rate for 1 hour. Happy Hunting!" , MESSAGE_STATUS_WARNING)
Item(item.uid):remove(1)
if (cfg._useEffect) then
player:getPosition():sendMagicEffect(cfg.effect)
end
end
return true
end