Ir para conteúdo

Featured Replies

Postado

eae galera do TK então vim aki pedir a ajuda de vocês eu tenho um sistema de captura de bandeira do meu server ta tudo certo mais quando uso o comando pra abrir ai vai pro npc tudo certo ... só que quando eu falo com o npc ele me manda para outro lugar nada a ver com o evento

 

script do npc \/

 

--[[


Capture The Flag System
Author: Maxwell Denisson(MaXwEllDeN)
Version: 1.0
]]

local focus = 0
local talk_start = 0
local target = 0
local talkState = {}
local following = false
local attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)
end

function onCreatureAppear(creature)
end


function onCreatureDisappear(cid, pos)
if (focus ~= 0) then
selfSay("Good bye too!")
focus, talk_start = 0, 0
end
end


function onCreatureTurn(creature)
end


function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, "(%w+)" .. str) and not string.find(txt, str .. "(%w+)"))
end

function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

local iteimbymsg = getItemIdByName(msg, false)

if (msgcontains(msg, "bye") and (focus == cid)) and getDistanceToCreature(cid) < 4 then
local playerguid = getPlayerGUIDByName(getCreatureName(getNpcId()))
focus, talk_start, talkState[talkUser] = 0, 0, 0

selfSay("Adeus " .. getCreatureName(cid) .. "!", cid)
elseif (msgcontains(msg, "hi") and (focus == 0)) and getDistanceToCreature(cid) < 4 then
local playerguid = getPlayerGUIDByName(getCreatureName(getNpcId()))

focus, talk_start, talkState[talkUser] = cid, os.clock(), -1
if (_CTF_LIB.nopen) and (getGlobalStorageValue(_CTF_LIB.CTFSto) < 1) then
selfSay("Olá {" .. getCreatureName(cid) .. "}, sou responsável por levar os players para o evento ROUBAR A BANDEIRA, porém ele está fechado no momento.", cid)
else
selfSay("Olá {" .. getCreatureName(cid) .. "}, sou responsável por levar os players para o evento ROUBAR A BANDEIRA, caso esteja interessado em ir diga {evento}.", cid)
talkState[talkUser] = 0
end
elseif (msgcontains(msg, "evento")) and (talkState[talkUser] == 0) and (focus == cid) and (getDistanceToCreature(cid) < 4) then
talk_start, talkState[talkUser] = os.clock(), 1
if (_CTF_LIB.price) then
selfSay("Para ir para o evento você precisa pagar uma taxa de {".. _CTF_LIB.price .."} gold coins. Você tem certeza que quer ir para o evento?", cid)
else
selfSay("Você tem certeza que quer ir para o evento?", cid)
end
selfSay("Se você tiver algum stealth ring ele será removido.", cid)
elseif (msgcontains(msg, "sim") or msgcontains(msg, "yes")) and (talkState[talkUser] == 1) and (focus == cid) and (getDistanceToCreature(cid) < 4) then
if (_CTF_LIB.nopen) and (getGlobalStorageValue(_CTF_LIB.CTFSto) < 1) then
selfSay("Você não pode ir para o evento agora!", cid)
talkState[talkUser] = 0
else
talk_start = os.clock()
if (_CTF_LIB.price) then
if not(doPlayerRemoveMoney(cid, _CTF_LIB.price)) then
selfSay("Você precisa de {".. _CTF_LIB.price .. "} gold coins para poder ir para o evento :'(", cid)
talk_start, talkState[talkUser] = os.clock(), 1
else
focus, talk_start, talkState[talkUser] = 0, 0, 0
local teamid = getTeamLivre()
local team = _CTF_LIB.flags[teamid]

registerCreatureEvent(cid, "CTFCombat")
registerCreatureEvent(cid, "CTFAttack")
registerCreatureEvent(cid, "CTFDeath")
registerCreatureEvent(cid, "CTFLogout")

if not(_CTF_LIB.teamsOUT[teamid][getPlayerSex(cid)]) then
doAddCondition(cid, _CTF_LIB.teamsOUT[teamid][2])
else
doAddCondition(cid, _CTF_LIB.teamsOUT[teamid][getPlayerSex(cid)])
end

local ring = getPlayerSlotItem(cid, 9)
if (ring.itemid == 2165) or (ring.itemid == 2202) then
doRemoveItem(ring.uid, 1)
end

if (doPlayerRemoveItem(cid, 2165, getPlayerItemCount(cid, 2165))) then
doPlayerSendTextMessage(cid, 27, "Boa Sorte no Evento!")
end

