Ir para conteúdo

[Encerrado] Ctf (Capture The Flag) [Mod] / Ajuda?


chaolim

Posts Recomendados

Gente é o seguinte: Eu botei o sistema CTF [MOD] do SkyDangerous no meu servidor, configurei tudo e funcionou tudo 100% de primeira...

 

Mas tem um probleminha: Assim que ligo o servidor, a mensagem do evento iniciado aparece, e assim que o evento termina, ele começa denovo...

 

- Eu gostaria de fazê-lo iniciar no dia e hora marcada...

 

Obs.: já tentei de tudo e da erro no distro em todas as minhas tentativas frustradas...

 

Segue abaixo as informações detalhadas:

 

Distro: Dream Server 0.4.0.0 ou TFS 0.4.0.0

Tipo de Script: MOD

Versão: 8.60

Nível de Experiência: Amador

 

Segue abaixo meu script [MOD]:

 

 

<?xml version="1.0" encoding="utf-8"?>

<mod name="CTF" version="1.0" author="Doggynub" contact="otland.net" enabled="yes">

<config name="toto"><![CDATA[

 

--[[ Storage Settings]]--

 

 

Owner = 1900 -- put empty storage

 

FLAG2_INn = 4000 -- put empty storage

 

FLAG_IN = 4001 -- put empty storage

 

TEAM1_FLAGS = 3030 -- put empty storage

 

TEAM2_FLAGS = 3031 -- put empty storage

 

Event_Start = 3032 -- put empty storage

 

Event_timeend = 3033 -- put empty storage

 

Event_Tile_Close = 3039 -- put empty storage

 

joined = 2023 --put empty storage

 

Timer = 1010 --put empty storage

 

--------------------------------------

 

 

--[[ Places setting ]]--

 

 

BLUE_FLAG = {x=32484,y=32534,z=7} -- Lugar da bandeira verde (piso pra pegar)

 

RED_FLAG = {x=32439,y=32520,z=7} -- Lugar da bandeira vermelha (piso pra pegar)

 

Tp_Place = {x=32488,y=32188,z=7} -- Lugar onde o teleport vai ser criado

 

Wait_Place = {x=32479,y=32550,z=7} -- Pra onde os jogadores vao ser teletransportados

 

frompos = {x=32466,y=32541,z=7} -- ponto inicial da sala de espera diagonal (primeiro piso)

 

topos = {x=32490,y=32556,z=7} -- ponto final da sala de espera diagonal (ultimo piso)

 

Red_Position = {x=32488,y=32534,z=7} -- base do red team

 

Blue_Position = {x=32444,y=32520,z=7} -- base do blue team

 

 

 

---------------------------------------

 

 

--[[Event setting ]]--

 

 

Event_WaitTime = 5 -- tempo para os jogadores coletarem a bandeira apos o inicio (em minutos)

 

Event_MaxTime = 50 --- em minutos (este e o tempo maximo de execucao de um evento bb)

 

Players_Speed = 2000 -- colocar o nivel da base de velocidade no evento (se quiser velocidade de lvl 300 entao coloque 300)

 

Flag_Holder_Speed = 2000

 

TEAM2_NAME = "vermelho" -- team 2 name

 

TEAM1_NAME = "verde" -- team 1 name

 

FLAG_SCORE = 10 -- marcar quando o time ganha

 

Teleport_On_Score = false -- Isto ira transportar toda a sua posicao sobre o computador principal, quando 20 bandeira um, fazer false para desativar.

 

Players_Least_Number = 2 -- isto significa que se houver menos de dois jogadores participaram do evento sera cancelado

 

Min_Join_Level = 55 -- min lvl de um jogador para participar do evento

 

rewards_random = {

[60] = { -- Rewards of 60% , if it is then it will randomly give one of the items in the items verible if there you put more than one item there

items = {5886,6107,5887}

},

 

[30] = { -- Rewards of 30%

items = {5885,6099,5884}

},

 

 

[10] = { -- Rewards of 10%

items = {5958,9955}

}

}

 

 

]]></config>

<lib name="CTF-lib"><![CDATA[

function isTeamTwo(cid)

return (isPlayer(cid) and getPlayerStorageValue(cid,5054) > -1)

end

function isTeamOne(cid)

return (isPlayer(cid) and getPlayerStorageValue(cid,5055) > -1)

end

function resetTheTeams(cid)

return (isPlayer(cid) and setPlayerStorageValue(cid,5054,-1) and setPlayerStorageValue(cid,5055,-1))

end

function setflagOwner(cid)

return setPlayerStorageValue(cid,Owner,1)

end

function flagOwner(cid)

return (isPlayer(cid) and getPlayerStorageValue(cid,Owner) > 0)

end

function releaseBF(cid)

setGlobalStorageValue(FLAG_IN,-1)

setPlayerStorageValue(cid,103, 0)

setPlayerStorageValue(cid,Owner,-1)

return true

end

function releaseRF(cid)

setGlobalStorageValue(FLAG2_INn,-1)

setPlayerStorageValue(cid,103, 0)

setPlayerStorageValue(cid,Owner,-1)

return true

end

function setFirstTeam(cid)

return setPlayerStorageValue(cid,5055,1)

end

function setSecondTeam(cid)

return setPlayerStorageValue(cid,5054,2)

end

function addToRed()

return setGlobalStorageValue(TEAM2_FLAGS,getGlobalStorageValue(TEAM2_FLAGS)+1)

end

function addToBlue()

return setGlobalStorageValue(TEAM1_FLAGS,getGlobalStorageValue(TEAM1_FLAGS)+1)

end

function getBlueScore()

return getGlobalStorageValue(TEAM1_FLAGS)

end

function getRedScore()

return getGlobalStorageValue(TEAM2_FLAGS)

end

function getTheSpeed(level)

value = (220 +(2 *(level -1)))

return value

end

 

function resetTheStorage()

setGlobalStorageValue(Event_Start,-1)

setGlobalStorageValue(Event_timeend,-1)

setGlobalStorageValue(TEAM1_FLAGS,0)

setGlobalStorageValue(FLAG2_INn,-1)

setGlobalStorageValue(FLAG_IN,-1)

setGlobalStorageValue(TEAM2_FLAGS,0)

return true

end

function blueStolen()

return getGlobalStorageValue(FLAG_IN)

end

function redStolen()

return getGlobalStorageValue(FLAG2_INn)

end

function giveReward(cid)

local t = math.random(1,100)

if t <= 10 then

local rare = rewards_random[10].items[math.random(1,#rewards_random[10].items)]

doPlayerAddItem(cid,rare,1)

doPlayerSendTextMessage(cid,25,"Recompensa Rara premiada: voce ganhou um "..getItemNameById(rare)..".")

 

elseif t > 10 and t <= 40 then

local semi = rewards_random[30].items[math.random(1,#rewards_random[30].items)]

doPlayerAddItem(cid,semi,1)

doPlayerSendTextMessage(cid,25,"Recompensa semi rara premiada: voce ganhou um "..getItemNameById(semi)..".")

 

 

elseif t > 40 then

local aver = rewards_random[60].items[math.random(1,#rewards_random[60].items)]

doPlayerAddItem(cid,aver,1)

doPlayerSendTextMessage(cid,25,"Recompensa media premiada: voce ganhou um "..getItemNameById(aver)..".")

end

return true

end

]]></lib>

<event type="login" name="Tutorial Login" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

function onLogin(cid)

if getGlobalStorageValue(Event_Start) < 1 then

if isTeamOne(cid) or isTeamTwo(cid) then

resetTheTeams(cid)

end

end

registerCreatureEvent(cid, "Attk")

registerCreatureEvent(cid, "ctff")

registerCreatureEvent(cid, "prepare")

return true

end

]]></event>

<event type="combat" name="Attk" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

 

function onCombat(cid, target)

if isTeamOne(cid) and isTeamOne(target) then

return false

end

if isTeamTwo(cid) and isTeamTwo(target) then

return false

end

return true

end

]]></event>

<event type="statschange" name="prepare" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

 

local corpse_ids = {

[0] = 3065, -- female

[1] = 3058 -- male

}

function onStatsChange(cid, attacker, type, combat, value)

if combat == COMBAT_HEALING then

return true

end

if getCreatureHealth(cid) > value then

return true

end

if getGlobalStorageValue(Event_Start) > 0 then

if flagOwner(cid) then

if isTeamOne(cid) then

doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Flag Holder].")

doTeleportThing(cid,Blue_Position,false)

doSendMagicEffect(Blue_Position,10)

doCreatureAddHealth(cid,getCreatureMaxHealth(cid))

doCreatureAddMana(cid,getCreatureMaxMana(cid))

releaseRF(cid)

for _,cid in ipairs(getPlayersOnline()) do

if isTeamOne(cid) or isTeamTwo(cid) then

doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " has died with the "..TEAM2_NAME.." team flag. The flag is returned back to the "..TEAM1_NAME.." team.")

