Hey guys! First of all I'd like to say hi! I'm Matt, a server owner and I need some help with something!
I have looked on garry's mod lua wiki and I have found parts to this, but I just can't put them together!
In garrysmod/lua/autorun/server I have a little script of mine that contains: timer.Create("automapchanger", 900, function() RunConsoleCommand("mapvote") end)
What I would like to do with this is:
Add a broadcast 10 minutes before the mapvote saying: (In red)[Anonymous] (In white) 10 minutes until next map vote!
Add a broadcast 5 minutes before the mapvote saying: (In red)[Anonymous] (In white) 5 minutes until next map vote!
If you could help me with this, please do so in the comments below!
Thanks,
Matt
Try this
[LUA]
timer.Create("automapchanger", 900, function()
RunConsoleCommand("mapvote")
end)
timer.Create("automapchanger10min", 300, function()
for k,v in pairs(player.GetAll()) do
v:SendLua("chat.AddText(Color(255, 0, 0), '[Anonymous]', Color(255, 255, 255), '10 minutes until next map vote!')")
end
end)
timer.Create("automapchanger5min", 600, function()
for k,v in pairs(player.GetAll()) do
v:SendLua("chat.AddText(Color(255, 0, 0), '[Anonymous]', Color(255, 255, 255), '5 minutes until next map vote!')")
end
end)
[/LUA]
[QUOTE=rtm516;50366658]Try this
[LUA]
timer.Create("automapchanger", 900, function()
RunConsoleCommand("mapvote")
end)
timer.Create("automapchanger10min", 300, function()
for k,v in pairs(player.GetAll()) do
v:SendLua("chat.AddText(Color(255, 0, 0), '[Anonymous]', Color(255, 255, 255), '10 minutes until next map vote!')")
end
end)
timer.Create("automapchanger5min", 600, function()
for k,v in pairs(player.GetAll()) do
v:SendLua("chat.AddText(Color(255, 0, 0), '[Anonymous]', Color(255, 255, 255), '5 minutes until next map vote!')")
end
end)
[/LUA][/QUOTE]
Thank you very much! :)
[editline]24th May 2016[/editline]
[QUOTE=rtm516;50366658]Try this
[LUA]
timer.Create("automapchanger", 900, function()
RunConsoleCommand("mapvote")
end)
timer.Create("automapchanger10min", 300, function()
for k,v in pairs(player.GetAll()) do
v:SendLua("chat.AddText(Color(255, 0, 0), '[Anonymous]', Color(255, 255, 255), '10 minutes until next map vote!')")
end
end)
timer.Create("automapchanger5min", 600, function()
for k,v in pairs(player.GetAll()) do
v:SendLua("chat.AddText(Color(255, 0, 0), '[Anonymous]', Color(255, 255, 255), '5 minutes until next map vote!')")
end
end)
[/LUA][/QUOTE]
Wait no, it repeats it two times.
It says on the 5 minutes one:
[Anonymous]10 minutes until next map vote!
[Anonymous]5 minutes until next map vote!
Can you fix this?
[editline]24th May 2016[/editline]
[QUOTE=rtm516;50366658]Try this
[LUA]
timer.Create("automapchanger", 900, function()
RunConsoleCommand("mapvote")
end)
timer.Create("automapchanger10min", 300, function()
for k,v in pairs(player.GetAll()) do
v:SendLua("chat.AddText(Color(255, 0, 0), '[Anonymous]', Color(255, 255, 255), '10 minutes until next map vote!')")
end
end)
timer.Create("automapchanger5min", 600, function()
for k,v in pairs(player.GetAll()) do
v:SendLua("chat.AddText(Color(255, 0, 0), '[Anonymous]', Color(255, 255, 255), '5 minutes until next map vote!')")
end
end)
[/LUA][/QUOTE]
Fixed it!
Instead of running it infinitely, run it once and because of the map restart, it resets timers. Thanks alot dude!
Sorry, you need to Log In to post a reply to this thread.