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

Solved talkactions - getPlayerPosition, getting boolean value error

Dridia

New Member
Joined
Jan 17, 2012
Messages
49
Reaction score
1
Location
Sweden
I've created a script, when i type the word "tp" in a specific position i want to get teleported. but i get an error

My talkactions.xml:
XML:
<talkaction words="tp" script="custom/looktype-tp.lua"/>

My .lua script:
Lua:
local pos = getPlayerPosition(cid)
local newPos = {x=1000, y=1000, z=7}

function onSay(cid, words, param)
	if pos.x == 1000 and pos.y == 1000 and pos.z == 7 then
		doTeleportThing(cid, newPos)
		doSendMagicEffect(getPlayerPosition(cid), 12)
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have to stand on the glowing switch!")
		doSendMagicEffect(getPlayerPosition(cid), 2)
	end
end


The error i recieve:
Code:
[04/11/2012 13:38:59] Lua Script Error: [TalkAction Interface] 
[04/11/2012 13:38:59] data/talkactions/scripts/custom/looktype-tp.lua:onSay
[04/11/2012 13:38:59] data/talkactions/scripts/custom/looktype-tp.lua:5: attempt to index upvalue 'pos' (a boolean value)
[04/11/2012 13:39:00] stack traceback:
[04/11/2012 13:39:00] 	[C]: in function '__index'
[04/11/2012 13:39:00] 	data/talkactions/scripts/custom/looktype-tp.lua:5: in function <data/talkactions/scripts/custom/looktype-tp.lua:4>


I don't understand why my variable is declared to a boolean variable... please help me!
 
Bogart... You're an angel!! I can't believe the problem were so easy to solve...
Rep++ for you!!

Can you explain why that made such a differense?
 
Back
Top