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

Ninja Bodil

New Member
Joined
Mar 7, 2009
Messages
116
Reaction score
0
What's wrong with this script?

Code:
function onSay(cid, words, param)
 
	if(param == "Dear God") then
		if(getPlayerStorageValue(20101, 1) == false) then 
	             if(getPlayerPosition(cid) == {x = 1000, y = 993, z = 6}) then
			doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "An angel told you about a message from God. Talk to Father Damien about the message")
			doPlayerSetStorageValue(20101, 1)
			else
			doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Maybe the isn't the right place to pray?")
		     end
		else
		doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Angels only show up once")
	        end
		return true
	end
end
 
if(getPlayerStorageValue(20101, 1) == false) then

should be

if(getPlayerStorageValue(cid, 20101) ~= 1) then


and you cant do like this:
getPlayerPosition(cid) == {x = 1000, y = 993, z = 6}

you have to do comparePos(getPlayerPosition(cid), pOS_HERE)
it returns true/false

if udont have it then:
Lua:
function comparePos(pos1, pos2)
    return pos1.x==pos2.x and pos1.y==pos2.y and pos1.z==pos2.z
end


and isnt it setPlayerStorageValue, not doPlayerSetStorageValue ?? :)
 
Still don't work
Code:
function comparePos(pos1, pos2)
    return pos1.x==pos2.x and pos1.y==pos2.y and pos1.z==pos2.z
end

function onSay(cid, words, param)
 
	if(param == "Dear God") then
		if(getPlayerStorageValue(cid, 20101) ~= 1) then 
	         if comparePos(getPlayerPosition(cid), {x = 1000, y = 993, z = 6}) then
			doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "An angel told you about a message from God. Talk to Father Damien about the message")
			setPlayerStorageValue(20101, 1)
			else
			doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Maybe the isn't the right place to pray?")
		     end
		else
		doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Angels only show up once")
	        end
		return true
	end
end
Haven't been scripting in 6 months so are abit off atm :p
 
Post an error or something. And I'm wondering whether I get you or not. Is this script supposed to do an action if you say dear god? If so then.
Lua:
function onSay(cid, words, param)
	if(words == "dear god") then
		if(getPlayerStorageValue(cid, 20101) < 1) then
			if(getPlayerPosition(cid) == {x = 1000, y = 993, z = 6, stackpos = 253}) then
				doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "An angel told you about a message from God. Talk to Father Damien about the message")
				setPlayerStorageValue(cid, 20101, 1)
			else
				doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Maybe the isn't the right place to pray?")
			end
		else
			doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Angels only show up once")
		end
	end
	return true
end
XML:
<talkaction words="dear god" filter="word-spaced" hide="no" event="script" value="prayer.lua"/>


and isnt it setPlayerStorageValue, not doPlayerSetStorageValue ?? :)

It can be used in either way. And you can compare getPlayerPosition(cid) with a pos. No need of comparePos().
 
Last edited:
Error:
Code:
[11/09/2010 22:15:07] [Error - TalkAction Interface] 
[11/09/2010 22:15:07] data/talkactions/scripts/prayer.lua:onSay
[11/09/2010 22:15:07] Description: 
[11/09/2010 22:15:07] data/talkactions/scripts/prayer.lua:3: attempt to compare boolean with number
[11/09/2010 22:15:07] stack traceback:
[11/09/2010 22:15:07] 	data/talkactions/scripts/prayer.lua:3: in function <data/talkactions/scripts/prayer.lua:1>
 
Error:
Code:
[11/09/2010 22:15:07] [Error - TalkAction Interface] 
[11/09/2010 22:15:07] data/talkactions/scripts/prayer.lua:onSay
[11/09/2010 22:15:07] Description: 
[11/09/2010 22:15:07] data/talkactions/scripts/prayer.lua:3: attempt to compare boolean with number
[11/09/2010 22:15:07] stack traceback:
[11/09/2010 22:15:07] 	data/talkactions/scripts/prayer.lua:3: in function <data/talkactions/scripts/prayer.lua:1>

forgot this:

change this:
Lua:
		if(getPlayerStorageValue(20101) < 1) then
to this:
Lua:
		if(getPlayerStorageValue(cid, 20101) < 1) then
and this:
Lua:
				setPlayerStorageValue(cid, 20101)

to this:
Lua:
				setPlayerStorageValue(cid, 20101, 1)
 
Yeah I realised that also (I'm abit off as i said :p)
But nothing happens when I stand at the right position it you says "Maybe the isn't the right place to pray?".
 
Yeah I realised that also (I'm abit off as i said :p)
But nothing happens when I stand at the right position it you says "Maybe the isn't the right place to pray?".
Lua:
			if(getPlayerPosition(cid) == {x = 1000, y = 993, z = 6}) then

change to:
Lua:
			if(getPlayerPosition(cid) == {x = 1000, y = 993, z = 6, stackpos = 253}) then
 
dude, didnt you read the post of colandus?
You cant do this:
Lua:
if(getPlayerPosition(cid) == {x = 1000, y = 993, z = 6, stackpos = 253}) then

You need to use:
Lua:
comparePos(getPlayerPosition(cid), pos_here)

Here, use it:
Lua:
function comparePos(pos1, pos2)
    return pos1.x==pos2.x and pos1.y==pos2.y and pos1.z==pos2.z
end
function onSay(cid, words, param)
	if(words == "dear god") then
		if(getPlayerStorageValue(cid, 20101) < 1) then
			if(comparePos(getPlayerPosition(cid), {x = 1000, y = 993, z = 6})) then
				doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "An angel told you about a message from God. Talk to Father Damien about the message")
				setPlayerStorageValue(cid, 20101, 1)
			else
				doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Maybe the isn't the right place to pray?")
			end
		else
			doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Angels only show up once")
		end
	end
	return true
end
 
dude, didnt you read the post of colandus?
You cant do this:
Lua:
if(getPlayerPosition(cid) == {x = 1000, y = 993, z = 6, stackpos = 253}) then

You need to use:
Lua:
comparePos(getPlayerPosition(cid), pos_here)

I bet you don't even know what does the getPlayerPosition(cid) return. I'am only not sure what stackpos it returns.
 
Back
Top