end

end

return false

elseif isTeamTwo(cid) then

doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Flag Holder].")

doTeleportThing(cid,Red_Position,false)

doSendMagicEffect(Red_Position,10)

doCreatureAddHealth(cid,getCreatureMaxHealth(cid))

doCreatureAddMana(cid,getCreatureMaxMana(cid))

releaseBF(cid)

for _,cid in ipairs(getPlayersOnline()) do

if isTeamOne(cid) or isTeamTwo(cid) then

doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " has died with the "..TEAM1_NAME.." team flag. The flag is returned back to the "..TEAM1_NAME.." team.")

end

end

return false

end

 

else

if isTeamOne(cid) or isTeamTwo(cid) then

doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item").."[Normal kill].")

doTeleportThing(cid,( isTeamTwo(cid) and Red_Position or Blue_Position ),false)

doSendMagicEffect(Red_Position,10)

doCreatureAddHealth(cid,getCreatureMaxHealth(cid))

doCreatureAddMana(cid,getCreatureMaxMana(cid))

return false

end

end

 

end

return true

end

 

]]></event>

<movevent type="StepIn" actionid="6000" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

 

function eventEnds()

doBroadcastMessage('Evento-CTF: O time '..TEAM2_NAME..' venceu e recebeu o premio.')

for _,cid in ipairs(getPlayersOnline()) do

if isTeamTwo(cid) then

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

doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

doRemoveConditions(cid,false)

resetTheTeams(cid)

doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

giveReward(cid)

 

elseif isTeamOne(cid) then

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

doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

doRemoveConditions(cid,false)

doPlayerSendTextMessage(cid,22,'Seu time perdeu.')

resetTheTeams(cid)

doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

end

end

addEvent(resetTheStorage,5)

end

function onStepIn(cid, item, position, fromPosition)

if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

if isTeamTwo(cid) and redStolen() < 0 then

if not flagOwner(cid) then

doTeleportThing(cid, fromPosition,TRUE)

doSendMagicEffect(getThingPos(cid),2)

doPlayerSendTextMessage(cid, 27, "Essa e a sua bandeira, voce nao pode pegar ela!")

end

elseif isTeamTwo(cid) and redStolen() > 0 and blueStolen() < 0 then

doPlayerSendTextMessage(cid, 27, "A bandeira de sua equipe foi roubada, va busca-la de volta!")

doTeleportThing(cid, fromPosition,TRUE)

doSendMagicEffect(getThingPos(cid),2)

return true

end

if isTeamTwo(cid) and flagOwner(cid) and blueStolen() > 0 and redStolen() < 0 then

if getRedScore() == FLAG_SCORE -1 then

addEvent(eventEnds,1000)

addToRed()

doTeleportThing(cid, fromPosition,TRUE)

doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

releaseBF(cid)

for _,tid in ipairs(getPlayersOnline()) do

if isTeamOne(tid) or isTeamTwo(tid) then

doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " capturou a ultima bandeira e o time ".. TEAM2_NAME.." venceu o evento!")

end

end

else

releaseBF(cid)

addToRed()

doTeleportThing(cid, fromPosition,TRUE)

doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

for _,tid in ipairs(getPlayersOnline()) do

if isTeamOne(tid) or isTeamTwo(tid) then

doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " capturou uma bandeira e adquiriu 1 ponto para o time ".. TEAM2_NAME.."!")

if Teleport_On_Score == true then

doTeleportThing(tid,( isTeamTwo(tid) and Red_Position or Blue_Position ), false)

doSendMagicEffect(getThingPos(tid),10)

end

end

end

end

end

if isTeamOne(cid) then

if blueStolen() < 0 and redStolen() > 0 then

if flagOwner(cid) then

doPlayerSendTextMessage(cid, 27, "Voce ja esta segurando a bandeira!")

doTeleportThing(cid, fromPosition,TRUE)

doSendMagicEffect(getThingPos(cid),2)

elseif (not flagOwner(cid)) then

doPlayerSendTextMessage(cid, 27, "Seus companheiros de equipe roubaram uma bandeira adversaria, defenda-os!")

doTeleportThing(cid, fromPosition,TRUE)

doSendMagicEffect(getThingPos(cid),2)

end

elseif blueStolen() > 0 and redStolen() < 0 then

doPlayerSendTextMessage(cid, 27, "A bandeira de seu time foi roubada e voce nao pode capturar uma bandeira agora!")

doTeleportThing(cid, fromPosition,TRUE)

doSendMagicEffect(getThingPos(cid),2)

end

if redStolen() < 0 and blueStolen() < 0 then

setGlobalStorageValue(FLAG2_INn,1)

setflagOwner(cid)

setPlayerStorageValue(cid,103, os.time()+300)

doTeleportThing(cid, fromPosition,TRUE)

doChangeSpeed(cid, getTheSpeed(Flag_Holder_Speed)- getCreatureSpeed(cid) )

for _,tid in ipairs(getPlayersOnline()) do

if isTeamOne(tid) or isTeamTwo(tid) then

doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " roubou uma bandeira do time "..TEAM2_NAME.."!")

end

end

end

end

end

return true

end

]]></movevent>

<movevent type="StepIn" actionid="3435" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)

if getStorage(Event_Tile_Close) > 0 then

if getPlayerLevel(cid) < Min_Join_Level then

doTeleportThing(cid,fromPosition,false)

doSendMagicEffect(fromPosition,10)

doPlayerSendTextMessage(cid,21,"Apenas jogadores com o nivel "..Min_Join_Level.." ou superior podem passar.")

else

doTeleportThing(cid,Wait_Place,false)

doSendMagicEffect(Wait_Place,10)

end

else

doTeleportThing(cid,fromPosition,false)

doSendMagicEffect(fromPosition,10)

doPlayerSendTextMessage(cid,21,"Volte depois, o evento esta fechado agora.")

end

return true

end

 

]]></movevent>

<movevent type="StepIn" actionid="6001" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

 

function eventEnded()

if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

doBroadcastMessage('Evento-CTF: O time '.. TEAM1_NAME..' venceu e recebeu o premio.')

for _,cid in ipairs(getPlayersOnline()) do

if isTeamOne(cid) then

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

doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

doRemoveConditions(cid,false)

resetTheTeams(cid)

doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

giveReward(cid)

elseif isTeamTwo(cid) then

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

doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

doRemoveConditions(cid,false)

doPlayerSendTextMessage(cid,22,'Seu time perdeu.')

resetTheTeams(cid)

doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

end

end

end

addEvent(resetTheStorage,5)

end

function onStepIn(cid, item, position, fromPosition)

if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

if isTeamOne(cid) and blueStolen() < 0 then

if not flagOwner(cid) then

doTeleportThing(cid, fromPosition,TRUE)

doSendMagicEffect(getThingPos(cid),2)

doPlayerSendTextMessage(cid, 27, "Essa e a sua bandeira, voce nao pode pegar ela!")

end

elseif isTeamOne(cid) and blueStolen() > 0 and redStolen() < 0 then

doPlayerSendTextMessage(cid, 27, "A bandeira de seu time foi roubada, va busca-la de volta!")

doTeleportThing(cid, fromPosition,TRUE)

doSendMagicEffect(getThingPos(cid),2)

return true

end

if isTeamOne(cid) and flagOwner(cid) and redStolen() > 0 and blueStolen() < 0 then

if getBlueScore() == FLAG_SCORE -1 then

addEvent(eventEnded,1000)

addToBlue()

doTeleportThing(cid, fromPosition,TRUE)

doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

releaseRF(cid)

for _,tid in ipairs(getPlayersOnline()) do

if isTeamOne(tid) or isTeamTwo(tid) then

doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " capturou a ultima bandeira e o time ".. TEAM1_NAME.." venceu o evento!")

end

end

else

releaseRF(cid)

addToBlue()

doTeleportThing(cid, fromPosition,TRUE)

doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid) )

for _,tid in ipairs(getPlayersOnline()) do

if isTeamOne(tid) or isTeamTwo(tid) then

doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " capturou uma bandeira e adquiriu 1 ponto para o time ".. TEAM1_NAME.."!")

if Teleport_On_Score == true then

doTeleportThing(tid,( isTeamTwo(tid) and Red_Position or Blue_Position ), false)

doSendMagicEffect(getThingPos(tid),10)

end

end

end

end

end

if isTeamTwo(cid) then

if blueStolen() > 0 and redStolen() < 0 then

if flagOwner(cid) then

doPlayerSendTextMessage(cid, 27, "Voce ja esta segurando essa bandeira!")

doTeleportThing(cid, fromPosition,TRUE)

doSendMagicEffect(getThingPos(cid),2)

elseif (not flagOwner(cid)) then

doPlayerSendTextMessage(cid, 27, "Seus companheiros de equipe roubaram uma bandeira adversaria, defenda-os!")

doTeleportThing(cid, fromPosition,TRUE)

doSendMagicEffect(getThingPos(cid),2)

end

elseif redStolen() > 0 and blueStolen() < 0 then

doPlayerSendTextMessage(cid, 27, "A bandeira de seu time foi roubada e voce nao pode capturar uma bandeira agora!")

doTeleportThing(cid, fromPosition,TRUE)

doSendMagicEffect(getThingPos(cid),2)

end

if blueStolen() < 0 and redStolen() < 0 then

setGlobalStorageValue(FLAG_IN,1)

setflagOwner(cid)

setPlayerStorageValue(cid,103, os.time()+300)

doTeleportThing(cid, fromPosition,TRUE)

doChangeSpeed(cid, getTheSpeed(Flag_Holder_Speed)- getCreatureSpeed(cid) )

for _,tid in ipairs(getPlayersOnline()) do

if isTeamOne(tid) or isTeamTwo(tid) then

doPlayerSendTextMessage(tid,22,getCreatureName(cid) .. " roubou uma bandeira do time "..TEAM1_NAME.."!")

end

end

end

end

end

return true

end

]]></movevent>

<globalevent name="ctf" interval="900.0" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

local players = {}

local bmale = createConditionObject(CONDITION_OUTFIT)

setConditionParam(bmale, CONDITION_PARAM_TICKS, -1)

addOutfitCondition(bmale, {lookType = math.random(128,134), lookHead = 115, lookBody =114, lookLegs = 81, lookFeet = 81, lookTypeEx = 0, lookAddons = 3})

 

local bfemale = createConditionObject(CONDITION_OUTFIT)

setConditionParam(bfemale, CONDITION_PARAM_TICKS, -1)

addOutfitCondition(bfemale, {lookType = math.random(136,142), lookHead = 115, lookBody =114, lookLegs = 81, lookFeet = 81, lookTypeEx = 0, lookAddons = 3})

 

local rmale = createConditionObject(CONDITION_OUTFIT)

setConditionParam(rmale, CONDITION_PARAM_TICKS, -1)

addOutfitCondition(rmale, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})

 

local rfemale = createConditionObject(CONDITION_OUTFIT)

setConditionParam(rfemale, CONDITION_PARAM_TICKS, -1)

addOutfitCondition(rfemale, {lookType = math.random(136,142),lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})

local fight = createConditionObject(CONDITION_INFIGHT)

setConditionParam(fight, CONDITION_PARAM_TICKS, -1)

function eventEnd()

if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

if getRedScore() > getBlueScore() then

doBroadcastMessage('Evento-CTF: O time '.. TEAM2_NAME..' venceu o evento e recebeu o premio.')

for _,cid in ipairs(getPlayersOnline()) do

if isTeamTwo(cid) then

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

doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

doRemoveConditions(cid,false)

resetTheTeams(cid)

doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

giveReward(cid)