doRemoveCondition(cid, CONDITION_INVISIBLE)
setGlobalStorageValue(teamid, getGlobalStorageValue(teamid)+1)
setPlayerStorageValue(cid, _CTF_LIB.teamssto, teamid)
doPlayerSetTown(cid, team.temple)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
selfSay("BOM EVENTO!", cid)
end
else
focus, talk_start, talkState[talkUser] = 0, 0, 0
local teamid = getTeamLivre()
local team = _CTF_LIB.flags[teamid]

registerCreatureEvent(cid, "CTFCombat")
registerCreatureEvent(cid, "CTFAttack")
registerCreatureEvent(cid, "CTFDeath")
registerCreatureEvent(cid, "CTFLogout")

if not(_CTF_LIB.teamsOUT[teamid][getPlayerSex(cid)]) then
doAddCondition(cid, _CTF_LIB.teamsOUT[teamid][2])
else
doAddCondition(cid, _CTF_LIB.teamsOUT[teamid][getPlayerSex(cid)])
end

local ring = getPlayerSlotItem(cid, 9)
if (ring.itemid == 2165) or (ring.itemid == 2202) then
doRemoveItem(ring.uid, 1)
end

if (doPlayerRemoveItem(cid, 2165, getPlayerItemCount(cid, 2165))) then
doPlayerSendTextMessage(cid, 27, "Boa Sorte no Evento!")
end

doRemoveCondition(cid, CONDITION_INVISIBLE)
setGlobalStorageValue(teamid, getGlobalStorageValue(teamid)+1)
setPlayerStorageValue(cid, _CTF_LIB.teamssto, teamid)
doPlayerSetTown(cid, team.temple)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
selfSay("BOM EVENTO!", cid)
end
end
end
end

function onCreatureChangeOutfit(creature)
end

function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 60 then
if focus > 0 then
selfSay("Flw!", cid)
end
focus = 0
talk_start = 0
end

if focus ~= 0 then
if getDistanceToCreature(focus) > 3 then
selfSay("FLW AEW!", cid)
focus = 0
talk_start = 0
end
end
end

 

e outra quando eu uso o comando talkaction para fechar o evento aparece este erro no distro

 

2cegsao.png

 

script da talkaction \/

 

--[[


Capture The Flag System
Author: Maxwell Denisson(MaXwEllDeN)
Version: 1.0
]]

function onSay(cid, words, param)
local CTF = _CTF_LIB

if not(CTF.nopen) then
return false
end

if (param == "open") then
if (getGlobalStorageValue(CTF.CTFSto) > 0) then
return doPlayerSendTextMessage(cid, 27, "O Evento RB já está aberto!")
end

doBroadcastMessage("[Evento] Roube a Bandeira foi aberto!")
setGlobalStorageValue(CTF.CTFSto, 1)
doPlayerSendTextMessage(cid, 27, "Evento Roube a Bandeira foi aberto com sucesso!")
elseif (param == "close") then
if (getGlobalStorageValue(CTF.CTFSto) < 1) then
return doPlayerSendTextMessage(cid, 27, "O Evento Roube a Bandeira já está fechado!")
end

doBroadcastMessage("[Evento] Roube a Bandeira foi fechado!")

for a, _ in pairs(CTF.flags) do
setGlobalStorageValue(a, 0)
setGlobalStorageValue(a-15, 0)
end

for _, cid in pairs (getOnlinePlayers()) do
local cid = getPlayerByNameWildcard(b)
if (getPlayerStorageValue(cid, CTF.teamssto) > 0) then
doPlayerSendTextMessage(cid, 22, "[Evento] Roube a Bandeira foi fechado e você saiu do evento!")

if (getPlayerStorageValue(cid, CTF.Flagsto) > 0) then
local bant = getPlayerStorageValue(cid, CTF.Flagsto)
devolverFlag(cid, bant)
end

setPlayerStorageValue(cid, CTF.teamssto, -1)
setPlayerStorageValue(cid, CTF.Flagsto, -1)
doPlayerSetTown(cid, CTF.TownExit)
doTeleportThing(cid, getTownTemplePosition(CTF.TownExit))
end
end

setGlobalStorageValue(CTF.CTFSto, -1)
doPlayerSendTextMessage(cid, 27, "Evento RB foi fechado com sucesso!")
end
return true
end

 

 


@Bump!

Projeto ATS (Naruto)

Informações Abaixo

Facebook

Youtube
Discord

 

Tutoriais / Conteúdos

Clique Aqui

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.8k

Informação Importante

Confirmação de Termo