local item_id = 1958
local lvlReq = 100
local rate = 5
function onUse(cid, item, fromPosition, itemEx, toPosition)
local playerPos = getPlayerPosition(cid)
if (item.itemid == item_id) then
if getPlayerLevel(cid) >= lvlReq then
setPlayerExtraExpRate(cid, rate)
doSendAnimatedText(playerPos, "+[" .. rate .. "]", TEXTCOLOR_WHITE)
doPlayerSendTextMessage(cid, 19, "You have now extra exp rate [".. getPlayerExtraExpRate(cid) .."]")
doRemoveItem(item_id.uid)
else
doPlayerSendCancel(cid, "You must be atleast level " .. lvlReq .. " to use this item.")
end
end
return true
end
Lua:local item_id = 1958 local lvlReq = 100 local rate = 5 function onUse(cid, item, fromPosition, itemEx, toPosition) local playerPos = getPlayerPosition(cid) if (item.itemid == item_id) then if getPlayerLevel(cid) >= lvlReq then setPlayerExtraExpRate(cid, rate) doSendAnimatedText(playerPos, "+[" .. rate .. "]", TEXTCOLOR_WHITE) doPlayerSendTextMessage(cid, 19, "You have now extra exp rate [".. getPlayerExtraExpRate(cid) .."]") doRemoveItem(item_id.uid) else doPlayerSendCancel(cid, "You must be atleast level " .. lvlReq .. " to use this item.") end end return true end
[30/10/2009 20:36:40] Lua Script Error: [Action Interface]
[30/10/2009 20:36:41] data/actions/scripts/other/expitem.lua:onUse
[30/10/2009 20:36:41] data/actions/scripts/other/expitem.lua:8: attempt to call global 'setPlayerExtraExpRate' (a nil value)
[30/10/2009 20:36:41] stack traceback:
[30/10/2009 20:36:42] data/actions/scripts/other/expitem.lua:8: in function <data/actions/scripts/other/expitem.lua:4>
local item_id = 1958
local storage = 2211
local rate = +5
function onUse(cid, item, fromPosition, itemEx, toPosition)
local playerPos = getPlayerPosition(cid)
if (item.itemid == item_id) then
if (getPlayerStorageValue(cid, storage) == -1) then
doPlayerSetRate(cid, EXPERIENCE, rate)
setPlayerStorageValue(cid, storage, 1)
doRemoveItem(item_id.uid)
else
doPlayerSendCancel(cid, "You have already raised your experience rate.")
end
end
return true
end
Lua:local item_id = 1958 local storage = 2211 local rate = +5 function onUse(cid, item, fromPosition, itemEx, toPosition) local playerPos = getPlayerPosition(cid) if (item.itemid == item_id) then if (getPlayerStorageValue(cid, storage) == -1) then doPlayerSetRate(cid, EXPERIENCE, rate) setPlayerStorageValue(cid, storage, 1) doRemoveItem(item_id.uid) else doPlayerSendCancel(cid, "You have already raised your experience rate.") end end return true end
So if there is 100 exp and you use the scroll your new exp will be x5? Nice dude! :thumbup: ( retired noob shiet! )
Isn't that the whole point of "extra exp.." :huh:
Your the one who is a noob, atleast I am trying to help and not flaming threads.
If I've understood everything right what happends when you use a exp item you will get 5x MORE experience than before? Like before I had 20x and when I used the item I would have 25x?
Isn't that the whole point of "extra exp.." :huh:
Your the one who is a noob, atleast I am trying to help and not flaming threads.
creaturescripts/scripts/scroll_login.lua
Lua:local storage = 20011 function onLogin(cid) if(getPlayerStorageValue(cid, storage) == 1) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your extra exp rate will expire at: " .. os.date("%X", getPlayerStorageValue(cid, storage))) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You do not have any extra experience time.") end return true end
actions/scripts/Scroll.lua
Lua:local config = { rate = 2.0, -- 2x More Experience time = 60, -- Minutes of Exp Time storage = 20011 } function onUse(cid, item, fromPosition, itemEx, toPosition) local tid = itemEx.uid or cid if(isPlayer(tid) ~= TRUE) then return false end if(getPlayerStorageValue(tid, config.storage) == 1) then doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "Your extra exp rate will expire at: " .. os.date("%X", getPlayerStorageValue(tid, config.storage))) return true end doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate has been activated! It is now: " .. config.rate .. ".") doPlayerSetRate(tid, SKILL__LEVEL, config.rate) setPlayerStorageValue(tid, config.storage, os.time() + config.time * 60 * 1000) addEvent(endExpRate, config.time * 60 * 1000, tid) doRemoveItem(item.uid, 1) return true end local function endExpRate(tid) doPlayerSetRate(tid, SKILL__LEVEL, 1.0) --config.lua rate setPlayerStorageValue(tid, config.storage, -1) doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.") end
Login.lua<event type="login" name="expscroll" event="script" value="scroll_login.lua"/>
registerCreatureEvent(cid, "expscroll")
creaturescripts/scripts/scroll_login.lua
Lua:local storage = 20011 function onLogin(cid) if(getPlayerStorageValue(cid, storage) == 1) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your extra exp rate will expire at: " .. os.date("%X", getPlayerStorageValue(cid, storage))) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You do not have any extra experience time.") end return true end
actions/scripts/Scroll.lua
Lua:local config = { rate = 2.0, -- 2x More Experience time = 60, -- Minutes of Exp Time storage = 20011 } function onUse(cid, item, fromPosition, itemEx, toPosition) local tid = itemEx.uid or cid if(isPlayer(tid) ~= TRUE) then return false end if(getPlayerStorageValue(tid, config.storage) == 1) then doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "Your extra exp rate will expire at: " .. os.date("%X", getPlayerStorageValue(tid, config.storage))) return true end doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate has been activated! It is now: " .. config.rate .. ".") doPlayerSetRate(tid, SKILL__LEVEL, config.rate) setPlayerStorageValue(tid, config.storage, os.time() + config.time * 60 * 1000) addEvent(endExpRate, config.time * 60 * 1000, tid) doRemoveItem(item.uid, 1) return true end local function endExpRate(tid) doPlayerSetRate(tid, SKILL__LEVEL, 1.0) --config.lua rate setPlayerStorageValue(tid, config.storage, -1) doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.") end
06:15 You do not have any extra experience time.
registerCreatureEvent(cid, "expRate")
local storage = 20011
function onLogin(cid)
if(getPlayerStorageValue(cid, storage) == 1) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your extra exp rate will expire at: " .. os.date("%X", getPlayerStorageValue(tid, config.storage)).")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You do not have any extra experience time.")
setPlayerStorageValue(cid, storage, -1)
end
return true
end