some one help me, everytime need open event zombie use!zombie start like Talkaction.
how can work in globalevents
0.4
<talkaction log="yes" words="/zombiestart" access="4" event="script" value="zombie/onsay.lua"/>
<globalevent name="ZombieGlobalThink" interval="5000" event="script" value="zombie/onthink.lua"/>
<globalevent name="ZombieGlobalStartup" type="start" event="script" value="zombie/onstartup.lua"/>
how can work in globalevents
0.4
Lua:
function onSay(cid, words, param, channel)
if(getStorage(ZE_STATUS) ~= 2) then
local players_on_arena_count = #getZombiesEventPlayers()
if(param == 'force') then
if(players_on_arena_count > 0) then
setZombiesEventPlayersLimit(players_on_arena_count )
addZombiesEventBlockEnterPosition()
doSetStorage(ZE_STATUS, 2)
doBroadcastMessage("Zombie Arena Event started.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Zombies event started.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot start Zombies event. There is no players on arena.")
end
else
if(param ~= '' and tonumber(param) > 0) then
setZombiesEventPlayersLimit(tonumber(param))
end
removeZombiesEventBlockEnterPosition()
doSetStorage(ZE_STATUS, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Event started.")
doPlayerBroadcastMessage(cid, "Zombie Arena Event teleport is opened. We are waiting for " .. getZombiesEventPlayersLimit() - players_on_arena_count .. " players to start.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Zombies event is already running.")
end
return true
end
<talkaction log="yes" words="/zombiestart" access="4" event="script" value="zombie/onsay.lua"/>
<globalevent name="ZombieGlobalThink" interval="5000" event="script" value="zombie/onthink.lua"/>
<globalevent name="ZombieGlobalStartup" type="start" event="script" value="zombie/onstartup.lua"/>
Lua:
function onThink(interval, lastExecution, thinkInterval)
if(getStorage(ZE_STATUS) == 2) then
setZombiesToSpawnCount(getZombiesToSpawnCount()+1)
local players = getZombiesEventPlayers()
for i=1, getZombiesToSpawnCount() * 2 do
if(getZombiesToSpawnCount() > 0 and spawnNewZombie()) then
setZombiesToSpawnCount(getZombiesToSpawnCount()-1)
end
end
end
return true
end
Code:
function onStartup()
db.executeQuery("UPDATE `player_storage` SET `value` = 0 WHERE `key` = " .. ZE_isOnZombieArea .. ";")
doSetStorage(ZE_STATUS, 0)
doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS)
doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0)
doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
addZombiesEventBlockEnterPosition()
return true
end
Last edited: