NieWiemJakiNick
New Member
- Joined
- Jan 7, 2011
- Messages
- 7
- Reaction score
- 0
Please help with a script on exp x2 for 5 h.
So, I have a script but when a player or die Become the script stops working.
So I will explain further what is wrong. The script adds storage to the player and when the player has the storage he have bonus exp. but when the time is up, storage is removed. By contrast, when a player die or is a character relog storage will have to constantly ... How do I fix this?
Sorry for bad english. I use google translator ;p
Any ideas? ;|
So, I have a script but when a player or die Become the script stops working.
Code:
local config = {
rate = 2.0, -- 4x More Experience
time = 5, -- Hours of Exp Time
storage = 20012
}
local function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, config.storage) < 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.")
doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600)
addEvent(endExpRate, config.time * 3600 * 1000, cid)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
end
return TRUE
end
So I will explain further what is wrong. The script adds storage to the player and when the player has the storage he have bonus exp. but when the time is up, storage is removed. By contrast, when a player die or is a character relog storage will have to constantly ... How do I fix this?
Sorry for bad english. I use google translator ;p
Any ideas? ;|
Last edited: