Garry's Mod

Garry's Mod

RP Retribution
doUbleU 2015 年 3 月 6 日 上午 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.
最后由 doUbleU 编辑于; 2016 年 2 月 17 日 下午 6:23
< >
正在显示第 1 - 14 条,共 14 条留言
♥AkariVixen♥ 2015 年 3 月 19 日 上午 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  [开发者] 2015 年 6 月 23 日 下午 11:15 
thanks for posting this
Fantastic Mr. Fox 2015 年 12 月 16 日 上午 4:17 
what do i need to enter the console by this?
Lortedo 2016 年 2 月 2 日 上午 4:51 
The subway and elevators works now, good job and thanks ! :p
Fantastic Mr. Fox 2016 年 2 月 3 日 上午 10:54 
What should I do exactly?
Where and what is /lua/autorun/server/
doUbleU 2016 年 2 月 4 日 下午 7:15 
引用自 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 2016 年 2 月 8 日 上午 7:19 
引用自 doUbleU
引用自 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 2016 年 2 月 8 日 下午 1:02 
引用自 Corporelax
引用自 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 2016 年 2 月 9 日 上午 12:45 
引用自 doUbleU
引用自 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 2016 年 2 月 11 日 上午 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 2016 年 2 月 17 日 下午 6:24 
I found the last elevator you guys were talking about.
I added it to the script in the OP.
Fennecs are cute :3 2016 年 2 月 20 日 下午 1:19 
引用自 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 2016 年 2 月 20 日 下午 1:24 
引用自 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.
最后由 doUbleU 编辑于; 2016 年 2 月 20 日 下午 4:00
Michael McMange 2016 年 12 月 18 日 下午 1:08 
i put this in but the train dosent work?? Or am i not doing something right
< >
正在显示第 1 - 14 条,共 14 条留言
每页显示数: 1530 50