• 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!

Lua What is wrong with this script?

Ecstacy

Mothafuckaaa
Joined
Dec 26, 2008
Messages
3,836
Reaction score
108
Location
The Netherlands
Hello,

Could anyone tell me why this doesn't work, while it works when just putting the messages on local?
I also tried it like

LUA:
Config = {
message 1 = "..
message 2 = "..
}

but also doesn't work


Anyways, here is the script.
LUA:
local broadcastMessage = {
	message1 = {
		text ="Welcome to MavrikOt..Please read the !help and !rules. And to buy donation items go on [url]http://mavrik.hopto.org/?subtopic=buypoints[/url] to buy donation points!"
	}
	message2 = {
		text = "For Egyptians: Law inta masry w 3ayez tesh7en 3la el server b kroot sha7n vodafone, etisalat, mobinil..Personal Message Admin Youssef w howa hay2olak el 5atawat."
	}
	message3 = { 
		text = "For Dutchies: Welkom bij MavrikOT! Lees alsjeblieft eerst de regels !rules en !help. Om te doneren ga dan naar [url]http://mavrik.hopto.org/?subtopic=buypoints[/url] om donator points te kopen!"
	}
	message4 = { 
		text = "Do not be fooled by players pretending to be staff. Staff members NEVER ask for your account Information. So, DO NOT give your Account information to anyone at all, Do Not. We are not responsible if you act stupid."
	}
}

function onThink(interval, lastExecution) 
    doBroadcastMessage(broadcastMessage.message1.text, MESSAGE_BROADCAST)
	doBroadcastMessage(broadcastMessage.message2.text, MESSAGE_BROADCAST)
	doBroadcastMessage(broadcastMessage.message3.text, MESSAGE_BROADCAST)
	doBroadcastMessage(broadcastMessage.message4.text, MESSAGE_BROADCAST)
return TRUE 
end

This is the error message:

Code:
[27/09/2009 23:37:35] [Warning - Event::loadScript] Cannot load script (data/globalevents/scripts/messages.lua)
[27/09/2009 23:37:35] data/globalevents/scripts/messages.lua:5: '}' expected (to close '{' at line 1) near 'message2'
[27/09/2009 23:37:35] Reloaded global events.

Thanks,
unknown666
 
Code:
local messages = {
                "Welcome to MavrikOt..Please read the !help and !rules. And to buy donation items go on [url]http://mavrik.hopto.org/?subtopic=buypoints[/url] to buy donation points!",
                "For Egyptians: Law inta masry w 3ayez tesh7en 3la el server b kroot sha7n vodafone, etisalat, mobinil..Personal Message Admin Youssef w howa hay2olak el 5atawat.",
                "For Dutchies: Welkom bij MavrikOT! Lees alsjeblieft eerst de regels !rules en !help. Om te doneren ga dan naar [url]http://mavrik.hopto.org/?subtopic=buypoints[/url] om donator points te kopen!",
                "Do not be fooled by players pretending to be staff. Staff members NEVER ask for your account Information. So, DO NOT give your Account information to anyone at all, Do Not. We are not responsible if you act stupid."
}

function onThink(interval, lastExecution)
	for i = 1, #messages do
		doBroadcastMessage(messages[i], MESSAGE_STATUS_WARNING)
	end
	return TRUE
end
 
Code:
[27/09/2009 23:50:49] data/lib/function.lua:401: attempt to concatenate local 'text' (a table value)
[27/09/2009 23:50:49] stack traceback:
[27/09/2009 23:50:49] 	data/lib/function.lua:401: in function 'doBroadcastMessage'
[27/09/2009 23:50:49] 	data/globalevents/scripts/messages.lua:10: in function <data/globalevents/scripts/messages.lua:8>
[27/09/2009 23:50:49] [Error - GlobalEvents::think] Couldn't execute event: broadcast messages

It doesn't work, shows me empty text, and may I ask:
What does i = 1 stand for?
 
for i = 1, #messages do mean:

"Define new var called "i" whit value 1, then increase it by 1 while we have not reached the total amount of items in the array mesages"
 
Back
Top