• 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 Help Experience Scroll

handert

New Member
Joined
Nov 14, 2010
Messages
4
Reaction score
0
Good people, I have a little problem in the script Experience Scroll that is in the folder Mods.
(For Mods because this script is inside the folder Mods and doing joint with a XML file).


- My case is the following, I have this script below that it is a card that triples the experience of the player for 10 days, and I need that only people who have Premium Accounts able to use this card, if someone can help me would be very grateful.!


-Information Server:
Tibia 8.60
DLLS: (Inform not know for sure, but what use is that of the famous Baiak Otproject.)

*Mods/expscroll.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?><mod name="Gold Cad Experience" version="1.0" author="TomCrusher" contact="otland.net" enabled="yes">        <action itemid="9004" event="script" value="expstagescroll.lua"/>        <creatureevent type="think" name="ExpStage" event="script" value="expstagescroll.lua"/>        <creatureevent type="login" name="ExpStageLogin" event="script" value="expstagescroll.lua"/></mod>

*Mods/script/expstagescroll.lua
PHP:
local config = {         rate = 2,
        storage = 1000,
        expstorage = 1100,
        register = 1200,
        time = 864000,
} 
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, "Você ativou seu Gold Card Experience! Sua experience foi almentada em : 3x.", 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, "Você já ativou 1 card, espere ele terminar para usar outro!", 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, "Seu Gold Card Experience acabaou! Sua experience rate voltou ao normal.", 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, "Seu experience rate ainda está 3x mais alta que o normal.", 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

NOTE: This script is not of my own, he was caught in another forum Tibia Servers, which was not put to why I can not remember the author, remember the forum, but through doubt will not put because I think that does not match with the rules of this forum. :D
 
Look bro i don't know how to fix this but i can giv you new exp scroll script if you want..
Its tested on 0.4 and on 0.3.6

- - - Updated - - -

Lua:
function onUse(cid, item)
    doCreatureSay(cid, "Aaaach ! That was great ! i feal better...", TALKTYPE_ORANGE_1)
    doPlayerAddExp(cid, 5000000)
    doRemoveItem(item.uid, 1)
    return true
end

I know its easy.
 
First thanks for your attempt to help me, but the thing is, what i want is one script I've just above an item that is used when you triple your experience for 10 days, he has no problem the only thing I need add is that only people who have Premium Accounts use this item if the player does not have Premium Account it can not use the item, but thanks for trying.

If someone else can help me, I would be very grateful. :D
 
Last edited:
Use getPlayerPremiumDays(cid).
Example:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
	if getPlayerPremiumDays(cid) >= 1 then
        	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, "Você ativou seu Gold Card Experience! Sua experience foi almentada em : 3x.", 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, "Você já ativou 1 card, espere ele terminar para usar outro!", TALKTYPE_ORANGE_1, true, cid)
        	end 

	else
		doPlayerSendCancel(cid, "You need premium to use this.")
	end
	return true
end
 

Similar threads

Back
Top