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

Add Max Level

xLosT

Member
Joined
Jan 11, 2010
Messages
1,021
Reaction score
13
Location
Brasil, Rio Grande do Sul
i need add max level to use in the scripts

PHP:
local exp = 2000000 -- Quanto de experience o player irá ganhar?!
local exhaust = 259200 -- Tempo para o player poder usar o item novamente! (tempo em segundos)
local text = "Congratulations, you gained "..exp.." points of experience."
local storage = 9811 -- Não mexa aqui.

function onUse(cid, item, fromPosition, itemEx, toPosition)
if (getPlayerStorageValue(cid, storage) <= os.time()) then
            doPlayerAddExp(cid, exp)
            doCreatureSay(cid, text, 19)
            doSendMagicEffect(getCreaturePosition(cid), 14)
            doRemoveItem(cid, item.uid, 1)
            setPlayerStorageValue(cid, storage, os.time()+exhaust)
        else
            doPlayerSendCancel(cid, "Sorry, you only can again use this item after 3 days.")
        end
    return TRUE
end
 
LUA:
local exp = 2000000 -- Quanto de experience o player irá ganhar?! 
local exhaust = 259200 -- Tempo para o player poder usar o item novamente! (tempo em segundos) 
local text = "Congratulations, you gained "..exp.." points of experience." 
local storage = 9811 -- Não mexa aqui.
local maxLevel = 100 -- Max level required

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayeLevel(cid) <= maxLevel then
		if (getPlayerStorageValue(cid, storage) <= os.time()) then 
			doPlayerAddExp(cid, exp) 
			doCreatureSay(cid, text, 19) 
			doSendMagicEffect(getCreaturePosition(cid), 14) 
			doRemoveItem(cid, item.uid, 1) 
			setPlayerStorageValue(cid, storage, os.time()+exhaust) 
		else 
			doPlayerSendCancel(cid, "Sorry, you only can again use this item after 3 days.") 
		end
	else
		doPlayerSendCancel(cid, "Your level is too high.")
	end
    return TRUE 
end
 
Back
Top