Jump to content

Mc não passa em tile

Rate this topic


Recommended Posts

Como ele falou lá em cima mc e quando tem 2 player no mesmo ip

e quero que o tile não deixe passa o mesmo ip pq isso vai ser pra um evento

 

We Do OTS, version 0.1.0 (Beta Version)


function onStepIn(cid, item, position, fromPosition)

if not isPlayer(cid) then

return false

end

local p, mc = getPlayersOnline(), 0

for _, pid in pairs(p) do

if getPlayerIp(cid) == getPlayerIp(pid) and pid ~= cid then

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

break

end

end

return true

end

 

Edited by Flavio S

Sim onde coloco isso ,Faltou você falar os procedimentos '-'

Em data/movements/movements.xml adicione a seguinte tag:

<movevent type="StepIn" actionid="action id desejada" event="script" value="nomedoarquivo.lua"/>
E em data/movements/scripts crie o arquivo que você colocou aciona com o conteúdo que o Flávio passou.

Ai eu boto itemid ou actionid?

 

<movevent type="StepIn" itemid="11059" event="script" value="tiles.lua"/>

<movevent type="StepOut" itemid="11060" event="script" value="tiles.lua"/>

Não presta tipo leva direto pro templo, Eu quero que 1 mc passe mais o 2 já não passe

function onStepIn(cid, item, position, fromPosition)
	if not isPlayer(cid) then
		return false
	end
	local p, mc = getPlayersOnline(), 0
	for _, pid in pairs(p) do
		if getPlayerIp(cid) == getPlayerIp(pid) and pid ~= cid then
                        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
			break
		end
	end
	return true
end


local ips = {}

function onStepIn(cid)

if not isPlayer(cid) then

return true

elseif isInArray(ips, getPlayerIp(cid)) then

return doPlayerSendCancel(cid, "There's already someone with your IP in the event.") and doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

end

table.insert(ips, getPlayerIp(cid))

return true

end

 

Edited by zipter98

Não presta tipo leva direto pro templo, Eu quero que 1 mc passe mais o 2 já não passe

Tenta assim:

function table.insert(table, element)
    table[#table + 1] = element
end
local ips = {}
function onStepIn(cid, item, position, fromPosition)
	if not isPlayer(cid) then
		return false
	end
	local ip = getPlayerIp(pid)
	if table.find(ips, ip) then
		doTeleportThing(cid, fromPosition)
		return false
	else
		table.insert(ips, ip)
		return true
	end
end
Edited by Bruno Minervino
Guest
This topic is now closed to further replies.
×
×
  • Create New...