NI
pedido

Script Gate Of Experience

Por nickissonlobo, 10 de out. de 2015 em Scripts

porta
4
1.7k
nickissonloboN
10 de outubro de 2015 às 15:59

 

function onUse(cid, item, frompos, item2, topos)

local lvl = 200
if getPlayerLevel(cid) <= lvl then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
return true
end
if getPlayerPosition(cid).x > getThingPos(item.uid).x then
doTeleportThing(cid, {x=getThingPos(item.uid).x - 1, y=getThingPos(item.uid).y, z=getThingPos(item.uid).z})
elseif getPlayerPosition(cid).x < getThingPos(item.uid).x then
doTeleportThing(cid, {x=getThingPos(item.uid).x + 1, y=getThingPos(item.uid).y, z=getThingPos(item.uid).z})
elseif getPlayerPosition(cid).y < getThingPos(item.uid).y then
doTeleportThing(cid, {x=getThingPos(item.uid).x, y=getThingPos(item.uid).y + 1, z=getThingPos(item.uid).z})
elseif getPlayerPosition(cid).y > getThingPos(item.uid).y then
doTeleportThing(cid, {x=getThingPos(item.uid).x, y=getThingPos(item.uid).y - 1, z=getThingPos(item.uid).z})
end
return TRUE
end

 

esse script só funciona se vc tiver na frente da porta se vc tiver de kina com ela ele buga teleporta pra parede, quero um que funcione certinho teleporte pra o outro lado da porta rep + pra quem ajudar ai :D

ShiroNGS
11 de outubro de 2015 às 11:48


function onUse(cid, item, fromPosition, item2, toPosition)

 

 

local pos = {x=939, y=926, z=15} -- Posição para onde vai ser teleportado

 

if getPlayerLevel(cid) >= 100 then -- Level para passar

doTeleportThing(cid, pos)

doPlayerSendTextMessage(cid, 22, "Bem vindo") -- Mensagem se ele puder passar

 

else

doPlayerSendTextMessage(cid, 22, "Somente players level 100 ou Superior podem passar!") -- Mensagem se ele não puder passar

 

end

return TRUE

end


<action actionid="1234" event="script" value="Door.lua"/>

 

Night WolfN
11 de outubro de 2015 às 18:59

Galera, o importante num script desse estilo de teleportar ao clicar na porta tem que ser o mais abrangente possível pra agrupar todas as portas do servidor em qualquer id, desde que elas estejam na mesma posição. Não usem posições do player pra calcular o sqm q deve ser teleportado, usem os parametros do callback, um deles é a própria posição do item que vc clicou.

Testa assim:

function onUse(cid, item, frompos, item2, topos)
 
local lvl = 200
 
if getPlayerLevel(cid) <= lvl then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
return true
end
 
if frompos.x > topos.x then
doTeleportThing(cid, {x=topos.x - 1, y=topos.y, z=topos.z})
elseif frompos.x < topos.x then
doTeleportThing(cid, {x=topos.x + 1, y=topos.y, z=topos.z})
elseif frompos.y < topos.y then
doTeleportThing(cid, {x=topos.x, y=topos.y + 1, z=topos.z})
elseif frompos.y > topos.y then
doTeleportThing(cid, {x=topos.x, y=topos.y - 1, z=topos.z})
end
return true
end
nickissonloboN
12 de outubro de 2015 às 02:28

exatamente isso Night Wolf, mas não funcionou