Ir para conteúdo
  • 0

Globalevent battle-arena


bfs102030

Pergunta

Ola galera eu tenho este evento nomeu servidor porem tenho que ficar entrando no Gm todo dia para abrilo-lo e acaba sendo cansativo... eu gostaria de saber se alguem poderia criar um script de globalevent para que ele seja aberto automaticamente todos os dias a X horario e fechado 2 horas depois que iniciou..

Pq ser fechado 2 horas depois de iniciado ?

pq este é um evento onde os players entram numa arena eao se matarem ganham XP..

entao gostaria quue fosse aberto X hora e fechasse depois de x horas que abriu..

atualmente os players entram no evento atraves de um npc que so os teletransporta quando o evento e aberto pelo GM atraves do comando /fps open..

 

segue abaixo tudo que foi instalado no servidor a respeito deste evento.. TFS 0.4

 


 

 

<?xml version="1.0" encoding="UTF-8"?>
<mod name="Jogos Vorazes System" version="1.0" enabled="yes">
<config name="battle-config"><![CDATA[
function msgForOthers(mensagem, classe)
if (not classe) then
classe = MSG_WHITE
end
for _, pid in ipairs(getPlayersOnline()) do
if (getPlayerStorageValue(pid, 5602) == 1) then
doPlayerSendChannelMessage(pid, "", mensagem, classe, FPS_CHANNEL)
end
end
return true
end
function doPlayerRemoveLethalConditions(cid) -- function by Rush Event.
local tmp = {1, 2, 4, 16, 32, 65, 128, 256, 512, 1024, 2048, 4096, 8192, 32768, 65536}
for i = 1, #tmp do
if (hasCondition(cid, tmp)) then
doRemoveCondition(cid, tmp)
end
end
return true
end
function closeEvent(cid)
setGlobalStorageValue(5600, -1)
setGlobalStorageValue(5601, -1)
for _, pid in ipairs(getPlayersOnline()) do
doPlayerSendChannelMessage(pid, "", ""..FPS_EVENTNAME.." foi fechado.", MSG_WHITE, FPS_CHANNEL)
if (getPlayerStorageValue(pid, 5602) == 1) then
doSendMagicEffect(getThingPos(pid), CONST_ME_POFF)
doTeleportThing(pid, getTownTemplePosition(getPlayerTown(cid)))
doSendMagicEffect(getThingPos(pid), CONST_ME_TELEPORT)
doCreatureAddHealth(pid, getCreatureMaxHealth(pid), false)
doCreatureAddMana(pid, getCreatureMaxMana(pid), false)
setPlayerStorageValue(pid, 5601, 0)
setPlayerStorageValue(pid, 5602, 0)
setPlayerStorageValue(pid, 5603, 0)
doPlayerSave(pid)
end
end
setGlobalStorageValue(5602, -1)
return true
end
MSG_WHITE = TALKTYPE_CHANNEL_MANAGEMENT or TALKTYPE_CHANNEL_W
MSG_RED = TALKTYPE_GAMEMASTER_CHANNEL or TALKTYPE_CHANNEL_RN
MSG_ORANGE = TALKTYPE_CHANNEL_ORANGE or TALKTYPE_CHANNEL_O
]]></config>
<talkaction log="yes" words="/fps" event="script"><![CDATA[
domodlib('battle-config')
function onSay(cid, words, param, channel)
if (param == "") then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Error, comando inválido.")
end
if (getPlayerAccess(cid) >= 3) then
if (string.lower(param) == "open") then
if (getGlobalStorageValue(5600) ~= 1) then
setGlobalStorageValue(5600, 1)
if (getGlobalStorageValue(5600) == 1) then
setGlobalStorageValue(5602, 0)
doBroadcastMessage(""..FPS_EVENTNAME.." foi aberto, fale com o NPC 'Jogos Vorazes Manager, Localizado no subsolo do dp de Thais'.", 22)
end
else
return true
end
return true
end
if (string.lower(param) == "close") then
if (getGlobalStorageValue(5600) ~= -1 and getGlobalStorageValue(5601) ~= 1) then
setGlobalStorageValue(5601, 1)
setPlayerStorageValue(cid, 5605, 1)
msgForOthers(""..FPS_FINISHTIME.." segundos restantes.")
addEvent(setPlayerStorageValue, FPS_FINISHTIME * 1000, cid, 5605, -1)
addEvent(closeEvent, FPS_FINISHTIME * 1000, cid)
else
doPlayerPopupFYI(cid, "AVISO :\n"..getCreatureName(cid)..", o portal encontra-se fechado atualmente.\nimpossivel fecha-lo duas vezes.")
return true
end
return true
end
local t = string.explode(param, ",")
local pid = getPlayerByName(t[2])
if (string.lower(t[1]) == "ban") then
if (not t[2] or tonumber(t[2])) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, digite o nome do jogador.")
return true
end
if (not isPlayer(pid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." não existe ou encontra-se off-line.")
return true
end
if (getPlayerStorageValue(pid, 5604) ~= 1) then
if (getPlayerStorageValue(pid, 5602) == 1) then
doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
doSendMagicEffect(getThingPos(pid), CONST_ME_TELEPORT)
setGlobalStorageValue(5602, getGlobalStorageValue(5602)-1)
end
setPlayerStorageValue(pid, 5601, 0)
setPlayerStorageValue(pid, 5602, 0)
setPlayerStorageValue(pid, 5604, 1) -- blocked.
msgForOthers(""..t[2].." foi bloqueado(a).")
local ba_banr = "Admininstrador"
if (FPS_REVEALEDAFTERBANPLAYER) then
ba_banr = ""..getCreatureName(cid)..""
end
doPlayerPopupFYI(pid, "AVISO :\n O "..ba_banr.." bloqueou você.\nvocê está temporariamente bloqueado(a) de participar.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você bloqueou "..t[2]..".")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." já foi bloqueado(a).")
return true
end
return true
end
if (string.lower(t[1]) == "unban") then
if (not t[2] or tonumber(t[2])) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, digite o nome do jogador.")
return true
end
if (not isPlayer(pid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." não existe ou encontra-se off-line.")
return true
end
if (getPlayerStorageValue(pid, 5604) == 1) then
setPlayerStorageValue(pid, 5604, 0) -- unblocked.
msgForOthers(""..t[2].." foi desbloqueado(a).")
doPlayerPopupFYI(pid, "AVISO :\nVocê foi desbloqueado(a).\nparticipe do "..FPS_EVENTNAME.." quando o mesmo estiver disponível.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você desbloqueou "..t[2]..".")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..t[2].." já foi desbloqueado(a).")
return true
end
return true
end
end
local ba_players = "Indisponível"
if (getGlobalStorageValue(5602) ~= -1) then
ba_players = tostring(getGlobalStorageValue(5602))
end
local limiteplayers = ""..ba_players.."/"..FPS_LIMITEPLAYERS..""
if (getGlobalStorageValue(5602) >= FPS_LIMITEPLAYERS) then
limiteplayers = "FULL/"..FPS_LIMITEPLAYERS..""
end
if (string.lower(param) == "status") then
local status = ""..FPS_EVENTNAME.." Status :\nOla "..getCreatureName(cid)..",\nveja algumas informações sobre o(a) "..FPS_EVENTNAME.."."
doShowTextDialog(cid, 2395, ""..status.."\n\nPontos : ("..getPlayerStorageValue(cid, 5601)..")\nJogadores : ["..limiteplayers.."]")
return true
end
return true
end
]]></talkaction>
<event type="preparedeath" name="FPSprepare" event="script"><![CDATA[
domodlib('battle-config')
function onPrepareDeath(cid, deathList)
local target = deathList[1]
if (getGlobalStorageValue(5600) == 1 and getPlayerStorageValue(cid, 5602) == 1) then
local i = 10
doPlayerOpenChannel(cid, FPS_CHANNEL)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
doCreatureAddMana(cid, getCreatureMaxMana(cid))
doTeleportThing(cid, FPS_SPAWNPLAYER[math.random(1, #FPS_SPAWNPLAYER)])
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doPlayerRemoveLethalConditions(cid)
if (isMonster(target)) then
addEvent(doPlayerSendChannelMessage, i, cid, "", ""..getCreatureName(target).." matou você.", MSG_RED, FPS_CHANNEL)
setPlayerStorageValue(cid, 5602, 0)
msgForOthers(""..getCreatureName(target).." matou "..getCreatureName(cid)..".")
setPlayerStorageValue(cid, 5602, 1)
setPlayerStorageValue(cid, 5601, 0)
return false
end
if (not isCreature(target)) then
addEvent(doPlayerSendChannelMessage, i, cid, "", "Voce cometeu suicídio.", MSG_RED, FPS_CHANNEL)
setPlayerStorageValue(cid, 5602, 0)
msgForOthers(""..getCreatureName(cid).." cometeu suicídio.")
setPlayerStorageValue(cid, 5602, 1)
setPlayerStorageValue(cid, 5601, 0)
return false
end
doPlayerOpenChannel(target, FPS_CHANNEL)
setPlayerStorageValue(target, 5601, getPlayerStorageValue(target, 5601)+1)
setPlayerStorageValue(cid, 5602, 0)
setPlayerStorageValue(target, 5602, 0)
msgForOthers(""..getCreatureName(target).." derrotou "..getCreatureName(cid)..".")
setPlayerStorageValue(target, 5602, 1)
setPlayerStorageValue(cid, 5602, 1)
addEvent(doPlayerSendChannelMessage, i, cid, "", ""..getCreatureName(target).." derrotou você.", MSG_RED, FPS_CHANNEL)
addEvent(doPlayerSendChannelMessage, i, target, "", "Você derrotou "..getCreatureName(cid)..".", MSG_ORANGE, FPS_CHANNEL)
dofile("config.lua")
local EXP = 0
if (FPS_ENABLEEXPERIENCE) then
EXP = rateExperience * getPlayerLevel(cid)
doPlayerAddExperience(target, EXP)
end
doSendAnimatedText(getThingPos(target), tostring(EXP), gainExperienceColor)
doPlayerSendTextMessage(target, MESSAGE_STATUS_DEFAULT, "Você ganhou "..EXP.." ponto(s) de experiência.")
setPlayerStorageValue(cid, 5601, 0)
return false
end
return true
end
]]></event>
<event type="logout" name="FPSlogout" event="script"><![CDATA[
domodlib('battle-config')
function onLogout(cid)
if (getGlobalStorageValue(5601) == 1 and getPlayerStorageValue(cid, 5602) == 1 or getPlayerStorageValue(cid, 5605) == 1) then
doPlayerSendCancel(cid, "Aguarde "..FPS_FINISHTIME.." segundo(s).")
return false
end
if(getPlayerStorageValue(cid, 5602) == 1) then
setPlayerStorageValue(cid, 5601, 0)
setPlayerStorageValue(cid, 5602, 0)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doPlayerSendChannelMessage(cid, "", "Você saiu do jogo.", MSG_WHITE, FPS_CHANNEL)
doPlayerRemoveLethalConditions(cid)
doPlayerSave(cid)
if (getPlayerAccess(cid) < 3) then
setGlobalStorageValue(5602, getGlobalStorageValue(5602)-1)
msgForOthers(""..getCreatureName(cid).." saiu do jogo.")
end
return false
end
return true
end
]]></event>
<event type="combat" name="FPScombat" event="script"><![CDATA[
function onCombat(cid, target)
if(FPS_BLOCKIP) then
if (getPlayerIp(cid) == getPlayerIp(target)) then return false end
end
for _, pid in ipairs(getPlayersOnline()) do
if (getGlobalStorageValue(5600) == 1 and getGlobalStorageValue(5601) == 1 and getPlayerStorageValue(pid, 5602) == 1) then
return false
end
end
return true
end
]]></event>
<event type="attack" name="FPSattack" event="script"><![CDATA[
function onAttack(cid, target)
if(FPS_BLOCKIP) then
if (getPlayerIp(cid) == getPlayerIp(target)) then return false end
end
for _, pid in ipairs(getPlayersOnline()) do
if (getGlobalStorageValue(5600) == 1 and getGlobalStorageValue(5601) == 1 and getPlayerStorageValue(pid, 5602) == 1) then
return false
end
end
return true
end
]]></event>
<event type="login" name="FPSlogin" event="buffer"><![CDATA[
if (getPlayerStorageValue(cid, 5601) == -1) then
setPlayerStorageValue(cid, 5601, 0)
end
registerCreatureEvent(cid, "FPSprepare")
registerCreatureEvent(cid, "FPSlogout")
registerCreatureEvent(cid, "FPScombat")
registerCreatureEvent(cid, "PFSattack")
registerCreatureEvent(cid, "PFScast")
]]></event>
<globalevent name="FPS tips" interval="600000" event="script"><![CDATA[
domodlib('battle-config')
function onThink(interval)
local FPS_tips = {
"Atualmente existem "..getGlobalStorageValue(5602).." player(s) lutando, não deixe de participar.",
"Com o canal fechado, você não recebe informações dentro do jogo. deixe-o sempre aberto.",
"Cuidado ao ofender um jogador, você corre o risco de ser bloqueado(a).",
"Aperte 'CTRL + Q' caso você queira sair do jogo, você precisa está em protection zone.",
"Chame seus amigos e venha jogar, porquê aqui a diversão nunca acaba.",
"Dica : configure o comando '/fps status' como hotkey. Assim você poderá checar suas informações com facilidade."
}
if (getGlobalStorageValue(5600) == 1) then
msgForOthers(FPS_tips[math.random(1, #FPS_tips)])
end
return true
end
]]></globalevent>
</mod>

 

 

 

data/Lib

 

 

 

--[[
'Jogos Vorazes' desenvolvido por Bruninho.
]]
FPS_EVENTNAME = "Jogos Vorazes" -- Nome do evento.
FPS_FINISHTIME = 1 -- Dentro do evento, jogadores não poderão atacar uns aos outros enquanto esse tempo não esgotar após o comando /fps close ser executado.
FPS_LIMITEPLAYERS = 26 -- Limite de jogadores.
FPS_SHOWGODNAMEAFTERBAN = false -- true = Mostra o nome do GM na mensagem do banido; false = Mostra o nome 'Admininstrador'.
FPS_ENABLEEXPERIENCE = true -- true = Habilita a experiência; false = Desabilita.
FPS_BLOCKIP = false -- true = Jogadores que tentarem usar MC pra ganhar exp fácil, não conseguirão atacar seus próprios chars; false = permite isso.
FPS_CHANNEL = 15 -- ID do Battle Arena Channel.
FPS_SPAWNPLAYER = {
{x = 32145, y = 32127, z = 6},
{x = 32133, y = 32115, z = 6},
{x = 32156, y = 32116, z = 6},
{x = 32145, y = 32155, z = 6},
{x = 32136, y = 32149, z = 6},
{x = 32154, y = 32149, z = 6},
{x = 32144, y = 32103, z = 6}
}

 

 

 

Data/Npc.xml

 

 

 

<?xml version="1.0"?>
<npc name="Jogos Vorazes Manager" floorchange="0" walkinterval="2000">
<health now="150" max="150"/>
<look type="266"/>
<interaction range="3" idletime="30" idleinterval="1500" defaultpublic="0">
<interact keywords="hi" focus="1">
<action name="script" value="hello"/>
<response><action name="script"><![CDATA[
local str = "Olá "..getCreatureName(cid)..""
if (getGlobalStorageValue(5600) ~= 1) then
selfSay(""..str..", infelizmente estamos indisponível. {bye}!", cid)
else
selfSay("Tem "..getGlobalStorageValue(5602).." player(s) lá dentro, deseja {Participar}?", cid)
return true
end
]]></action>
<interact keywords="participar">
<action name="script" value="join"/>
<response><action name="script"><![CDATA[
if (getGlobalStorageValue(5600) ~= 1) then
return true
end
if (getPlayerStorageValue(cid, 5604) == 1) then
selfSay("Sinto muito, você está temporariamente bloqueado(a).", cid)
return true
end
doPlayerOpenChannel(cid, FPS_CHANNEL)
selfSay("Confirme : {Ok} ou {Cancelar}?", cid)
]]></action>
<interact keywords="ok">
<action name="script" value="ok"/>
<response><action name="script"><![CDATA[
if (getGlobalStorageValue(5600) ~= 1) then
return true
end
if (getGlobalStorageValue(5601) == 1) then
selfSay("Já iremos fechar, volte outro dia!", cid)
return true
end
if (getGlobalStorageValue(5602) >= FPS_LIMITEPLAYERS and getPlayerAccess(cid) < 3) then
selfSay("Limite de jogadores alcançado, aguarde até que alguém saia.", cid)
return true
end
selfSay("Boa sorte!", cid)
if (getPlayerStorageValue(cid, 5602) ~= 1) then
domodlib('battle-config')
doPlayerSendChannelMessage(cid,"", "Você está participando do jogo.", MSG_WHITE, FPS_CHANNEL)
if (getPlayerAccess(cid) < 3) then
setGlobalStorageValue(5602, getGlobalStorageValue(5602)+1)
msgForOthers(""..getCreatureName(cid).." está participando do jogo.")
end
setPlayerStorageValue(cid, 5602, 1)
end
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doTeleportThing(cid, FPS_SPAWNPLAYER[math.random(1, #FPS_SPAWNPLAYER)])
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doPlayerOpenChannel(cid, FPS_CHANNEL)
]]></action></response>
</interact>
<interact keywords="cancelar" focus="0">
<response text="Okay {|NAME|}, volte quando puder!"/>
</interact>
</response>
</interact>
<interact keywords="bye" focus="0">
<response text="Tchau, até breve!"/>
</interact>
</response>
</interact>
<interact event="onPlayerLeave" focus="0">
<response text="How rude!" public="1"/>
</interact>
</interaction>
</npc>

 

 

 

Data / Xml / Channels

 

 

 

<channel id="15" name="Battle Arena Channel"/>

 

 

 

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

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

×
×
  • Criar Novo...