Ir para conteúdo
  • Cadastre-se

Posts Recomendados

olá eu to usando uma script de FireStormEvent, com horario Automatico.

Na distro aparece isso

[Error - GlobalEvents::timer] Couldn't execute event: fireStormTime

e o a .lua do arquico é essa.

 

<?xml version="1.0" encoding="ISO-8859-1"?>

<mod name="Fire Storm Event" enabled="yes">
<config name="fireStorm_conf"><![CDATA[
fireStormRewards = {
random = false,
rew = {2160,30,2494,1,2495,1 }
}
fireStormShootInterval = 8 --in seconds
fireStormNewFireShoots = 15
fireStormBaseFireShoots = 40
fireStormMaxPlayers = 2
fireStormMinPlayers = 1
fireStormAccesToIgnore = 5
timeOnJoinToEvent = 2 --in minutes
 
fireStormJoinType = 'booth' --movement, talkaction or booth
enableMessage = true
 
-- POSITIONS
fireStormKickPosition = {x=160,y=54,z=7}
fireStormEnterPosition = {x=818,y=1000,z=7}
 
fireStormCenterRoomPosition = {x=818,y=1000,z=7}
fireStormRangeX_RangeY = {51,50}
-- STORAGES
fireStormStorageStatus = 31000 -- =< 0 - off, 1 - waiting for players, 2 - is running
 
local _f = doTeleportThing
function doTeleportThing(cid, newpos, ignoreBlocking)
return (ignoreBlocking or isWalkable(newpos, true, true, false) or false) and _f(cid, newpos, true, true)
end
 
function kickPlayerFromFireStormArea(cid)
doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
doTeleportThing(cid, fireStormKickPosition, true)
doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
return doCreatureSetStorage(cid, fireStormStorageStatus, 0) and doCreatureSetNoMove(cid, false)
end
 
function getFireStormEventPlayers()
local players = {}
for _, cid in pairs(getPlayersOnline()) do
if getCreatureStorage(cid, fireStormStorageStatus) == 1 then
table.insert(players, cid)
end
end
return players
end
 
function isWalkable(pos, creature, proj, pz)
if getTileThingByPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
 
function loseOnFireStorm(cid)
    local players, msg = getFireStormEventPlayers(), ''
    kickPlayerFromFireStormArea(cid)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You are dead.')
    if(#getFireStormEventPlayers() <= 1) then
        local winner = getFireStormEventPlayers()[1] or players[1]
        if winner then
            if fireStormRewards.random then
local i = math.random(#fireStormRewards.rew/2)
doPlayerAddItem(winner, fireStormRewards.rew[i*2-1], fireStormRewards.rew[i*2], true)
else
for i = 1, #fireStormRewards.rew/2 do
doPlayerAddItem(winner, fireStormRewards.rew[i*2-1], fireStormRewards.rew[i*2], true)
end
end
doPlayerSendTextMessage(winner, MESSAGE_INFO_DESCR, 'You won Fire Storm Event.')
            msg = getCreatureName(winner) .. ' won Fire Storm Event.'
            kickPlayerFromFireStormArea(winner)
if getSpectators(fireStormCenterRoomPosition, fireStormRangeX_RangeY[1], fireStormRangeX_RangeY[2]) then
for _, v in ipairs(getSpectators(fireStormCenterRoomPosition, fireStormRangeX_RangeY[1], fireStormRangeX_RangeY[2])) do
if isMonster(v) then
doRemoveThing(v)
elseif isPlayer(v) then
kickPlayerFromFireStormArea(v)
end
end
end
        else
            msg = 'Fire Storm Event finished! No one win!'
        end
doSetStorage(fireStormStorageStatus, 0)
    end
return (msg ~= '' and doBroadcastMessage(msg) or true)
end
 
function spawnNewFire(count, reserved)
for i = 1, count do
if getStorage(fireStormStorageStatus) <= 1 then
return true
end
local pos = {x = fireStormCenterRoomPosition.x + math.random(-fireStormRangeX_RangeY[1],fireStormRangeX_RangeY[1]), y = fireStormCenterRoomPosition.y + math.random(-fireStormRangeX_RangeY[2],fireStormRangeX_RangeY[2]), z = fireStormCenterRoomPosition.z}
if i == count then
return addEvent(spawnNewFire, fireStormShootInterval*1000, fireStormNewFireShoots + reserved, fireStormNewFireShoots + reserved)
end
if isWalkable(pos, false, true, true) then
addEvent(function()
if #getFireStormEventPlayers() < 1 then
return true
end
local xx = math.abs(pos.x - fireStormCenterRoomPosition.x) + fireStormRangeX_RangeY[1]
local yy = math.abs(pos.y - fireStormCenterRoomPosition.y) + fireStormRangeX_RangeY[2]
doSendDistanceShoot({x=pos.x-xx,y=pos.y-yy,z=pos.z}, pos, CONST_ANI_FIRE)
addEvent(doSendMagicEffect, math.max(xx,yy)*15, pos, CONST_ME_HITBYFIRE)
local player = getThingFromPos({x=pos.x,y=pos.y,z=pos.z,stackpos=STACKPOS_TOP_CREATURE}).uid
if isPlayer(player) and getPlayerAccess(player) < fireStormAccesToIgnore then
addEvent(loseOnFireStorm, 500, player)
end return true end,
math.random(500, fireStormShootInterval*1000),
pos)
else
return spawnNewFire(count-(i-1), math.max(reserved, count))
end
end
return true
end
 
function addPlayerToFireStormArea(cid, block)
doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
doTeleportThing(cid, fireStormEnterPosition, true)
doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
return doCreatureSetStorage(cid, fireStormStorageStatus, 1) and doCreatureSetNoMove(cid, block)
end
 
function startFireStormEvent()
if getStorage(fireStormStorageStatus) > 0 then
return false
end
doSetStorage(fireStormStorageStatus, 1)
return enableMessage and doBroadcastMessage('Fire Storm Event is active. We are waiting for ' .. fireStormMaxPlayers - #getFireStormEventPlayers() .. ' players or, if not found, '..timeOnJoinToEvent..' minutes to start. If you want joined to event just use command "!fire join", but if you would leave fire storm arena just say "!fire leave". Have fun!') or true
end
]]></config>
 
<talkaction words='!fire' event='script'><![CDATA[
domodlib('fireStorm_conf')
function onSay(cid, words, param, channel)
if fireStormJoinType == 'movement' then
return false end
local msg = ''
if isInArray({'join','add','go','joined'}, param:lower()) then
if getCreatureCondition(cid, CONDITION_INFIGHT) and getPlayerAccess(cid) <= fireStormAccesToIgnore then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have a PZ! You have to get rid of it. Somehow.')
end
if getPlayerAccess(cid) >= fireStormAccesToIgnore then
startFireStormEvent()
return doTeleportThing(cid, fireStormEnterPosition, true)
elseif #getFireStormEventPlayers() < fireStormMaxPlayers and getStorage(fireStormStorageStatus) == 1 then
addPlayerToFireStormArea(cid, true)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are player of number '..#getFireStormEventPlayers()..', which join to event.')
if #getFireStormEventPlayers() == fireStormMaxPlayers then
doSetStorage(fireStormStorageStatus, 2)
addEvent(spawnNewFire, fireStormShootInterval * 1000, fireStormBaseFireShoots, fireStormBaseFireShoots)
for _, v in pairs(getFireStormEventPlayers()) do
addPlayerToFireStormArea(v, false)
end
msg = 'Fire Storm Event is started. We have ' .. fireStormMaxPlayers .. ' players, which joined to event. Have fun!'
else
msg = getCreatureName(cid) .. ' has entered a Fire Storm Arena. We still need ' .. fireStormMaxPlayers - #getFireStormEventPlayers() .. ' players.'
end
return (msg ~= '' and doBroadcastMessage(msg) or true)
else
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Arena is full.')
end
elseif isInArray({'leave','abort','delete'}, param:lower()) then
if getStorage(fireStormStorageStatus) < 2 then
doCreatureSetNoMove(cid, false)
doCreatureSetStorage(cid, fireStormStorageStatus, 0)
return doTeleportThing(cid, getCreatureLastPosition(cid), true)
end
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You can\'t leave from arena if event is already running.')
end
return true
end
]]></talkaction>
 
<globalevent name="fireStormTime" time="02:17" event="script"><![CDATA[
domodlib("fireStorm_conf")
function onTime(time)
addEvent(function()
if getStorage(fireStormStorageStatus) == 2 then return true end
if getStorage(fireStormStorageStatus) == 1 and #getFireStormEventPlayers() >= fireStormMinPlayers then
doSetStorage(fireStormStorageStatus, 2)
addEvent(spawnNewFire, fireStormShootInterval * 1000, fireStormBaseFireShoots, fireStormBaseFireShoots)
for _, v in ipairs(getFireStormEventPlayers()) do
addPlayerToFireStormArea(v, false)
end
return enableMessage and doBroadcastMessage('Fire Storm Event is started. We have '..#getFireStormEventPlayers()..' players on area') or true
end
for _, v in ipairs(getFireStormEventPlayers()) do
kickPlayerFromFireStormArea(v)
end
return enableMessage and doBroadcastMessage('Fire Storm Event is stopped. We could not find enough players.') or true
end,
timeOnJoinToEvent * 1000 * 60)
return startFireStormEvent()
end
]]></globalevent>
</mod>

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo