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

Talkaction - All blessings

Status
Not open for further replies.

Ninkobi

Owner /Founder of Syphera
Joined
Apr 5, 2008
Messages
206
Reaction score
1
Location
England
I am trying to make a script to allow you to buy all the blessings at once but for 60k. If you have no cash it gives you a error (doPlayerSendCancel) saying 'You need 6 crystal coin to get blessed!' but if you have already got 1 of the blessings it says 'You have already got one or more blessings!'.

My script:
Code:
function onSay(cid, words, param)

if doPlayerRemoveItem(cid,2160,6) == 1 then
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
doSendMagicEffect(topos,39)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
        else
            doPlayerSendCancel(cid, "You need 6 crystal coin to get blessed!")
        end
    else
        doPlayerSendCancel(cid,'You have already got one or more blessings!')
    end    
return 1
end

Thanks in advance :thumbup:
 
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
		if doPlayerRemoveItem(cid,2160,6) == 1 then
			doPlayerAddBlessing(cid, 1)
			doPlayerAddBlessing(cid, 2)
			doPlayerAddBlessing(cid, 3)
			doPlayerAddBlessing(cid, 4)
			doPlayerAddBlessing(cid, 5)
			doSendMagicEffect(topos,39)
			doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
		else
			doPlayerSendCancel(cid, "You need 6 crystal coin to get blessed!")
		end
    else
        doPlayerSendCancel(cid,'You have already got one or more blessings!')
    end    
	return 1
end
 
@up maybe I am wrong but I think it gives the blessing if you already have it?

edit also I think you need to use it like this:

getPlayerBlessing(cid, 5) == FALSE

not sure :S
 
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
		if doPlayerRemoveItem(cid,2160,6) == 1 then
			doPlayerAddBlessing(cid, 1)
			doPlayerAddBlessing(cid, 2)
			doPlayerAddBlessing(cid, 3)
			doPlayerAddBlessing(cid, 4)
			doPlayerAddBlessing(cid, 5)
			doSendMagicEffect(topos,39)
			doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
		else
			doPlayerSendCancel(cid, "You need 6 crystal coin to get blessed!")
		end
    else
        doPlayerSendCancel(cid,'You have already got one or more blessings!')
    end    
	return 1
end

I get this error when using it:

Code:
[29/08/2008  16:38:48] Lua Script Error: [TalkAction Interface] 
[29/08/2008  16:38:48] data/talkactions/scripts/allbless.lua:onSay

[29/08/2008  16:38:49] attempt to index a nil value
 
@up maybe I am wrong but I think it gives the blessing if you already have it?

edit also I think you need to use it like this:

getPlayerBlessing(cid, 5) == FALSE

not sure :S

Ops, I ment to have it other way around

Try this


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 doPlayerRemoveItem(cid,2160,6) == 1 then
			doPlayerAddBlessing(cid, 1)
			doPlayerAddBlessing(cid, 2)
			doPlayerAddBlessing(cid, 3)
			doPlayerAddBlessing(cid, 4)
			doPlayerAddBlessing(cid, 5)
			-- To lazy to fix getPos of Cid and then use magic on it. If someone wanna add, feel free.
			--doSendMagicEffect(topos,39)
			doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
		else
			doPlayerSendCancel(cid, "You need 6 crystal coin to get blessed!")
		end
    end    
	return 1
end
 
Ops, I ment to have it other way around

Try this


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 doPlayerRemoveItem(cid,2160,6) == 1 then
			doPlayerAddBlessing(cid, 1)
			doPlayerAddBlessing(cid, 2)
			doPlayerAddBlessing(cid, 3)
			doPlayerAddBlessing(cid, 4)
			doPlayerAddBlessing(cid, 5)
			-- To lazy to fix getPos of Cid and then use magic on it. If someone wanna add, feel free.
			--doSendMagicEffect(topos,39)
			doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
		else
			doPlayerSendCancel(cid, "You need 6 crystal coin to get blessed!")
		end
    end    
	return 1
end
Would't this work?
PHP:
local pos = getPlayerPosition(cid)

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 doPlayerRemoveItem(cid,2160,6) == 1 then
			doPlayerAddBlessing(cid, 1)
			doPlayerAddBlessing(cid, 2)
			doPlayerAddBlessing(cid, 3)
			doPlayerAddBlessing(cid, 4)
			doPlayerAddBlessing(cid, 5)
			doSendMagicEffect(pos,39)
			doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
		else
			doPlayerSendCancel(cid, "You need 6 crystal coin to get blessed!")
		end
    end    
	return 1
end
I jus added
Code:
local = getPlayerPosition(cid)
 
Status
Not open for further replies.
Back
Top