• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Action Extra exp rate scroll

creaturescripts/creaturescripts.xml
Code:
<event type="login" name="expRate" event="script" value="extraExpRate.lua"/>

creaturescripts/scripts/login.lua
Code:
registerCreatureEvent(cid, "expRate")

creaturescripts/scripts/expRateCheck.lua
Code:
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

actions/scripts/extraExpRate.lua
Code:
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) == false) then
        print("Invalid")
    end
    if(getPlayerStorageValue(tid, config.storage) == 1) then
        doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
        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 * 60000, 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

Now i get this error when player is using it:



&

[24/11/2009 01:15:30] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/extraExpRate.lua)
[24/11/2009 01:15:30] data/creaturescripts/scripts/extraExpRate.lua:4: unfinished string near '")'
 
Last edited:
I edited the last part, for actions.
Copy it and try it again Frank. :thumbup:
 
I edited the last part, for actions.
Copy it and try it again Frank. :thumbup:

Copied the actions script. Reloaded actions.

Now when I right click on it, nothing happends -> not even "you cannot use this" etc.

It's like im clicking on nothing :)

Script. 100% copied so you don't think im screwing it up:)
Code:
local config = {
    rate = 4.0, -- 2x More Experience
    time = 300, -- Minutes of Exp Time
    storage = 20011
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local tid = itemEx.uid or cid
    if(isPlayer(tid) == false) then
        return false
    end
    if(getPlayerStorageValue(tid, config.storage) == 1) then
        doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
        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 * 60000, 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
 
Copied the actions script. Reloaded actions.

Now when I right click on it, nothing happends -> not even "you cannot use this" etc.

It's like im clicking on nothing :)

Script. 100% copied so you don't think im screwing it up:)
Code:
local config = {
    rate = 4.0, -- 2x More Experience
    time = 300, -- Minutes of Exp Time
    storage = 20011
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local tid = itemEx.uid or cid
    if(isPlayer(tid) == false) then
        return false
    end
    if(getPlayerStorageValue(tid, config.storage) == 1) then
        doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
        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 * 60000, 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

maybe someone can convert this script to TFS 0.4 please?
 
maybe someone can convert this script to TFS 0.4 please?
Should work in 0.4 have you tried to load it up on your server? Were there any errors and if so please post them here. @Xeraphus there is nothing wrong with bumping an old thread as long as the question is related to the topic.
 
Back
Top