Garry's Mod

Garry's Mod

RP Retribution
doUbleU 6 Mar, 2015 @ 1:27am
Script to trigger subway and elevators
To prevent having to enable cheats just to run 'ent_fire', here's a script you can put in a file in /lua/autorun/server/


function InitializeTrans()
local mapname = game.GetMap()

if mapname == "rp_retribution_v2" then
timer.Create( "InitTrans", 30, 1, function()
ents.FindByName("train")[1]:Fire("toggle")
ents.FindByName("CH Elevator")[1]:Fire("Press")
ents.FindByName("Tenoh Elevator")[1]:Fire("Press")
ents.FindByName("Tenoh Elevator1")[1]:Fire("Press")
end)
end
end
hook.Add( "Initialize", "Trigger train and elevators on map start.", InitializeTrans )


This starts a 30 second timer when the server starts, to give everything enough time to load.
On expiration, it triggers the train and the elevators so you can use them without running console wizardry every time the server starts up.
Last edited by doUbleU; 17 Feb, 2016 @ 6:23pm
< >
Showing 1-14 of 14 comments
Thanks! I'll try this when I get the chance. I gave up on trying to fix these manuallyevery time I reloaded the map :P
Asuka Langley Soryu  [developer] 23 Jun, 2015 @ 11:15pm 
thanks for posting this
Fantastic Mr. Fox 16 Dec, 2015 @ 4:17am 
what do i need to enter the console by this?
Lortedo 2 Feb, 2016 @ 4:51am 
The subway and elevators works now, good job and thanks ! :p
Fantastic Mr. Fox 3 Feb, 2016 @ 10:54am 
What should I do exactly?
Where and what is /lua/autorun/server/
doUbleU 4 Feb, 2016 @ 7:15pm 
Originally posted by Corporelax:
What should I do exactly?
Where and what is /lua/autorun/server/
In the 'garrysmod' folder on your server, it's folder named 'lua', then 'autorun', then 'server'.
In the 'server' folder, create a .lua file with any name and place the above lines of code in it.

This location will make sure that the script is loaded automaticlly when the server starts and everything should work as intended.
Originally posted by doUbleU:
Originally posted by Corporelax:
What should I do exactly?
Where and what is /lua/autorun/server/
In the 'garrysmod' folder on your server, it's folder named 'lua', then 'autorun', then 'server'.
In the 'server' folder, create a .lua file with any name and place the above lines of code in it.

This location will make sure that the script is loaded automaticlly when the server starts and everything should work as intended.
And what do i need to enter the console manually?
doUbleU 8 Feb, 2016 @ 1:02pm 
Originally posted by Corporelax:
Originally posted by doUbleU:
In the 'garrysmod' folder on your server, it's folder named 'lua', then 'autorun', then 'server'.
In the 'server' folder, create a .lua file with any name and place the above lines of code in it.

This location will make sure that the script is loaded automaticlly when the server starts and everything should work as intended.
And what do i need to enter the console manually?
Nothing. When the server starts, everything is done automatically.
Fantastic Mr. Fox 9 Feb, 2016 @ 12:45am 
Originally posted by doUbleU:
Originally posted by Corporelax:
And what do i need to enter the console manually?
Nothing. When the server starts, everything is done automatically.
Well I don't know what to put on console I'll just bind the script in my keyboard
MoNtEcRiStO 11 Feb, 2016 @ 11:11am 
Exact Oxy, we miss the class_name of the elevator with the blue window...

I ask many friend have server with the same map and nobody know what that class name.

So you have to activated it manualy at the last stage in noclip mod, for each restart.

If sombody find this class_name many person gonna appreciat that!
doUbleU 17 Feb, 2016 @ 6:24pm 
I found the last elevator you guys were talking about.
I added it to the script in the OP.
Originally posted by doUbleU:
To prevent having to enable cheats just to run 'ent_fire', here's a script you can put in a file in /lua/autorun/server/


function InitializeTrans()
local mapname = game.GetMap()

if mapname == "rp_retribution_v2" then
timer.Create( "InitTrans", 30, 1, function()
ents.FindByName("train")[1]:Fire("toggle")
ents.FindByName("CH Elevator")[1]:Fire("Press")
ents.FindByName("Tenoh Elevator")[1]:Fire("Press")
ents.FindByName("Tenoh Elevator1")[1]:Fire("Press")
end)
end
end
hook.Add( "Initialize", "Trigger train and elevators on map start.", InitializeTrans )


This starts a 30 second timer when the server starts, to give everything enough time to load.
On expiration, it triggers the train and the elevators so you can use them without running console wizardry every time the server starts up.


Where do we put the script ? Please.
doUbleU 20 Feb, 2016 @ 1:24pm 
Originally posted by doUbleU:
here's a script you can put in a file in /lua/autorun/server/

/garrysmod/
--- lua/
------ autorun/
--------- server/
------------ [somefilename].lua

If that still doesn't make sense, read this[wiki.garrysmod.com], particularly Auto Running the Script.
Last edited by doUbleU; 20 Feb, 2016 @ 4:00pm
Michael McMange 18 Dec, 2016 @ 1:08pm 
i put this in but the train dosent work?? Or am i not doing something right
< >
Showing 1-14 of 14 comments
Per page: 1530 50