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

Lua Checking player position ... Help !

Rudyg

New Member
Joined
Nov 8, 2009
Messages
30
Reaction score
0
Hi,
I want my script to check player position and give AAA message if player is on XYZ and BBB message if player isn't on XYZ.
It will be "function onUse".
I tried something like:
PHP:
begin of script...
local abc = {x=100, y=101, z=7}
if isPlayer(cid) then
if getCreaturePosition(cid) == abc then
...rest of script
but it doesn't work :/
I lost 3hours on that script and tried many options but never works good...
I hope someone will help me :{

TFS for 8.11
Sorry for my bad english :/
 
Try:
LUA:
local abc = {x=100, y=101, z=7}
local message =  AAA ---- EDIT
function onUse (cid, item, fromPosition, itemEx, toPosition)
ppos = getPlayerPosition
if ppos(cid,abc) then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,message)
------ rest of script
else
doPlayerSendCancel(cid, "You are not in the right position?") ---- EDIT
end
return true
end
 
LUA:
local t = {x=100, y=101, z=7}

function onUse (cid, item, fromPosition, itemEx, toPosition)
	local p = getThingPos(cid)
	if p.x == t.x and p.y == t.y and p.z == t.z then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'AAA')
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'BBB')
	end
	return TRUE
end
 
Yeay :*
Cykotitan's script works great :)
Huge thanks !
santigggg's script doesn't work good.
It always send message AAA - no matter where player is staying ... But nevermind ... Cykotitan's is good :)

Thanks again :)
 
Back
Top