Update CS:GO team score gamedata.
3 * =============================================================================
4 * SourceMod Basefuncommands Plugin
5 * Provides FireBomb functionality
7 * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
8 * =============================================================================
10 * This program is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License, version 3.0, as published by the
12 * Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
22 * As a special exception, AlliedModders LLC gives you permission to link the
23 * code of this program (as well as its derivative works) to "Half-Life 2," the
24 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
25 * by the Valve Corporation. You must obey the GNU General Public License in
26 * all respects for all other code used. Additionally, AlliedModders LLC grants
27 * this exception to all derivative works. AlliedModders LLC defines further
28 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
29 * or <http://www.sourcemod.net/license.php>.
34 new g_FireBombSerial[MAXPLAYERS+1] = { 0, ... };
35 new g_FireBombTime[MAXPLAYERS+1] = { 0, ... };
37 new Handle:g_Cvar_BurnDuration = INVALID_HANDLE;
38 new Handle:g_Cvar_FireBombTicks = INVALID_HANDLE;
39 new Handle:g_Cvar_FireBombRadius = INVALID_HANDLE;
40 new Handle:g_Cvar_FireBombMode = INVALID_HANDLE;
42 CreateFireBomb(client)
44 g_FireBombSerial[client] = ++g_Serial_Gen;
45 CreateTimer(1.0, Timer_FireBomb, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);
46 g_FireBombTime[client] = GetConVarInt(g_Cvar_FireBombTicks);
51 g_FireBombSerial[client] = 0;
53 if (IsClientInGame(client))
55 SetEntityRenderColor(client, 255, 255, 255, 255);
61 for (new i = 1; i <= MaxClients; i++)
67 PerformBurn(client, target, Float:seconds)
69 IgniteEntity(target, seconds);
70 LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
73 PerformFireBomb(client, target)
75 if (g_FireBombSerial[client] == 0)
77 CreateFireBomb(target);
78 LogAction(client, target, "\"%L\" set a FireBomb on \"%L\"", client, target);
83 SetEntityRenderColor(client, 255, 255, 255, 255);
84 LogAction(client, target, "\"%L\" removed a FireBomb on \"%L\"", client, target);
88 public Action:Timer_FireBomb(Handle:timer, any:value)
90 new client = value & 0x7f;
91 new serial = value >> 7;
93 if (!IsClientInGame(client)
94 || !IsPlayerAlive(client)
95 || g_FireBombSerial[client] != serial)
100 g_FireBombTime[client]--;
103 GetClientEyePosition(client, vec);
105 if (g_FireBombTime[client] > 0)
109 if (g_FireBombTime[client] > 1)
111 color = RoundToFloor(g_FireBombTime[client] * (255.0 / GetConVarFloat(g_Cvar_FireBombTicks)));
114 EmitAmbientSound(g_BeepSound, vec, client, SNDLEVEL_RAIDSIREN);
122 EmitAmbientSound(g_FinalSound, vec, client, SNDLEVEL_RAIDSIREN);
126 SetEntityRenderColor(client, 255, color, color, 255);
128 decl String:name[64];
129 GetClientName(client, name, sizeof(name));
130 PrintCenterTextAll("%t", "Till Explodes", name, g_FireBombTime[client]);
132 if (g_BeamSprite > -1 && g_HaloSprite > -1)
134 GetClientAbsOrigin(client, vec);
137 TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_Cvar_FireBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
139 TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_Cvar_FireBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, whiteColor, 10, 0);
142 return Plugin_Continue;
146 if (g_ExplosionSprite > -1)
148 TE_SetupExplosion(vec, g_ExplosionSprite, 0.1, 1, 0, GetConVarInt(g_Cvar_FireBombRadius), 5000);
152 if (g_BeamSprite > -1 && g_HaloSprite > -1)
154 GetClientAbsOrigin(client, vec);
156 TE_SetupBeamRingPoint(vec, 50.0, GetConVarFloat(g_Cvar_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.5, 30.0, 1.5, orangeColor, 5, 0);
159 TE_SetupBeamRingPoint(vec, 40.0, GetConVarFloat(g_Cvar_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 30.0, 1.5, orangeColor, 5, 0);
162 TE_SetupBeamRingPoint(vec, 30.0, GetConVarFloat(g_Cvar_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.7, 30.0, 1.5, orangeColor, 5, 0);
165 TE_SetupBeamRingPoint(vec, 20.0, GetConVarFloat(g_Cvar_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.8, 30.0, 1.5, orangeColor, 5, 0);
171 EmitAmbientSound(g_BoomSound, vec, client, SNDLEVEL_RAIDSIREN);
174 IgniteEntity(client, GetConVarFloat(g_Cvar_BurnDuration));
175 KillFireBomb(client);
176 SetEntityRenderColor(client, 255, 255, 255, 255);
178 if (GetConVarInt(g_Cvar_FireBombMode) > 0)
180 new teamOnly = ((GetConVarInt(g_Cvar_FireBombMode) == 1) ? true : false);
182 for (new i = 1; i <= MaxClients; i++)
184 if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
189 if (teamOnly && GetClientTeam(i) != GetClientTeam(client))
195 GetClientAbsOrigin(i, pos);
197 new Float:distance = GetVectorDistance(vec, pos);
199 if (distance > GetConVarFloat(g_Cvar_FireBombRadius))
204 new Float:duration = GetConVarFloat(g_Cvar_BurnDuration);
205 duration *= (GetConVarFloat(g_Cvar_FireBombRadius) - distance) / GetConVarFloat(g_Cvar_FireBombRadius);
207 IgniteEntity(i, duration);
214 public AdminMenu_Burn(Handle:topmenu,
215 TopMenuAction:action,
216 TopMenuObject:object_id,
221 if (action == TopMenuAction_DisplayOption)
223 Format(buffer, maxlength, "%T", "Burn player", param);
225 else if (action == TopMenuAction_SelectOption)
227 DisplayBurnMenu(param);
231 public AdminMenu_FireBomb(Handle:topmenu,
232 TopMenuAction:action,
233 TopMenuObject:object_id,
238 if (action == TopMenuAction_DisplayOption)
240 Format(buffer, maxlength, "%T", "FireBomb player", param);
242 else if (action == TopMenuAction_SelectOption)
244 DisplayFireBombMenu(param);
248 DisplayBurnMenu(client)
250 new Handle:menu = CreateMenu(MenuHandler_Burn);
252 decl String:title[100];
253 Format(title, sizeof(title), "%T:", "Burn player", client);
254 SetMenuTitle(menu, title);
255 SetMenuExitBackButton(menu, true);
257 AddTargetsToMenu(menu, client, true, true);
259 DisplayMenu(menu, client, MENU_TIME_FOREVER);
262 DisplayFireBombMenu(client)
264 new Handle:menu = CreateMenu(MenuHandler_FireBomb);
266 decl String:title[100];
267 Format(title, sizeof(title), "%T:", "FireBomb player", client);
268 SetMenuTitle(menu, title);
269 SetMenuExitBackButton(menu, true);
271 AddTargetsToMenu(menu, client, true, true);
273 DisplayMenu(menu, client, MENU_TIME_FOREVER);
276 public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
278 if (action == MenuAction_End)
282 else if (action == MenuAction_Cancel)
284 if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
286 DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
289 else if (action == MenuAction_Select)
291 decl String:info[32];
294 GetMenuItem(menu, param2, info, sizeof(info));
295 userid = StringToInt(info);
297 if ((target = GetClientOfUserId(userid)) == 0)
299 PrintToChat(param1, "[SM] %t", "Player no longer available");
301 else if (!CanUserTarget(param1, target))
303 PrintToChat(param1, "[SM] %t", "Unable to target");
308 GetClientName(target, name, sizeof(name));
309 PerformBurn(param1, target, 20.0);
310 ShowActivity2(param1, "[SM] ", "%t", "Set target on fire", "_s", name);
313 /* Re-draw the menu if they're still valid */
314 if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
316 DisplayBurnMenu(param1);
321 public MenuHandler_FireBomb(Handle:menu, MenuAction:action, param1, param2)
323 if (action == MenuAction_End)
327 else if (action == MenuAction_Cancel)
329 if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
331 DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
334 else if (action == MenuAction_Select)
336 decl String:info[32];
339 GetMenuItem(menu, param2, info, sizeof(info));
340 userid = StringToInt(info);
342 if ((target = GetClientOfUserId(userid)) == 0)
344 PrintToChat(param1, "[SM] %t", "Player no longer available");
346 else if (!CanUserTarget(param1, target))
348 PrintToChat(param1, "[SM] %t", "Unable to target");
353 GetClientName(target, name, sizeof(name));
355 PerformFireBomb(param1, target);
356 ShowActivity2(param1, "[SM] ", "%t", "Toggled FireBomb on target", "_s", name);
359 /* Re-draw the menu if they're still valid */
360 if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
362 DisplayFireBombMenu(param1);
367 public Action:Command_Burn(client, args)
371 ReplyToCommand(client, "[SM] Usage: sm_burn <#userid|name> [time]");
372 return Plugin_Handled;
376 GetCmdArg(1, arg, sizeof(arg));
378 new Float:seconds = GetConVarFloat(g_Cvar_BurnDuration);
382 decl String:time[20];
383 GetCmdArg(2, time, sizeof(time));
384 if (StringToFloatEx(time, seconds) == 0)
386 ReplyToCommand(client, "[SM] %t", "Invalid Amount");
387 return Plugin_Handled;
391 decl String:target_name[MAX_TARGET_LENGTH];
392 decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
394 if ((target_count = ProcessTargetString(
399 COMMAND_FILTER_ALIVE,
404 ReplyToTargetError(client, target_count);
405 return Plugin_Handled;
408 for (new i = 0; i < target_count; i++)
410 PerformBurn(client, target_list[i], seconds);
415 ShowActivity2(client, "[SM] ", "%t", "Set target on fire", target_name);
419 ShowActivity2(client, "[SM] ", "%t", "Set target on fire", "_s", target_name);
422 return Plugin_Handled;
425 public Action:Command_FireBomb(client, args)
429 ReplyToCommand(client, "[SM] Usage: sm_firebomb <#userid|name>");
430 return Plugin_Handled;
434 GetCmdArg(1, arg, sizeof(arg));
436 decl String:target_name[MAX_TARGET_LENGTH];
437 decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
439 if ((target_count = ProcessTargetString(
444 COMMAND_FILTER_ALIVE,
449 ReplyToTargetError(client, target_count);
450 return Plugin_Handled;
453 for (new i = 0; i < target_count; i++)
455 PerformFireBomb(client, target_list[i]);
460 ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", target_name);
464 ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", "_s", target_name);
466 return Plugin_Handled;