• 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 Blessing Problem

Hrsha

Member
Joined
May 30, 2010
Messages
450
Reaction score
21
Location
Egypt
Hi otlanders

when players buy blessing and they logout
they have to buy blessing again the bless ends by logout

Lua:
function onSay(cid, words, param)
    if getPlayerBlessing(cid, 1) or getPlayerBlessing(cid, 2) or getPlayerBlessing(cid, 3) or getPlayerBlessing(cid, 4) or getPlayerBlessing(cid, 5) then
        doPlayerSendCancel(cid,'You have already got one or more blessings!')
    else
        if doPlayerRemoveMoney(cid, 50000) == TRUE then
            doPlayerAddBlessing(cid, 1)
            doPlayerAddBlessing(cid, 2)
            doPlayerAddBlessing(cid, 3)
            doPlayerAddBlessing(cid, 4)
            doPlayerAddBlessing(cid, 5)
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
        else
            doPlayerSendCancel(cid, "You need 50k to get blessed!")
        end
    end    
    return 1
end

Thanks for reading , rep+
 
try this script
Lua:
-- Created using QtLuaPad on Tue Dec 6 2011
-- Written by: RuggedMage.

function onSay(cid, words, param) 
local fail = 0 

    if getPlayerLevel(cid) < 31 then 
        cost = 2000 
    else 
        cost = ((getPlayerLevel(cid) - 30) * 200) + 2000 
    end 
     
    if cost > 10000 then 
        cost = 10000 
    end 

    for i = 1, 5 do 
        if getPlayerBlessing(cid, i) then 
            fail = fail + 1 
        else 
            if doPlayerRemoveMoney(cid, cost) == TRUE then 
                doPlayerAddBlessing(cid, i) 
                if i == 5 and not(fail == 5) then 
                    doSendMagicEffect(getPlayerPosition(cid),14) 
                                  doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"You have purchased all of the blessings.") 
                end 
            else 
                doPlayerSendCancel(cid, "You dont have enough money for all of the blessings!") 
                break 
            end 
        end 
    end 
    if fail == 5 then 
        doPlayerSendCancel(cid, "You already have all the blessings!") 
    end 
return TRUE 
end
or this one

Lua:
-- Created using QtLuaPad on Sun Jan 8 2012
-- Written by: RuggedMage.
 
function onSay(cid, words, param)
    if (getPlayerStorageValue(cid, 50001) == TRUE) or (getPlayerStorageValue(cid, 50002) == TRUE) or (getPlayerStorageValue(cid, 50003) == TRUE) or (getPlayerStorageValue(cid, 50004) == TRUE) or (getPlayerStorageValue(cid, 50000) == TRUE) then
        doPlayerSendCancel(cid,'You have already got one or more blessings!')
    else
        if doPlayerRemoveMoney(cid, 50000) == TRUE then
		    doPlayerAddBless(cid, 0)
            doPlayerAddBless(cid, 1)
            doPlayerAddBless(cid, 2)
            doPlayerAddBless(cid, 3)
            doPlayerAddBless(cid, 4)
            doPlayerAddBless(cid, 5)
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
        else
            doPlayerSendCancel(cid, "You need 50k to get blessed!")
        end
    end    
    return 1
end
 
Back
Top