DR
pedido

Comando Goto Que Nao Funcione Em Npc

Por dragonfight, 07 de jun. de 2012 em Scripts

script
4
1.2k
dragonfightD
07 de junho de 2012 às 16:25

Olá Pessoal, preciso de um comando goto que nao funcione em npc, que somente de pra dar goto em players.

 

Aguardo ajuda

 

Ja fiz o script, pode fechar

Editado Junho 7 por dragonfight

caoticC
07 de junho de 2012 às 22:01

faz uma verificaçao usando IsNpc(uid)

LordfireL
07 de junho de 2012 às 23:22

Fez? Então poste aqui pra que todos possam usar!

dragonfightD
08 de junho de 2012 às 09:34

Então pessoal eu pedi esse script porque ele é muito útil para tutores, pois alguns tutores abusam dando goto pra npcs de quest , e etc.

 

Eu usei o script padrão, apenas removendo a parte que voce pode dar goto em npc ou em determinada coordenada.

 

 

Vá no talkactions.xml e coloque:

 

 

<talkaction log="yes" words="/got" access="1" event="script" value="got.lua" />
 <talkaction log="yes" words="/ccc" access="1" event="script" value="puxando.lua" />

 

 

Lembrando que você pode editar o nome do comando a seu gosto. No caso ali o "/got" é um /goto só que ele nao funciona em npc. E o /ccc é o comando de "puxar" só que não puxa npcs.

 

 

 

Nos scripts crie um arquivo got.lua e cole:

 

 

function onSay(cid, words, param, channel)
if(param == '') then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
 return true
end
local creature = getCreatureByName(param)
local player = getPlayerByNameWildcard(param)
local waypoint = getWaypointPosition(param)
local tile = string.explode(param, ",")
local pos = {x = 0, y = 0, z = 0}
if(player ~= nil and (not isPlayerGhost(player) or getPlayerGhostAccess(player) <= getPlayerGhostAccess(cid))) then
 pos = getCreaturePosition(player)
else
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
 return true
end
local tmp = getCreaturePosition(cid)
if(doTeleportThing(cid, pos, true) and not isPlayerGhost(cid)) then
 doSendMagicEffect(tmp, CONST_ME_POFF)
 doSendMagicEffect(pos, CONST_ME_TELEPORT)
end
return true
end

 

 

 

 

Depois crie um arquivo chamado puxando.lua e cole:

 

 

function onSay(cid, words, param, channel)
if(param == '') then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
 return true
end
local target = getPlayerByNameWildcard(param)
if(not target) then
 target = getPlayerByName(param)
 if(not target) then
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
  return true
 end
end
if(isPlayerGhost(target) and getPlayerGhostAccess(target) > getPlayerGhostAccess(cid)) then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
 return true
end
local pos = getClosestFreeTile(target, getCreaturePosition(cid), false, false)
if(not pos or isInArray({pos.x, pos.y}, 0)) then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
 return true
end
local tmp = getCreaturePosition(target)
if(doTeleportThing(target, pos, true) and not isPlayerGhost(target)) then
 doSendMagicEffect(tmp, CONST_ME_POFF)
 doSendMagicEffect(pos, CONST_ME_TELEPORT)
end
return true
end

 

 

 

É isso ai pessoal, espero que ajude a todos.

Editado Junho 8 por dragonfight