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

Windows Bless problem

Hanoger

Member
Joined
Mar 7, 2011
Messages
247
Reaction score
6
Hello, got problem with blessings -
PHP:
[17/04/2012 15:40:40] Lua Script Error: [TalkAction Interface] 
[17/04/2012 15:40:40] data/talkactions/scripts/bless.lua:onSay
[17/04/2012 15:40:40] luaDoPlayerAddBlessing(). Player not found
Script:
Lua:
function onSay(cid, words, param)
 
		if		doPlayerRemoveMoney(cid, 50000) then
			doPlayerAddBlessing(cid, 1, 2, 3, 4, 5)
elseif
				getPlayerBlessing(cid) >= 1 then
					doSendPlayerCancel(cid, "You have already been blessed!")
				doSendMagicEffect(getCreaturePosition(cid), 2)
else
			doPlayerSendCancel(cid, "You don't have enough money")
				doSendMagicEffect(getCreaturePosition(cid), 2)
		end
return TRUE
end
 

Lua:
local bless = {1, 2, 3, 4, 5}
local cost = 50000 -- Cost in gp.

function onSay(cid, words, param)
    for i = 1, table.maxn(bless) do
        if(getPlayerBlessing(cid, bless[i])) then
            doPlayerSendCancel(cid, "You already have all blessings.")
            return TRUE
        end
    end

    if(doPlayerRemoveMoney(cid, cost) == TRUE) then
        for i = 1, table.maxn(bless) do
            doPlayerAddBlessing(cid, bless[i])
        end
        doPlayerSendTextMessage(cid,24, "You have bought all blessings.")
        doSendMagicEffect(getPlayerPosition(cid), 28)
    else
        doPlayerSendCancel(cid, "You don't have enough money.")
    end
    return TRUE
end
 
loss_xxxx blablabla in database should be set to 100 that means 100% :p

and did you edit the part of blessing in config.lua?
 
talkactions.xml

XML:
<talkaction words="!bless" script="bless.lua"/>

create file in talkactions/scripts/bless.lua

Lua:
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 > 20000 then
		cost = 20000
	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), CONST_ME_HOLYDAMAGE)
				end
			else
				doPlayerSendCancel(cid, "You need ".. cost .." to buy all the blessings!")
				break
			end
		end
	end
	if fail == 5 then
		doPlayerSendCancel(cid, "You already have all the blessings!")
	end
return TRUE
end
 
Back
Top