i use 3851 svn tfs 0.4
Actions
CreatureScripts
i give rep+ T.T
Actions
LUA:
<action itemid="6527" event="script" value="vip/tokenExp.lua"/>
LUA:
local config = {
rate = 1.6, -- 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
LUA:
<event type="login" name="expRateToken" event="script" value="extraExpRate.lua"/>
LUA:
registerCreatureEvent(cid, "extraExpToken")
LUA:
local config = {
rate = 1.6, -- 4x More Experience
storage = 20012
}
function onLogin(cid)
local str = getPlayerStorageValue(cid, config.storage)
if(str >= 0 and (str - os.time()) > 0) then
doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your extra exp rate will expire at: " .. os.date("%X", str))
addEvent((str - os.time()) * 1000, cid)
else
doPlayerSetRate(cid, SKILL__LEVEL, 4) -- config.lua rate
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You do not have any extra experience time.")
setPlayerStorageValue(cid, config.storage, -1)
end
return TRUE
end
i give rep+ T.T
Last edited: