• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Player Teleport Talkaction from old position to new position

Lava Titan

Developer
Joined
Jul 25, 2009
Messages
1,551
Solutions
1
Reaction score
88
Location
Portugal
add on talkactions xml:

PHP:
<talkaction words="Text here" script="scriptname.lua" />

now go on scripts and add:

LUA:
local function comparePos(pos1, pos2)
	return (pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z)
end

function onSay(cid, param)
local pid = getCreaturePosition(cid)
local oldPos = {x=xxxx,y=yyyy,z=z}
local newPos = {x=xxxx,y=yyyy,z=z}
	if comparePos(getPlayerPosition(cid),oldPos) then --{x=pid.x,y=pid.y,z=pid.z}
		doSendMagicEffect(oldPos, 2)
		doTeleportThing(cid,newPos)
		doSendMagicEffect(newPos, 10)
	else
		doPlayerSendCancel(cid,"You are not in the right position.")
	end
end

Works with tfs 0.3.2+
Report bugs!
Rep++ if i helped you!:p
 
add on talkactions xml:

PHP:
<talkaction words="Text here" script="scriptname.lua" />

now go on scripts and add:

LUA:
local function comparePos(pos1, pos2)
	return (pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z)
end

function onSay(cid, param)
local pid = getCreaturePosition(cid)
local oldPos = {x=xxxx,y=yyyy,z=z}
local newPos = {x=xxxx,y=yyyy,z=z}
	if comparePos(getPlayerPosition(cid),oldPos) then --{x=pid.x,y=pid.y,z=pid.z}
		doSendMagicEffect(oldPos, 2)
		doTeleportThing(cid,newPos)
		doSendMagicEffect(newPos, 10)
	else
		doPlayerSendCancel(cid,"You are not in the right position.")
	end
end

Works with tfs 0.3.2+
Report bugs!
Rep++ if i helped you!:p

I such a short script:
- unnecessary variables
- dump used variables in lua functions like "doSendMagicEffect(oldPos, 2)"
 
Back
Top