AMXX-BG.INFO frc.inc Raw include

frc.inc

Original include source with line numbers.

Back Download .inc
1 /* Flashbang Remote Control Include File
2 * Author: OT
3 *
4 * This include file will only work if the plugin named as flashbang_remote_control is placed in your server and it is working!
5 */
6
7 #if defined _frc_included
8 #endinput
9 #endif
10 #define _frc_included
11
12 #include <amxmodx>
13
14 #pragma reqlib "frc_lib"
15
16 /* Constants */
17
18 enum Amnt
19 {
20 AMOUNT_BLIND_PARTIALLY = 200,
21 AMOUNT_BLIND_FULLY = 255
22 }
23
24 enum
25 {
26 FRC_CONTINUE = 0,
27 FRC_MAKE_PARTIALLY = 200,
28 FRC_MAKE_FULLY = 255,
29 FRC_BLOCK = 300
30 }
31
32 enum Punish
33 {
34 PUNISH_ATTACK = 0,
35 PUNISH_KILL,
36 PUNISH_FLASH
37 }
38
39 /* Forwards */
40
41 /*
42 * This forward is called before the flash message is sent to the player.
43 * Will execute in all plugins, even if it is blocked!
44 *
45 * Arguments:
46 * flasher - the owner of the flashbang
47 * flashed - the person who was flashed
48 * flashbang - the flashbang entity | this entity will be equal with flasher if called with FRC_flash_player
49 * amount - the alpha of the screenfade
50 *
51 * Return:
52 * - FRC_CONTINUE - do nothing
53 * - FRC_MAKE_PARTIALLY - make the flashbang partial
54 * - FRC_MAKE_FULLY - make the flashbang fully
55 * - FRC_BLOCK - block it
56 *
57 * Notes: Will work even if plugin is turned off!
58 * Notes: Here you can manipulate also the duration of the screenfade with [g|s]et_FRC_duration() native
59 */
60
61 forward fw_FRC_preflash(flasher, flashed, flashbang, amount)
62
63 /*
64 * This forward is called after the flash message is sent to the player.
65 * This forward can not be blocked and will not execute if preflash is blocked!
66 *
67 * Arguments:
68 * flasher - the owner of the flashbang
69 * flashed - the person who was flashed
70 * flashbang - the flashbang entity | this entity will be equal with flasher if called with FRC_flash_player
71 * amount - the alpha of the screenfade
72 *
73 * Return:
74 * No return!
75 *
76 * Notes: Will work even if plugin is turned off!
77 */
78
79 forward fw_FRC_postflash(flasher, flashed, flashbang, amount)
80
81 /*
82 * This forward is called when the flashbang begins searching for players, aka explodes.
83 * Before this forward the plugin registers all the
84 * It can't be blocked.
85 *
86 * Arguments:
87 * flashbang_entity - the flashbang entity
88 * owner - the entity owner
89 *
90 * Return:
91 * No return!
92 *
93 * Notes: Will work even if plugin is turned off!
94 */
95
96 forward fw_FRC_flashbang_explosion(flashbang_entity, owner)
97
98 /*
99 * This forward is called when the plugin free the data such as flasher entity and flash owner
100 *
101 * Return:
102 * No return!
103 *
104 * Notes: Will work even if plugin is turned off!
105 */
106
107 forward fw_FRC_free_plugin_data()
108
109 /*
110 * This forward is called when the plugin punished a player!
111 * Warning it punish_type is equal to PUNISH_ATTACK then this forward will be extremely often called!
112 *
113 * Arguments:
114 * flasher - the person that needs to be punished
115 * punish_type - type of punishment use the Punish enum!
116 *
117 * Return:
118 * FRC_CONTINUE - continue the punishment
119 * FRC_BLOCK - block the punishment
120 *
121 * Notes: Will work only when the plugin has the punish system on and the plugin itself is turned on!
122 */
123
124 forward fw_FRC_punish(flasher, punish_type)
125
126 /*
127 * This forward is called when the plugin does the special check to block flashing players if one teammate is flashed!
128 *
129 * Arguments:
130 * start - start position of the trace
131 * end - end position of the trace
132 * conditions - this should normally be DONT_IGNORE_MONSTERS, this acts as the conditions of TraceLine
133 * ignore_ent - entity that is to be ignored
134 * trace_handle - use get_tr2() from fakemeta, here we have the info that we need!
135 * - This is the tracehandle of the plugin, any modifications will be seen!
136 *
137 * Return:
138 * No return!
139 *
140 * Notes: Will work when the plugin is on and has the special block feature on!
141 */
142
143 forward fw_FRC_trace(Float:start[3], Float:end[3], conditions, ignore_ent, trace_handle)
144
145 /*
146 * This forward is called when the plugin does the bug check to see if a player is flashable through a trace!
147 *
148 * Arguments:
149 * start - start position of the trace
150 * end - end position of the trace
151 * conditions - this should normally be DONT_IGNORE_MONSTERS, this acts as the conditions of TraceLine
152 * ignore_ent - entity that is to be ignored
153 * trace_handle - use get_tr2() from fakemeta, here we have the info that we need!
154 * - This is the tracehandle of the plugin, any modifications will be seen!
155 *
156 * Return:
157 * No return!
158 *
159 * Notes: Will work when the plugin is on and has the bugfix feature on!
160 */
161
162 forward fw_FRC_trace_bug(Float:start[3], Float:end[3], conditions, ignore_ent, trace_handle)
163
164 /*
165 * This forward is called when the counter is reseted.
166 * This happens normally when client connects or the punish period has finished!
167 *
168 * Return:
169 * No return!
170 *
171 * Notes: Will work only when the plugin has the punish system on and the plugin itself is turned on!
172 */
173
174 forward fw_FRC_counter_reset(player)
175
176 /*
177 * This forward is called when the flashbang searches for the players that can be flashed!
178 * This takes place after fw_FRC_flashbang_explosion forward.
179 * If this will be blocked none of the punish/flash/trace forwards will work!
180 *
181 * Params:
182 * - player - player id
183 * - flash_entity - flashbang entity
184 *
185 * Return:
186 * - FRC_CONTINUE - do not do anything
187 * - FRC_BLOCK - block the client from beeing searched
188 *
189 * Notes: Will work even if plugin is turned off!
190 */
191
192 forward fw_FRC_flash_find_in_sphere(player, flash_entity)
193
194 /*
195 * This forward is called when the plugin finishes regitering all the forwards.
196 *
197 * Return:
198 * None!
199 *
200 * Notes: Will work even if plugin is turned off!
201 */
202 forward fw_FRC_extention_init()
203
204 /* Natives */
205 /*
206 * Gets the number of times a player has flashed his teammates
207 */
208 native get_FRC_counter(id)
209
210 /*
211 * Sets the number of times a player has flashed his teammates
212 */
213 native set_FRC_counter(id, quantity)
214
215 /*
216 * This will set the duration of the flash [Use this in fw_FRC_preflash forward!]
217 * Return is in 0.1 seconds!
218 * Will return -1 on invalid call!
219 */
220 native get_FRC_duration(flashed)
221
222 /*
223 * This will set the duration of the flash [Use this in fw_FRC_preflash forward!]
224 * Duration is in 0.1 seconds!
225 * Will return -1 on invalid call!
226 */
227 native set_FRC_duration(flashed, duration)
228
229 /*
230 * This will set the hold time of the flash [Use this in fw_FRC_preflash forward!]
231 * Return is in 0.1 seconds!
232 * Will return -1 on invalid call!
233 */
234 native get_FRC_holdtime(flashed)
235
236 /*
237 * This will set the hold time of the flash [Use this in fw_FRC_preflash forward!]
238 * Duration is in 0.1 seconds!
239 * Will return -1 on invalid call!
240 */
241 native set_FRC_holdtime(flashed, duration)
242
243 /*
244 * Gets the number of time a player can flash his teammates
245 */
246 native get_FRC_flash_limit()
247
248 /*
249 * Gets the exploding flashbang entity
250 */
251 native get_FRC_exploding_flash()
252
253 /*
254 * Gets the owner of the exploding flashbang
255 */
256 native get_FRC_exploding_owner()
257
258 /*
259 * If flasher != 0 then this function will be hookable with fw_FRC_preflash and fw_FRC_postflash, and the flash entity will be equal with flasher!
260 * If flasher == 0 then this function will be unhookable
261 *
262 * Params:
263 * holdtime: Time that the screenfade maintains its color before fading
264 * duration: The time the entire screenfade message will last.
265 * Both duration and holdtime are in 0.1 seconds!!!
266 *
267 * Example usage:
268 * FRC_flash_player(id, id, 1000, 900, AMOUNT_BLIND_FULLY)
269 * This will seem like an autoflash to the plugin, it will not be blocked by selfflash cvar!
270 * The screenfade will act like this: 90 seconds the screen will be total white and after that in the las 10 seconds it will fade out,
271 */
272 native FRC_flash_player(flasher = 0, flashed, duration, holdtime, Amnt:ammount)
273
274 /*
275 * This we use to check whether the plugin is on.
276 * -1 - plugin does not exist!
277 * 0 - plugin exists but it is turned off!
278 * 1 - plugin is turned on!
279 */
280 stock is_FRC_on()
281 {
282 if (!cvar_exists("frc_enable"))
283 return -1
284
285 return (!!get_cvar_num("frc_enable"))
286 }