• 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 to add blessings by using a level?

Dored

TibiaServer Distributor
Joined
Oct 11, 2009
Messages
58
Reaction score
0
Sup!

I just want to know how to add all blessings to a player that uses a lever? 1946/1945, which requires premium time?.

I'd appreciate this!, i'm still learning LUA so...Any help will by appreciated! :peace:

Rep++
 
Last edited:
blesslever.lua
Code:
function onUse(cid, item, frompos, item2, topos)
	if(getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF, cid)
		return true
	end
local fail = 0

	if item.uid == 11111 and getPlayerPremiumDays(cid) >= 1 then

	for i = 1, 5 do
		if getPlayerBlessing(cid, i) then
			fail = fail + 1
		else
				doPlayerAddBlessing(cid, i)
				if i == 5 and not(fail == 5) then
					doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
				end
	end
	if fail == 5 then
		doPlayerSendCancel(cid, "You already have all the blessings!") 
end
end
end
	return 1
end

actions.xml
Code:
	<action uniqueid="xxxx" event="script" value="blesslever.lua"/>
 
blesslever.lua
Code:
function onUse(cid, item, frompos, item2, topos)
    if(getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF, cid)
        return true
    end
local fail = 0

    if item.uid == 11111 and getPlayerPremiumDays(cid) >= 1 then

    for i = 1, 5 do
        if getPlayerBlessing(cid, i) then
            fail = fail + 1
        else
                doPlayerAddBlessing(cid, i)
                if i == 5 and not(fail == 5) then
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
                end
    end
    if fail == 5 then
        doPlayerSendCancel(cid, "You already have all the blessings!") 
end
end
end
    return 1
end
actions.xml
Code:
    <action uniqueid="xxxx" event="script" value="blesslever.lua"/>
Thank you so much!

Rep++!
 
Back
Top