Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Eai Galerinha, Algumas vezes, quando eu estou fazendo uma busca, eu preciso encontrar um NPC, mas às vezes eu não sei onde é que está o NPC . Então seus problemas acabaram!!!

Este talkaction tem um custo de 100 moedas de ouro.

 

...data/talkactions/scripts/find_npc.lua

local config =
{
cost = 100
}

function onSay(cid, words, param, channel)
if(param == "" or param == nil) then
return false
end

if doPlayerRemoveMoney(cid, config.cost) == FALSE then
doPlayerSendCancel(cid, "You do not have enough money.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return true
end

local getNpc = getCreatureByName(param)
if isNpc(getNpc) == TRUE then

local playerPos, npcPos = getCreaturePosition(cid), getCreaturePosition(getNpc)
local px, py = 0, 0
local pS = ""
local text = ""

if(playerPos.x == npcPos.x) and (playerPos.y < npcPos.y) then
px = 1
py = npcPos.y - playerPos.y
pS = "south"
elseif(playerPos.x == npcPos.x) and (playerPos.y > npcPos.y) then
px = 1
py = playerPos.y - npcPos.y
pS = "north"
elseif(playerPos.x < npcPos.x) and (playerPos.y == npcPos.y) then
px = npcPos.x - playerPos.x
py = 1
pS = "east"
elseif(playerPos.x > npcPos.x) and (playerPos.y == npcPos.y) then
px = playerPos.x - npcPos.x
py = 1
pS = "west"
elseif(playerPos.x > npcPos.x) and (playerPos.y > npcPos.y) then
px = playerPos.x - npcPos.x
py = playerPos.y - npcPos.y
pS = "north-west"
elseif(playerPos.x > npcPos.x) and (playerPos.y < npcPos.y) then
px = playerPos.x - npcPos.x
py = npcPos.y - playerPos.y
pS = "south-west"
elseif(playerPos.x < npcPos.x) and (playerPos.y < npcPos.y) then
px = npcPos.x - playerPos.x
py = npcPos.y - playerPos.y
pS = "south-east"
elseif(playerPos.x < npcPos.x) and (playerPos.y > npcPos.y) then
px = npcPos.x - playerPos.x
ps = playerPos.y - npcPos.y
pS = "north-east"
end

if(px <= 4 and py <= 4) then
text = "" .. getCreatureName(getNpc) .. " is standing next you."
elseif((px > 4 and px <= 100) and (py > 4 and py <= 100)) or ((px > 4 and px <= 100) and (py <= 4)) or ((px <= 4) and (py > 4 and py <= 100)) then
text = "" .. getCreatureName(getNpc) .. " is to the " .. pS .. "."
elseif((px > 100 and px <= 274) and (py > 100 and py <= 274)) or ((px > 100 and px <= 274) and (py <= 100)) or ((px <= 100) and (py > 100 and py <= 274)) then
text = "" .. getCreatureName(getNpc) .. " is far to the " .. pS .. "."
elseif((px > 274 and px <= 280) and (py > 274 and py <= 280)) or ((px > 274 and px <= 280) and (py < 274)) or ((px < 274) and (py > 274 and py <= 280)) then
text = "" .. getCreatureName(getNpc) .. " is very far to the " .. pS .. "."
elseif(px > 280 and py > 280) or (px > 280 and py < 280) or (px < 280 and py > 280) then
text = "" .. getCreatureName(getNpc) .. " is to the " .. pS .. "."
end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
return false
else
doPlayerSendCancel(cid, "A npc with that name does not exist.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return true
end
end

..data/talkactions/talkactions.xml

<talkaction words="!exiva" filter="quotation" event="script" value="find_npc.lua"/>

AVISO: se o servidor tive dois ou mais NPCS com o mesmo nome, o talkaction vai encontrar apenas um desses NPCS

CREDITOS!!!

DARKHAOS 100% SCRIPT!!!

ANDREYLOST 100% TUTORIAL

 

Editado por AndreyLost (veja o histórico de edições)

                                        ql4YsI7.gif

                                                                                                        http://WWW.AFBHOST.COM

 

                                             ql4YsI7.gif

                                                                                                              http://WWW.AFBHOST.COM

 

                                          

 

 

 

 

 

Link para o post
Compartilhar em outros sites

Cade minha aprovação?

                                        ql4YsI7.gif

                                                                                                        http://WWW.AFBHOST.COM

 

                                             ql4YsI7.gif

                                                                                                              http://WWW.AFBHOST.COM

 

                                          

 

 

 

 

 

Link para o post
Compartilhar em outros sites

Diminua essas letras, isso deixa o tópico feio, assim que for feito eu irei aprovar.

Editado por Wakon (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 2 months later...
Em 21/01/2016 at 17:47, Wakon disse:

Diminua essas letras, isso deixa o tópico feio, assim que for feito eu irei aprovar.

pronto.

                                        ql4YsI7.gif

                                                                                                        http://WWW.AFBHOST.COM

 

                                             ql4YsI7.gif

                                                                                                              http://WWW.AFBHOST.COM

 

                                          

 

 

 

 

 

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por Tricoder
      Preview

       
      Script
      data/items/items.xml
      <item id="8981" article="a" name="gold premium card"> <attribute key="weight" value="0" /> <attribute key="description" value="Use this card to receive 7 premium days." /> </item> data/actions/actions.xml
      <action itemid="8981" script="other/premiumcard.lua"/> data/actions/scripts/premium_card
      local t = { days = 7, effect = CONST_ME_HOLYAREA } function onUse(cid, item, fromPosition, itemEx, toPosition) doPlayerRemoveItem(cid, 8981, 1) return TRUE, doPlayerAddPremiumDays(cid, t.days), doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You now have +" .. t.days .. " premium days!"), doSendMagicEffect(fromPosition, t.effect) end Créditos: God Mythera
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo