• 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!

Lua Item add bonus exp rate from players

rafaeru

Active Member
Joined
Mar 6, 2013
Messages
139
Solutions
10
Reaction score
30
Location
Poland
GitHub
rafaeru97
Hello, i need script which give 2x exp rate from killing players.


I test on: (dont work)
doPlayerSetRate(cid, SKILL__LEVEL, 2.0)
 
First of all, what distro do you use? so that people here can help you!
upload the scrip and maybe any of the friendly scripters here on otland will get you in the right direction.
 
i used tfs 0.3.6

Code:
local config = {
    rate = 2.0, -- 2x More Experience
    time = 180, -- 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, 0.25) --config.lua rate
    setPlayerStorageValue(tid, config.storage, -1)
    doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end
 
Back
Top