elseif isTeamOne(cid) then

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

doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

doRemoveConditions(cid,false)

doPlayerSendTextMessage(cid,22,'Seu time perdeu.')

resetTheTeams(cid)

doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

end

end

 

elseif getRedScore() < getBlueScore() then

doBroadcastMessage('Evento-CTF: O time '.. TEAM1_NAME..' venceu o evento e recebeu o premio.')

for _,cid in ipairs(getPlayersOnline()) do

if isTeamOne(cid) then

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

doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

doRemoveConditions(cid,false)

resetTheTeams(cid)

doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

giveReward(cid)

elseif isTeamTwo(cid) then

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

doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

doRemoveConditions(cid,false)

doPlayerSendTextMessage(cid,22,'Seu time perdeu.')

resetTheTeams(cid)

doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

end

end

elseif getRedScore() == getBlueScore() then

doBroadcastMessage('Evento-CTF: O evento terminou com um empate entre as duas equipes.')

for _,cid in ipairs(getPlayersOnline()) do

if isTeamTwo(cid) or isTeamOne(cid) then

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

doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)

doRemoveConditions(cid,false)

doPlayerSendTextMessage(cid,22,'Foi um empate entre as duas equipes.')

resetTheTeams(cid)

doChangeSpeed(cid, getTheSpeed(getPlayerLevel(cid)) - getCreatureSpeed(cid))

end

end

 

end

addEvent(resetTheStorage,1000)

end

end

 

function eventStart()

doSetStorage(Event_Tile_Close,-1)

setGlobalStorageValue(Event_timeend,1)

setGlobalStorageValue(Timer, os.time() + Event_MaxTime*60)

addEvent(eventEnd,Event_MaxTime*60*1000)

 

 

 

for v = frompos.x , topos.x do

for k = frompos.y , topos.y do

for i = 1, 200 do

position = {x = v, y = k, z = 7, stackpos = i}

pid = getThingfromPos(position).uid

if(pid ~= nil and isPlayer(pid)) then

table.insert(players, pid)

end

end

end

end

