Garry's Mod

Garry's Mod

Not enough ratings
Auto Start Red Light / Green Light
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Server content
Addon Tags: Fun
File Size
Posted
878.000 B
24 Oct, 2021 @ 8:56am
1 Change Note ( view )

Subscribe to download
Auto Start Red Light / Green Light

Description
Why was this even made?
For lazy people that don't want to noclip to the host area to start the map or use ent_fire via the console.

Explain the code. I don't trust it.
It's very fair to not trust Lua code posted by someone random on the workshop and that's good you question it. Below I have taken out the code that's in the addon. Feel free to use a workshop downloader to confirm it.

The first two local is just to make it easier if you now want to edit the time for the game to start or disable it.
The hook "Initialize" is used when you load into a game/server. game.GetMap is there to make sure the script runs most of the code just on my map. Print() displays a message in your console and others. The if statement checks if it should run or not. Then after that, it looks up the button for two entities in the map and issues a use (its like when you would press E on a door or button)

Hope I have explained the code so you can trust it :)


local automate = true
local timeforautomation = "10"

hook.Add("Initialize", "Automatedsquidmap", function()
if (game.GetMap() == "squid_game_redlightgreenlight") then
print("Loading automate script")
timer.Simple(timeforautomation, function()
if automate == true then
for k, v in pairs(ents.FindByName("autogamebutton")) do
v:Fire("use")
end

for k, v in pairs(ents.FindByName("openclosewall")) do
v:Fire("use")
end
end
print("Squid Game Have Started. Good Luck")
end)
end
end)