Garry's Mod

Garry's Mod

RP Retribution
doUbleU 6. mar. 2015 kl. 1:27
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.
Sidst redigeret af doUbleU; 17. feb. 2016 kl. 18:23
< >
Viser 1-14 af 14 kommentarer
♥AkariVixen♥ 19. mar. 2015 kl. 7:08 
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  [udvikler] 23. juni 2015 kl. 23:15 
thanks for posting this
Fantastic Mr. Fox 16. dec. 2015 kl. 4:17 
what do i need to enter the console by this?
Lortedo 2. feb. 2016 kl. 4:51 
The subway and elevators works now, good job and thanks ! :p
Fantastic Mr. Fox 3. feb. 2016 kl. 10:54 
What should I do exactly?
Where and what is /lua/autorun/server/
doUbleU 4. feb. 2016 kl. 19:15 
Oprindeligt skrevet af 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.
Fantastic Mr. Fox 8. feb. 2016 kl. 7:19 
Oprindeligt skrevet af doUbleU:
Oprindeligt skrevet af 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 kl. 13:02 
Oprindeligt skrevet af Corporelax:
Oprindeligt skrevet af 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 kl. 0:45 
Oprindeligt skrevet af doUbleU:
Oprindeligt skrevet af 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 kl. 11:11 
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 kl. 18:24 
I found the last elevator you guys were talking about.
I added it to the script in the OP.
Fennecs are cute :3 20. feb. 2016 kl. 13:19 
Oprindeligt skrevet af 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 kl. 13:24 
Oprindeligt skrevet af 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.
Sidst redigeret af doUbleU; 20. feb. 2016 kl. 16:00
Michael McMange 18. dec. 2016 kl. 13:08 
i put this in but the train dosent work?? Or am i not doing something right
< >
Viser 1-14 af 14 kommentarer
Per side: 1530 50