• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Blessing infinite

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
i need one scripter, the player use one item and player win 5 blessings (Infinite)


rep + :wub:
 
then make the item give storage and make a creature event to check for storage and for blessing if has storage and no blessing then it add it
LUA:
local storage = 1212
function onThink(cid, interval)

if getPlayerStoragValue(cid,storage) > -1 then
 for i = 1,5 do
    if getPlayerBlessing(cid, i) then
      return true
    end
    doPlayerAddBlessing(cid, i)
 end
return true
end

think somthng like that
 
Last edited:
Code:
local config = 
{
        b = {1,5},
		storage = 1212
}

function onSay(cid, words, param, channel)
		if getPlayerStorageValue(cid,storage) > -1 then
			if getPlayerBlessing(cid, b) then
				doPlayerAddBlessing(cid, b)
			end
		end
	return true
end
if i helped you rep++ me :ninja:
 
Code:
local config = 
{
        b = {1,5},
		storage = 1212
}

function onSay(cid, words, param, channel)
		if getPlayerStorageValue(cid,storage) > -1 then
			if getPlayerBlessing(cid, b) then
				doPlayerAddBlessing(cid, b)
			end
		end
	return true
end
if i helped you rep++ me :ninja:


What is that ,
Code:
if getPlayerBlessing(cid, b) then
				doPlayerAddBlessing(cid, b)

so if he have blessing then it add blessing ?
 

facepalm.png
 
make it a globalevent which checks for players in .. seconds.

Code:
function onThink(interval, lastExecution, thinkInterval)
local s = 15712 -- STORAGE VALUE IF PLAYER HAS INFINITE BLESSING.
	for _,pid in ipairs(getPlayersOnline()) do
		if getPlayerStorageValue(pid,s) > 0 then
			for i = 1,5 do
				if getPlayerBlessing(pid,i) then
					return true
				else
					doPlayerAddBlessing(pid,i)
				end
			end
		else
			return false
		end
	end
	return true
end

this will add blessing to players who has a certain storage value.
 
make it a globalevent which checks for players in .. seconds.

Code:
function onThink(interval, lastExecution, thinkInterval)
local s = 15712 -- STORAGE VALUE IF PLAYER HAS INFINITE BLESSING.
	for _,pid in ipairs(getPlayersOnline()) do
		if getPlayerStorageValue(pid,s) > 0 then
			for i = 1,5 do
				if getPlayerBlessing(pid,i) then
					return true
				else
					doPlayerAddBlessing(pid,i)
				end
			end
		else
			return false
		end
	end
	return true
end

this will add blessing to players who has a certain storage value.

i need in action(I will put it for sale at shop :p)
 
Use that globalevent with the following action.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v,s = getThingPos(cid),15712 -- the number is storage value.
	if getPlayerStorageValue(cid,s) < 0 then
		setPlayerStorageValue(cid,s,1)
		doSendMagicEffect(v,12)
		doRemoveItem(item.uid)
		doPlayerSendTextMessage(cid,27,'You now have been granted infinite blessing.')
		for i = 1,5 do
			doPlayerAddBlessing(cid,i)
		end
	else
		doPlayerSendTextMessage(cid,27,'You already have infinite blessing!')
		doSendMagicEffect(v,2)
	end
	return true
end

The globalevent will add blessings if the player doesn't have blessings anymore. (so it makes it infinite).
 
Why not just do it onLogin? When you use the item it adds the blessings then gives you a storage value, and then you lose blessings when you die, so you must re login, so therefore, just make the check onLogin, if they have the storage value, give them the blessings...


Action for the Item:
LUA:
local storage = 5498
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, storage) < 0 then
		setPlayerStorageValue(cid, storage, 1)
                doPlayerSendTextMessage(cid, 16, 'You have now been blessed infinitely.')
		doSendMagicEffect(fromPosition, 12)
		doRemoveItem(item.uid)
		
                for b = 1,5 do
			doPlayerAddBlessing(cid, b)
		end

                return true
        end
	return doPlayerSendTextMessage(cid, 16, 'You have already been blessed infinitely.')	
end


Login event:
LUA:
local storage = 5498
function onLogin(cid)
        if getPlayerStorageValue(cid, storage) == 1 then
		for b = 1,5 do
			doPlayerAddBlessing(cid, b)
		end
        end
        return true
end

If the Login Event is not put into your Login.lua then just register whatever new thing you make and you are set.
 
Back
Top