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

Need help with this bless command!

Beef Jerky

New Member
Joined
Sep 19, 2008
Messages
68
Reaction score
0
function onSay(cid, words, param)

if getPlayerBlessing(cid,5) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already been blessed")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MORTAREA)
else
if doPlayerRemoveMoney(cid, 50000) == TRUE then
for i = 1,5 do
doPlayerAddBlessing(cid,i)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received blessings!")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 50,000 gp in backpack for blessings.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ICEAREA)
end
end
return TRUE
end





--------------------------------------------------------------


For some reason each time i enstate this or any other bless command i get, when i test it when i die, i do not loose skills, but my character becomes level 1. How do i fix this? Please help me Thanks..
 
Lua:
function onSay(cid, words, param)
    if getPlayerBlessing(cid) == 5 then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You\'re a dumbass, you already bought blessings.")
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MORTAREA)
    return TRUE
    end
    if doPlayerRemoveMoney(cid, 50000) == TRUE then
	for i = 1,5 do
	    doPlayerAddBlessing(cid, i)
	    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have pruchased all the blessings!")
	    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
	end
    else
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 50,000 gp in backpack for blessings.")
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
    return TRUE
end
 
If you use 0.3.5
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="!bless" version="1.0" author="Nahruto's Scripts to Mods transformer" contact="in my house" enabled="yes">
<talkaction words="!bless" event="buffer"><![CDATA[
    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, 60000) == 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 60k to get blessed!")
        end
    end    
    return 1
]]></talkaction>
</mod>
 
If you use 0.3.5
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="!bless" version="1.0" author="Nahruto's Scripts to Mods transformer" contact="in my house" enabled="yes">
<talkaction words="!bless" event="buffer"><![CDATA[
    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, 60000) == 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 60k to get blessed!")
        end
    end    
    return 1
]]></talkaction>
</mod>

Sorry for offtopicness but in this script, in this part:

Lua:
    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!')

Does it work the same if I did it like this:

Lua:
for i = 1,5 do
    if getPlayerBlessing(cid, i) then
        doPlayerSendCancel(cid,'You have already got one or more blessings!')

?

Im not trying to correct you or optimize, just figuring how the "for i" thing works on lua scripting since Im not quite sure.
 
Back
Top