• 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] doTeleportThing(cid, pos) Help please.

Leyenda

New Member
Joined
Jul 13, 2012
Messages
28
Reaction score
1
Hey there, im making a system for my otserver where when i say a talkaction like (!teleport Rob), i get teleported to a random of some specific positions, and "Rob" gets teleported to another position acording to the position i got teleported, this is what i cant get to work. Here is my code so far:

PHP:
function onSay(cid, words, param, channel)
local config = {
		pos = {
			{x = 533, y = 511, z = 6},
			{x = 529, y = 515, z = 6},
			{x = 537, y = 508, z = 6},
			{x = 537, y = 515, z = 6},
			{x = 529, y = 508, z = 6}
	    }
}
if 
	doTeleportThing(cid, config.pos[math.random(#config.pos)])
		end	

local ppos = getPlayerPosition(cid)
		local parameter = string.explode(param, ",")
			if(parameter[1] ~= nil) then
				local pname = getPlayerByNameWildcard(parameter[1])
					if(parameter[1] ~= nil) then
						doTeleportThing(pname, ppos)
			end
					end
					
end

I need that if i get teleported to any of those positions, like {x = 533, y = 511, z = 6}, then "Rob" gets teleported to {x = 533, y = 511, z = 7}, if i get teleported to {x = 529, y = 515, z = 6}, then Rob gets teleported to another location, acording to the one i get teleported. Any help please? im new at this^_^
 
where are declared those related position for "rob"?
Lua:
local config = {
	pos = {
		--pos1 player position teleport, pos2 "rob" position teleport
		{ pos1 = {x = 533, y = 511, z = 6}, pos2 = {x = 533, y = 511, z = 6} },
		{ pos1 = {x = 529, y = 515, z = 6}, pos2 = {x = 529, y = 515, z = 8} },
		{x = 537, y = 508, z = 6}, --do rest on ur own
		{x = 537, y = 515, z = 6},
		{x = 529, y = 508, z = 6}
	}
}

function onSay(cid, words, param, channel)]
	local rand = config.pos[math.random(#config.pos)]
	doTeleportThing(cid, rand.pos1)
	local parameter = string.explode(param, ",")
	if(parameter[1] ~= nil) then
		local _cid = getPlayerByNameWildcard(parameter[1])
		doTeleportThing(_cid, rand.pos2)
	end           
end
I dont know if I understood u right, however try this.
 
Last edited:
Back
Top