if math.mod(#players, 2) ~= 0 then

doTeleportThing(players[#players],getTownTemplePosition(getPlayerTown(players[#players])),false)

doSendMagicEffect(getThingPosition(players[#players]),10)

doPlayerSendTextMessage(players[#players], 19, "Lamentamos, mas voce foi expulso do evento para o balanceamento das equipes.")

table.remove(players)

end

if #players < Players_Least_Number then

doBroadcastMessage("O evento CTF foi cancelado porque menos de "..Players_Least_Number.." jogadores participaram.")

resetTheStorage()

if #players > 0 then

for i = 1,#players do

doTeleportThing(players,getTownTemplePosition(getPlayerTown(players)),false)

doSendMagicEffect(getThingPos(players), 10)

end

end

else

doBroadcastMessage("CTF iniciado")

for i = 1, math.floor(#players/2) do

setFirstTeam(players)

end

for i = math.floor(#players/2)+1 , #players do

setSecondTeam(players)

end

for _,cid in ipairs(getPlayersOnline()) do

if isTeamOne(cid) then

if getPlayerSex(cid) == 1 then

doAddCondition(cid, bmale)

elseif getPlayerSex(cid) ~= 1 then

doAddCondition(cid, bfemale)

end

doAddCondition(cid, fight)

doTeleportThing(cid,Blue_Position,false)

doSendMagicEffect(Blue_Position, 10)

doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid))

elseif isTeamTwo(cid) then

if getPlayerSex(cid) == 1 then

doAddCondition(cid, rmale)

elseif getPlayerSex(cid) ~= 1 then

doAddCondition(cid, rfemale)

end

doAddCondition(cid, fight)

doTeleportThing(cid,Red_Position,false)

doSendMagicEffect(Red_Position, 10)

doChangeSpeed(cid, getTheSpeed(Players_Speed) - getCreatureSpeed(cid))

end

end

players = {}

 

end

end

function onThink(interval)

if getGlobalStorageValue(Event_Start) < 0 then

setGlobalStorageValue(Event_Start,1)

doSetStorage(Event_Tile_Close,1)

doBroadcastMessage("O evento CTF esta comecando e o teleporte foi aberto. Ele vai comecar em "..Event_WaitTime.." minutos.")

players = {}

if getTileItemById(Tp_Place, 1387).uid < 1 then

doItemSetAttribute(doCreateItem(1387,1, Tp_Place), "aid", 3435)

end

 

f= Event_WaitTime - 1

for i = 1,Event_WaitTime-1 do

addEvent(doBroadcastMessage,i*60*1000,"O evento CTF esta comecando e o teleporte foi aberto. Ele vai comecar em "..f.." minutos.")

f= f-1

end

addEvent(eventStart,Event_WaitTime*60*1000)

end

return true

end

]]></globalevent>

<event type="think" name="ctff" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

 

local bl = BLUE_FLAG

local re = RED_FLAG

function onThink(interval)

if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

if redStolen() < 0 then

doSendAnimatedText(re,"BANDEIRA!",TEXTCOLOR_DARKRED)

doSendMagicEffect(re, CONST_ME_SOUND_RED)

end

if blueStolen() < 0 then

doSendAnimatedText(bl,"BANDEIRA!",TEXTCOLOR_GREEN)

doSendMagicEffect(bl, CONST_ME_SOUND_GREEN)

end

for _, cid in ipairs(getPlayersOnline()) do

if flagOwner(cid) then

if isTeamOne(cid) or isTeamTwo(cid) then

if hasCondition(cid,CONDITION_HASTE) then

doRemoveCondition(cid,CONDITION_HASTE)

end

end

pl = getThingPos(cid)

if isTeamTwo(cid) then

if getPlayerStorageValue(cid,103) < os.time() then

releaseBF(cid)

for _,cid in ipairs(getPlayersOnline()) do

if isTeamOne(cid) or isTeamTwo(cid) then

doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " demorou 5 minutos com a bandeira. A bandeira da equipe "..TEAM1_NAME.." deve ser capturada novamente!")

end

end

else

doSendAnimatedText(pl,"BANDEIRA!",TEXTCOLOR_GREEN)

doSendMagicEffect(pl, CONST_ME_SOUND_GREEN)

end

elseif isTeamOne(cid) then

if getPlayerStorageValue(cid,103) < os.time() then

releaseRF(cid)

for _,cid in ipairs(getPlayersOnline()) do

if isTeamOne(cid) or isTeamTwo(cid) then

doPlayerSendTextMessage(cid,22,getCreatureName(cid) .. " demorou 5 minutos com a bandeira. A bandeira da equipe "..TEAM2_NAME.." deve ser capturada novamente!")

end

end

else

doSendAnimatedText(pl,"BANDEIRA!",COLOR_RED)

doSendMagicEffect(pl, CONST_ME_SOUND_RED)

end

end

end

end

end

return true

end

]]></event>

<globalevent name="timer" interval="0.4" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

 

function onThink(interval)

for _,cid in ipairs(getPlayersOnline()) do

if isTeamOne(cid) or isTeamTwo(cid) then

if getGlobalStorageValue(Event_Start) > 0 and getGlobalStorageValue(Event_timeend) > 0 then

if getGlobalStorageValue(Timer)- os.time() >= 0 then

doPlayerSendCancel(cid, "Tempo -> ".. os.date("%M:%S ",getGlobalStorageValue(Timer)- os.time()) .. " | ".. TEAM1_NAME..": "..getBlueScore(cid).."/"..FLAG_SCORE.." capturas | ".. TEAM2_NAME..": "..getRedScore(cid).."/"..FLAG_SCORE.." capturas")

end

end

end

end

return true

end

]]></globalevent>

<globalevent name="starting" type="startup" event="script"><![CDATA[

domodlib('toto')

domodlib('CTF-lib')

function onStartup()

resetTheStorage()

 

return true

end

]]></globalevent>

</mod>

 

 

 

EDIT: Agradeço desde já. yes.gif

 

EDIT: To precisando muito disso! dou Rep+

 

 

Por favor, Alguéem me ajudaa =(

 

 

 

EDIT: RESOLVI! quem quiser ajuda me manda pm

Editado por chaolim
Link para o comentário
Compartilhar em outros sites

  • 5 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...