• 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 Experience scroll Lua

niti

New Member
Joined
Nov 22, 2009
Messages
258
Reaction score
2
Hi all I need your help,

I'm using tfs 3.0.6 client 8.6!

When you right click on the EXPERIENCE SCROLL it will add double exp for 48 hours but if you die with it it will be cancelled and You won't be able to use it anymore


PHP:
 local config = {
		rate = 2.0, -- 4x More Experience
		time = 48, -- Hours of Exp Time
		storage = 20011
	}
 
	local function endExpRate(cid)
		doPlayerSetRate(cid, SKILL__LEVEL, 6.0) --config.lua rate
		setPlayerStorageValue(cid, config.storage, -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
	end
 
	function onUse(cid, item, fromPosition, itemEx, toPosition)
		if(getPlayerStorageValue(cid, config.storage) == -1) 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 * 1000)
			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
I'll give rep+
 
Really i no understand what do you want :D , if that which you want , so tell me
this script when you die the exp double ends.
tell me if it the script or no
Here We Are :)
in your creaturescripts open scripts then create file name: Endexp and paste the following:
LUA:
	function onDeath(cid, corpse, deathList)
	if(getPlayerStorageValue(cid, config.storage) == -1) then
	doPlayerSetStorageValue(uid, 20011, 1)
	end
	return true
	end

now in your creaturescripts/creaturescripts.xml paste the following :
XML:
	<event type="death" name="Endexp" event="script" value="Endexp.lua"/>
now in your creaturescripts/scripts/login.lua after this line:

LUA:
	registerCreatureEvent(cid, "GuildMotd")

paste

LUA:
	registerCreatureEvent(cid, "Endexp")
 
Really i no understand what do you want :D , if that which you want , so tell me
this script when you die the exp double ends.
tell me if it the script or no
Here We Are :)
in your creaturescripts open scripts then create file name: Endexp and paste the following:
LUA:
	function onDeath(cid, corpse, deathList)
	if(getPlayerStorageValue(cid, config.storage) == -1) then
	doPlayerSetStorageValue(uid, 20011, 1)
	end
	return true
	end

now in your creaturescripts/creaturescripts.xml paste the following :
XML:
	<event type="death" name="Endexp" event="script" value="Endexp.lua"/>
now in your creaturescripts/scripts/login.lua after this line:

LUA:
	registerCreatureEvent(cid, "GuildMotd")

paste

LUA:
	registerCreatureEvent(cid, "Endexp")
Yes but I mean I need a EXP SCROLL that works 100% fine!

Does this script connects to 5952 ?
 
Can you please explain what do you want?


Yes I can, look here. I want a EXPEREINCE SCROLL SCRIPT that works fine. I got a script that is in ACTION/SCRIPT
I want it to work fine! Just one right click on it and you'll gain double exp for 48 hours. And if you die the DOUBLE EXP are not going to be canceled only when the time is out.
So I'm wondering does someone here got a script that works? tfs 0.3.6
 
i think thats what you want , its not my script but i edited some , try this because i didnt test
Here We Are :)
in your mods/scripts create file name expstagescroll.lua and paste the following code:
LUA:
local config = {
rate = 2,
storage = 1000,
expstorage = 1100,
register = 1200,
time = 14400,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, config.storage) <= 0 then
local rates = getPlayerRates(cid)
setPlayerStorageValue(cid, config.expstorage, rates[SKILL__LEVEL])
setPlayerStorageValue(cid, config.register, 1)
itemEx=itemid == 9004
doCreatureSay(cid, "heir extra experience is active! Now Exp is " .. config.rate .. "x.", TALKTYPE_ORANGE_1, true, cid)
setPlayerStorageValue(cid, config.storage, os.time()+config.time)
doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]+config.rate)
doRemoveItem(item.uid,1)
registerCreatureEvent(cid, "ExpStage")
else
doCreatureSay(cid, "You already have Experience Scroll, wait expires so you can use another.", TALKTYPE_ORANGE_1, true, cid)
end
return true
end
function onThink(cid, interval)
if getPlayerStorageValue(cid, config.register) == 1 then
if getPlayerStorageValue(cid, config.storage) <= os.time() then
doCreatureSay(cid, "The Double Experience bonus has expired.", TALKTYPE_ORANGE_1, true, cid)
setPlayerStorageValue(cid, config.storage, 0)
setPlayerStorageValue(cid, config.register, 0)
local oldexp = getPlayerStorageValue(cid, config.expstorage)
doPlayerSetExperienceRate(cid, oldexp)
unregisterCreatureEvent(cid, "ExpStage")
end
end
return true
end
function onLogin(cid)
if getPlayerStorageValue(cid, config.register) == 1 then
registerCreatureEvent(cid, "ExpStage")
local rates = getPlayerRates(cid)
doCreatureSay(cid, "You Have experience bonus active, and this multiplied by " .. config.rate .. "x.", TALKTYPE_ORANGE_1, true, cid)
if getPlayerStorageValue(cid, config.storage) > os.time() then
local oldexp = getPlayerStorageValue(cid, config.expstorage)
doPlayerSetExperienceRate(cid, oldexp+config.rate)
end
end   
return true
end

function onDeath(cid, corpse, deathList)
if(getPlayerStorageValue(cid, config.storage) == 1) then
doPlayerSetStorageValue(uid, config.storage, -1)
unregisterCreatureEvent(cid, "Expdeath")
end
return true
end

now in your mods folder create file name Expscroll.xml and paste the following:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Experience Stages Scroll" version="1.0" enabled="yes">
<action itemid="9004" event="script" value="expstagescroll.lua"/>
<creatureevent type="think" name="ExpStage" event="script" value="expscroll.lua"/>
<creatureevent type="login" name="ExpStageLogin" event="script" value="expscroll.lua"/>
<creatureevent type="death" name="Expdeath" event="script" value="expscroll.lua"/>
</mod>

- - - Updated - - -

Worked?
 
Back
Top