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

bolero

MikeHere
Joined
Apr 13, 2009
Messages
1,146
Reaction score
12
Location
Venezuela
I have a serious problem, sometimes don't always, SOMETIMES my players when have blessings and dead lose equipment =/

Why?
 
Add this to creaturescripts.xml
Code:
<event type="preparedeath" name="onPrepareDeath" event="script" value="blessingdeath.lua"/>
and blessingdeath.lua
LUA:
function onPrepareDeath(cid)

    if getPlayerBlessing(cid, 1) or getPlayerBlessing(cid, 2) or getPlayerBlessing(cid, 3) or getPlayerBlessing(cid, 4) or getPlayerBlessing(cid, 5) then

                doCreatureSetDropLoot(cid, true)

                doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)

	doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)

else

doPlayerSendTextMessage(cid, 20, "You have blessings!")

end

end
:thumbup:
 
Add this to creaturescripts.xml
Code:
<event type="preparedeath" name="onPrepareDeath" event="script" value="blessingdeath.lua"/>
and blessingdeath.lua
LUA:
function onPrepareDeath(cid)

    if getPlayerBlessing(cid, 1) or getPlayerBlessing(cid, 2) or getPlayerBlessing(cid, 3) or getPlayerBlessing(cid, 4) or getPlayerBlessing(cid, 5) then

                doCreatureSetDropLoot(cid, true)

                doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)

	doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)

else

doPlayerSendTextMessage(cid, 20, "You have blessings!")

end

end
:thumbup:

No offense, but this is retarded. Do not add this.
 
Add this to creaturescripts.xml
Code:
<event type="preparedeath" name="onPrepareDeath" event="script" value="blessingdeath.lua"/>
and blessingdeath.lua
LUA:
function onPrepareDeath(cid)

    if getPlayerBlessing(cid, 1) or getPlayerBlessing(cid, 2) or getPlayerBlessing(cid, 3) or getPlayerBlessing(cid, 4) or getPlayerBlessing(cid, 5) then

                doCreatureSetDropLoot(cid, true)

                doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)

	doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)

else

doPlayerSendTextMessage(cid, 20, "You have blessings!")

end

end
:thumbup:

WTF? Why space after every line? like
LUA:
return doPlayerSendTextMessage(cid, 20, "You have blessings!")
end
not

LUA:
doPlayerSendTextMessage(cid, 20, "You have blessings!")

end


LUA:
  function onSay(cid, words, param, channel)
        if getPlayerBlessing(cid, 5) == FALSE then
                if getPlayerMoney(cid) >= 250000 then
                        for i = 1,5 do
                                doPlayerAddBlessing(cid, i)
                        end
                        doSendMagicEffect(getCreaturePosition(cid), 39)
                        doPlayerRemoveMoney(cid, 250000)
                        doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
                else
                        doPlayerSendCancel(cid, "You don't have enough money.")
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
                end
        else
                doPlayerSendCancel(cid, "You have already been blessed.")
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        end
return true
end

credit Djivar && Wibben.
 
Last edited:
Back
Top