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

!bless bug soetimes

GuHB

Member
Joined
Dec 14, 2009
Messages
630
Reaction score
9
Location
Brazil
Hi,

I'm using !bless on my ots and sometimes works, and sometimes he bug and if player die he go back to level 1.

Check it please,

LUA:
-- !blessing by artofwork
local bless = {1, 2, 3, 4, 5}
local cost = 50000
local maxlevel = 50000

function onSay(cid, words, param)
local lvl = getPlayerLevel(cid)
local new_cost = (lvl * cost) / 500
local target = getPlayerGUID(cid)


        for i = 1, table.maxn(bless) do
                if(getPlayerBlessing(cid, bless[i])) then
                        doPlayerSendCancel(cid, "You have already have been blessed.")
                        return TRUE
                end
        end
        
        if (getPlayerLevel(cid) >= maxlevel)  then
                if(doPlayerRemoveMoney(cid, new_cost) == TRUE) then
                        for i = 1, table.maxn(bless) do
                        doPlayerAddBlessing(cid, bless[i])
                        doPlayerSendTextMessage(cid,22,"You have been successfully blessed.!")
                end
                else
                doPlayerPopupFYI(cid, "You need "..new_cost.." to buy blessings.")
                end
        
        elseif(getPlayerLevel(cid) < maxlevel) then
                if(doPlayerRemoveMoney(cid, cost) == TRUE) then
                        for i = 1, table.maxn(bless) do
                        doPlayerAddBlessing(cid, bless[i])
                        end
                        doPlayerPopupFYI(cid, "You have successfully been blessed.")
                else
                        doPlayerPopupFYI(cid, "You need to have "..cost.."gp to buy blessings.")
                end
        end
        return FALSE
end

Where is the problem? :S
 
LUA:
-- [(  Script fixed by: Piltrafa )] --
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 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), 28)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'You have been blessed!')
else
doPlayerSendCancel(cid, "You need 50.000 gold coins to get blessings!")
end
end
return TRUE
end
 
short?
LUA:
function onSay(cid, words, param)

for i = 1, 5 do
if getPlayerBlessing(cid, i)then
doPlayerSendCancel(cid,'You have already got blessings!')
else
if doPlayerRemoveMoney(cid, 50000) == TRUE then
doPlayerAddBlessing(cid, i)
doSendMagicEffect(getPlayerPosition(cid), 28)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'You have been blessed!')
else
doPlayerSendCancel(cid, "You need 50.000 gold coins to get blessings!")
end
end
return TRUE
end
 
Go to phpmyadmin and execute sql:
SQL:
UPDATE players SET loss_experience = 100, loss_mana = 100, loss_skills = 100;

Remember that you will have to OT clossed before do this.
 
go to config.lua

PHP:
	-- Blessings
	blessingOnlyPremium = true
	blessingReductionBase = 30
	blessingReductionDecreament = 5
	eachBlessReduction = 10

then talkactions/script/bless

PHP:
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 5 crystal coin to get blessed!")
        end
    end    
    return 1
end

and

PHP:
	<talkaction words="!bless" event="script" value="bless.lua"/>

rep if i help
 
Back
Top