hi I've been making a notice system yust for fun but I'm getting the error
Unexpected symbol near ".." line 17 this is my code:
[lua]Notice ={
"Serious Lion is coding",
"you can't kill yourself",
"why don't you test this shitty notice code in a sandbox",
"I love to work with timers",
"hopfully it works",
"sm69baller is on holliday",
"frankenstain is een janet zegt zen broere",
"haveing fun with tables"
}
for i=1, 8 do
math.random(1, 8)
end
function notice()
BroadcastLua( chat.AddText(Color( 148, 181, 255), "[Notice] ", Color(255, 255, 255), ..Notice[i].."\n" )
end
timer.Create( "Noticetext", 1, 0, notice )
end
function GM:PlayerInitialSpawn()
timer.Start("Noticetext")
end[/lua]
Here's a revised version.
[lua]
--This file should only run on the client, but the server has to send it to the client.
if SERVER then
AddCSLuaFile("ThisFile'sName.lua")
return
end
--'local' keeps the table name visible in this file only. This increases performance.
local Notice = {
"Serious Lion is coding",
"you can't kill yourself",
"why don't you test this shitty notice code in a sandbox",
"I love to work with timers",
"hopfully it works",
"sm69baller is on holliday",
"frankenstain is een janet zegt zen broere",
"haveing fun with tables"
}
--Add a hook to Initialize since function GM:PlayerInitialSpawn is server-only and doing that overwrites the default GM:PlayerInitialSpawn function.
hook.Add("Initialize", "NoticeThing", function(ply)
local function notice()
local noticestring = Notice[math.random(#Notice)]
chat.AddText(Color(148, 181, 255), "[Notice] ", Color(255, 255, 255), noticestring)
end
timer.Create( "Noticetext", 10, 0, notice)
end)
[/lua]
of course and thx for the help
Sorry, you need to Log In to post a reply to this thread.