• 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 How i can fix this script?

RaikND

facebook.xenoria.org
Joined
May 12, 2010
Messages
942
Reaction score
10
Location
Spain
i use 3851 svn tfs 0.4
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
CreatureScripts
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:
You still didnt answer what i asked , i asked "is the exp not multiplied at all or it only not multiplied as you wish?"
 
Back
Top