-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsh_fire_system.lua
144 lines (117 loc) · 5.36 KB
/
sh_fire_system.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
sAdmin.addCommand({
name = "molotov",
category = "Fire System",
inputs = {{"player", "player_name"}},
func = function(ply, args, silent)
local targets = sAdmin.getTargets("molotov", ply, args[1], 1)
for k,v in ipairs(targets) do
v:Give("fire_molotov")
end
sAdmin.msg(silent and ply or nil, "molotov_response", ply, targets)
end
})
sAdmin.addCommand({
name = "extinguisher",
category = "Fire System",
inputs = {{"player", "player_name"}},
func = function(ply, args, silent)
local targets = sAdmin.getTargets("extinguisher", ply, args[1], 1)
for k,v in ipairs(targets) do
v:Give("fire_extinguisher")
end
sAdmin.msg(silent and ply or nil, "extinguisher_response", ply, targets)
end
})
sAdmin.addCommand({
name = "forcefirefighter",
category = "Fire System",
inputs = {{"player", "player_name"}},
func = function(ply, args, silent)
local targets = sAdmin.getTargets("forcefirefighter", ply, args[1], 1)
for k,v in ipairs(targets) do
v:changeTeam(TEAM_FIREFIGHTER)
end
sAdmin.msg(silent and ply or nil, "forcefirefighter_response", ply, targets)
end
})
sAdmin.addCommand({
name = "fireoff",
category = "Fire System",
inputs = {},
func = function(ply, args, silent)
for k, v in ipairs(ents.FindByClass("fire")) do
v:KillFire()
end
sAdmin.msg(silent and ply or nil, "fireoff_response", ply)
end
})
sAdmin.addCommand({
name = "startfire",
category = "Fire System",
inputs = {},
func = function(ply, args, silent)
local tr = ply:GetEyeTrace()
local fire = ents.Create("fire")
fire:SetPos(tr.HitPos)
fire:Spawn()
sAdmin.msg(silent and ply or nil, "startfire_response", ply)
end
})
sAdmin.addCommand({
name = "validfires",
category = "Fire System",
inputs = {},
func = function(ply, args, silent)
for k, v in pairs(file.Find("craphead_scripts/fire_system/".. string.lower(game.GetMap()) .."/fire_location_*.txt", "DATA")) do
local PosFile = file.Read("craphead_scripts/fire_system/".. string.lower(game.GetMap()) .."/".. v, "DATA")
local ThePos = string.Explode( ";", PosFile )
local ThePrintPos = ThePos[1], ThePos[2], ThePos[3]
ply:PrintMessage(HUD_PRINTCONSOLE, "NAMES OF VALID FIRES:")
ply:PrintMessage(HUD_PRINTCONSOLE, "File Name: ".. v .." - Fire Position: "..ThePrintPos)
ply:PrintMessage(HUD_PRINTCONSOLE, "REMEMBER: YOU ONLY USE THE LAST OF THE FILE NAME. SO IF A FILE NAME IS CALLED 'FIRE_LOCATION_TRAIN', THEN YOU WOULD USE 'CH_REMOVE_FIRE TRAIN' TO REMOVE IT!")
end
ply:ChatPrint("A list of valid fires has been printed to your console!")
sAdmin.msg(silent and ply or nil, "validfires_response", ply)
end
})
sAdmin.addCommand({
name = "allfires",
category = "Fire System",
inputs = {},
func = function(ply, args, silent)
for k, v in pairs(file.Find("craphead_scripts/fire_system/".. string.lower(game.GetMap()) .."/fire_location_*.txt", "DATA")) do
if FIRE_CurrentFires >= FIRE_MaxFires then
return
end
local Randomize = 2
if FIRE_RandomizeFireSpawn then
Randomize = math.random(1,2)
end
if tonumber(Randomize) == 2 then
local PositionFile = file.Read("craphead_scripts/fire_system/".. string.lower(game.GetMap()) .."/".. v, "DATA")
local ThePosition = string.Explode( ";", PositionFile )
local TheVector = Vector(ThePosition[1], ThePosition[2], ThePosition[3])
local TheAngle = Angle(tonumber(ThePosition[4]), ThePosition[5], ThePosition[6])
local Fire = ents.Create("fire")
Fire:SetPos(TheVector)
Fire:SetAngles(TheAngle)
Fire:Spawn()
end
end
sAdmin.msg(silent and ply or nil, "allfires_response", ply)
end
})
slib.setLang("sadmin", "en", "molotov_response", "%s gave a molotov to %s.")
slib.setLang("sadmin", "en", "extinguisher_response", "%s gave an extinguisher to %s.")
slib.setLang("sadmin", "en", "forcefirefighter_response", "%s forced %s to become a fire fighter.")
slib.setLang("sadmin", "en", "fireoff_response", "%s turned off all fires.")
slib.setLang("sadmin", "en", "startfire_response", "%s started a fire.")
slib.setLang("sadmin", "en", "validfires_response", "%s looked up valid fires.")
slib.setLang("sadmin", "en", "allfires_response", "%s started all fires.")
slib.setLang("sadmin", "en", "molotov_help", "Give a molotov to specified player.")
slib.setLang("sadmin", "en", "extinguisher_help", "Give extingiusher to specified player.")
slib.setLang("sadmin", "en", "forcefirefighter_help", "Force player to become a fire fighter.")
slib.setLang("sadmin", "en", "fireoff_help", "Extingish all fires on map.")
slib.setLang("sadmin", "en", "startfire_help", "Start a fire where you are looking.")
slib.setLang("sadmin", "en", "validfires_help", "Prints info about all valid fires.")
slib.setLang("sadmin", "en", "allfires_help", "Start a bunch off random fires around the map.")