• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Talkaction > Globalevent, Help

Death Blower

I'm Ready.
Joined
Aug 19, 2011
Messages
49
Reaction score
3
I have this talkaction script for a zombieevent, I wanted the zombieevent to start on its own without the talkaction.

Code:
function onThink(interval, lastExecution, thinkInterval)
	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

Thats the script that I want to be a globalevent, The error I get is:
Code:
[26/02/2012 12:56:43] [Error - GlobalEvent Interface] 
[26/02/2012 12:56:43] data/globalevents/scripts/zombie/zombiestart.lua:onThink
[26/02/2012 12:56:43] Description: 
[26/02/2012 12:56:43] data/globalevents/scripts/zombie/zombiestart.lua:15: attempt to compare number with nil
[26/02/2012 12:56:43] stack traceback:
[26/02/2012 12:56:43] 	data/globalevents/scripts/zombie/zombiestart.lua:15: in function <data/globalevents/scripts/zombie/zombiestart.lua:1>
[26/02/2012 12:56:43] [Error - GlobalEvents::think] Couldn't execute event: ZombieStart

Rep++ to whoever helps :D.
 
You're attempting to compare a number with 0. Dunno how to fix it tho, maybe changing to true or false?
 
talkactions?

function main wrong

Code:
function onThink(interval, lastExecution, thinkInterval)

would be the correct

Code:
function onSay(cid, words, param)
 
Back
Top