Initial commit

This commit is contained in:
2025-04-15 22:27:20 -04:00
parent 5b7b68f81f
commit 771d8fe8e8
597 changed files with 149544 additions and 0 deletions

View File

@@ -0,0 +1,245 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basefuncommands Plugin
* Provides beacon functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
int g_BeaconSerial[MAXPLAYERS+1] = { 0, ... };
ConVar g_Cvar_BeaconRadius;
void CreateBeacon(int client)
{
g_BeaconSerial[client] = ++g_Serial_Gen;
CreateTimer(1.0, Timer_Beacon, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);
}
void KillBeacon(int client)
{
g_BeaconSerial[client] = 0;
if (IsClientInGame(client))
{
SetEntityRenderColor(client, 255, 255, 255, 255);
}
}
void KillAllBeacons()
{
for (int i = 1; i <= MaxClients; i++)
{
KillBeacon(i);
}
}
void PerformBeacon(int client, int target)
{
if (g_BeaconSerial[target] == 0)
{
CreateBeacon(target);
LogAction(client, target, "\"%L\" set a beacon on \"%L\"", client, target);
}
else
{
KillBeacon(target);
LogAction(client, target, "\"%L\" removed a beacon on \"%L\"", client, target);
}
}
public Action Timer_Beacon(Handle timer, any value)
{
int client = value & 0x7f;
int serial = value >> 7;
if (!IsClientInGame(client)
|| !IsPlayerAlive(client)
|| g_BeaconSerial[client] != serial)
{
KillBeacon(client);
return Plugin_Stop;
}
float vec[3];
GetClientAbsOrigin(client, vec);
vec[2] += 10;
if (g_BeamSprite > -1 && g_HaloSprite > -1)
{
int teamBeaconColor[4];
switch (GetClientTeam(client))
{
case 1: teamBeaconColor = g_Team1BeaconColor;
case 2: teamBeaconColor = g_Team2BeaconColor;
case 3: teamBeaconColor = g_Team3BeaconColor;
case 4: teamBeaconColor = g_Team4BeaconColor;
default: teamBeaconColor = g_TeamUnknownBeaconColor;
}
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, g_ExternalBeaconColor, 10, 0);
TE_SendToAll();
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, teamBeaconColor, 10, 0);
TE_SendToAll();
}
if (g_BlipSound[0])
{
GetClientEyePosition(client, vec);
EmitAmbientSound(g_BlipSound, vec, client, SNDLEVEL_RAIDSIREN);
}
return Plugin_Continue;
}
public void AdminMenu_Beacon(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Beacon player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayBeaconMenu(param);
}
}
void DisplayBeaconMenu(int client)
{
Menu menu = new Menu(MenuHandler_Beacon);
char title[100];
Format(title, sizeof(title), "%T:", "Beacon player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
menu.Display(client, MENU_TIME_FOREVER);
}
public int MenuHandler_Beacon(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
PerformBeacon(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Toggled beacon on target", "_s", name);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayBeaconMenu(param1);
}
}
return 0;
}
public Action Command_Beacon(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_beacon <#userid|name>");
return Plugin_Handled;
}
char arg[65];
GetCmdArg(1, arg, sizeof(arg));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++)
{
PerformBeacon(client, target_list[i]);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Toggled beacon on target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Toggled beacon on target", "_s", target_name);
}
return Plugin_Handled;
}

View File

@@ -0,0 +1,292 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basefuncommands Plugin
* Provides blind functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
int g_BlindTarget[MAXPLAYERS+1];
void PerformBlind(int client, int target, int amount)
{
int targets[2];
targets[0] = target;
int duration = 1536;
int holdtime = 1536;
int flags;
if (amount == 0)
{
flags = (0x0001 | 0x0010);
}
else
{
flags = (0x0002 | 0x0008);
}
int color[4] = { 0, 0, 0, 0 };
color[3] = amount;
Handle message = StartMessageEx(g_FadeUserMsgId, targets, 1);
if (GetUserMessageType() == UM_Protobuf)
{
Protobuf pb = UserMessageToProtobuf(message);
pb.SetInt("duration", duration);
pb.SetInt("hold_time", holdtime);
pb.SetInt("flags", flags);
pb.SetColor("clr", color);
}
else
{
BfWrite bf = UserMessageToBfWrite(message);
bf.WriteShort(duration);
bf.WriteShort(holdtime);
bf.WriteShort(flags);
bf.WriteByte(color[0]);
bf.WriteByte(color[1]);
bf.WriteByte(color[2]);
bf.WriteByte(color[3]);
}
EndMessage();
LogAction(client, target, "\"%L\" set blind on \"%L\" (amount \"%d\")", client, target, amount);
}
public void AdminMenu_Blind(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Blind player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayBlindMenu(param);
}
else if (action == TopMenuAction_DrawOption)
{
// Disable if we could not find the user message id for Fade.
buffer[0] = ((g_FadeUserMsgId == INVALID_MESSAGE_ID) ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT);
}
}
void DisplayBlindMenu(int client)
{
Menu menu = new Menu(MenuHandler_Blind);
char title[100];
Format(title, sizeof(title), "%T:", "Blind player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
menu.Display(client, MENU_TIME_FOREVER);
}
void DisplayAmountMenu(int client)
{
Menu menu = new Menu(MenuHandler_Amount);
char title[100];
Format(title, sizeof(title), "%T: %N", "Blind amount", client, GetClientOfUserId(g_BlindTarget[client]));
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTranslatedMenuItem(menu, "255", "Fully blind", client);
AddTranslatedMenuItem(menu, "240", "Half blind", client);
AddTranslatedMenuItem(menu, "0", "No blind", client);
menu.Display(client, MENU_TIME_FOREVER);
}
public int MenuHandler_Blind(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
g_BlindTarget[param1] = userid;
DisplayAmountMenu(param1);
return 0; // Return, because we went to a new menu and don't want the re-draw to occur.
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayBlindMenu(param1);
}
}
return 0;
}
public int MenuHandler_Amount(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int amount, target;
menu.GetItem(param2, info, sizeof(info));
amount = StringToInt(info);
if ((target = GetClientOfUserId(g_BlindTarget[param1])) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
PerformBlind(param1, target, amount);
ShowActivity2(param1, "[SM] ", "%t", "Set blind on target", "_s", name, amount);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayBlindMenu(param1);
}
}
return 0;
}
public Action Command_Blind(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_blind <#userid|name> [amount]");
return Plugin_Handled;
}
char arg[65];
GetCmdArg(1, arg, sizeof(arg));
int amount = 0;
if (args > 1)
{
if (!GetCmdArgIntEx(2, amount))
{
ReplyToCommand(client, "[SM] %t", "Invalid Amount");
return Plugin_Handled;
}
if (amount < 0)
{
amount = 0;
}
if (amount > 255)
{
amount = 255;
}
}
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++)
{
PerformBlind(client, target_list[i], amount);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Set blind on target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Set blind on target", "_s", target_name);
}
return Plugin_Handled;
}

View File

@@ -0,0 +1,344 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basefuncommands Plugin
* Provides drug functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
Handle g_DrugTimers[MAXPLAYERS+1];
float g_DrugAngles[20] = {0.0, 5.0, 10.0, 15.0, 20.0, 25.0, 20.0, 15.0, 10.0, 5.0, 0.0, -5.0, -10.0, -15.0, -20.0, -25.0, -20.0, -15.0, -10.0, -5.0};
void CreateDrug(int client)
{
g_DrugTimers[client] = CreateTimer(1.0, Timer_Drug, client, TIMER_REPEAT);
}
void KillDrug(int client)
{
KillDrugTimer(client);
float angs[3];
GetClientEyeAngles(client, angs);
angs[2] = 0.0;
TeleportEntity(client, NULL_VECTOR, angs, NULL_VECTOR);
int clients[2];
clients[0] = client;
int duration = 1536;
int holdtime = 1536;
int flags = (0x0001 | 0x0010);
int color[4] = { 0, 0, 0, 0 };
Handle message = StartMessageEx(g_FadeUserMsgId, clients, 1);
if (GetUserMessageType() == UM_Protobuf)
{
Protobuf pb = UserMessageToProtobuf(message);
pb.SetInt("duration", duration);
pb.SetInt("hold_time", holdtime);
pb.SetInt("flags", flags);
pb.SetColor("clr", color);
}
else
{
BfWrite bf = UserMessageToBfWrite(message);
bf.WriteShort(duration);
bf.WriteShort(holdtime);
bf.WriteShort(flags);
bf.WriteByte(color[0]);
bf.WriteByte(color[1]);
bf.WriteByte(color[2]);
bf.WriteByte(color[3]);
}
EndMessage();
}
void KillDrugTimer(int client)
{
KillTimer(g_DrugTimers[client]);
g_DrugTimers[client] = null;
}
void KillAllDrugs()
{
for (int i = 1; i <= MaxClients; i++)
{
if (g_DrugTimers[i] != null)
{
if(IsClientInGame(i))
{
KillDrug(i);
}
else
{
KillDrugTimer(i);
}
}
}
}
void PerformDrug(int client, int target, int toggle)
{
switch (toggle)
{
case (2):
{
if (g_DrugTimers[target] == null)
{
CreateDrug(target);
LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
}
else
{
KillDrug(target);
LogAction(client, target, "\"%L\" undrugged \"%L\"", client, target);
}
}
case (1):
{
if (g_DrugTimers[target] == null)
{
CreateDrug(target);
LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
}
}
case (0):
{
if (g_DrugTimers[target] != null)
{
KillDrug(target);
LogAction(client, target, "\"%L\" undrugged \"%L\"", client, target);
}
}
}
}
public Action Timer_Drug(Handle timer, any client)
{
if (!IsClientInGame(client))
{
KillDrugTimer(client);
return Plugin_Handled;
}
if (!IsPlayerAlive(client))
{
KillDrug(client);
return Plugin_Handled;
}
float angs[3];
GetClientEyeAngles(client, angs);
angs[2] = g_DrugAngles[GetRandomInt(0,100) % 20];
TeleportEntity(client, NULL_VECTOR, angs, NULL_VECTOR);
int clients[2];
clients[0] = client;
int duration = 255;
int holdtime = 255;
int flags = 0x0002;
int color[4] = { 0, 0, 0, 128 };
color[0] = GetRandomInt(0,255);
color[1] = GetRandomInt(0,255);
color[2] = GetRandomInt(0,255);
Handle message = StartMessageEx(g_FadeUserMsgId, clients, 1);
if (GetUserMessageType() == UM_Protobuf)
{
Protobuf pb = UserMessageToProtobuf(message);
pb.SetInt("duration", duration);
pb.SetInt("hold_time", holdtime);
pb.SetInt("flags", flags);
pb.SetColor("clr", color);
}
else
{
BfWriteShort(message, duration);
BfWriteShort(message, holdtime);
BfWriteShort(message, flags);
BfWriteByte(message, color[0]);
BfWriteByte(message, color[1]);
BfWriteByte(message, color[2]);
BfWriteByte(message, color[3]);
}
EndMessage();
return Plugin_Handled;
}
public void AdminMenu_Drug(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Drug player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayDrugMenu(param);
}
}
void DisplayDrugMenu(int client)
{
Menu menu = new Menu(MenuHandler_Drug);
char title[100];
Format(title, sizeof(title), "%T:", "Drug player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
menu.Display(client, MENU_TIME_FOREVER);
}
public int MenuHandler_Drug(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
PerformDrug(param1, target, 2);
ShowActivity2(param1, "[SM] ", "%t", "Toggled drug on target", "_s", name);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayDrugMenu(param1);
}
}
return 0;
}
public Action Command_Drug(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_drug <#userid|name> [0/1]");
return Plugin_Handled;
}
char arg[65];
GetCmdArg(1, arg, sizeof(arg));
int toggle = 2;
if (args > 1)
{
char arg2[2];
GetCmdArg(2, arg2, sizeof(arg2));
if (StringToInt(arg2))
{
toggle = 1;
}
else
{
toggle = 0;
}
}
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++)
{
PerformDrug(client, target_list[i], toggle);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", "_s", target_name);
}
return Plugin_Handled;
}

View File

@@ -0,0 +1,471 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basefuncommands Plugin
* Provides FireBomb functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
int g_FireBombSerial[MAXPLAYERS+1] = { 0, ... };
int g_FireBombTime[MAXPLAYERS+1] = { 0, ... };
ConVar g_Cvar_BurnDuration;
ConVar g_Cvar_FireBombTicks;
ConVar g_Cvar_FireBombRadius;
ConVar g_Cvar_FireBombMode;
void CreateFireBomb(int client)
{
g_FireBombSerial[client] = ++g_Serial_Gen;
CreateTimer(1.0, Timer_FireBomb, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);
g_FireBombTime[client] = g_Cvar_FireBombTicks.IntValue;
}
void KillFireBomb(int client)
{
g_FireBombSerial[client] = 0;
if (IsClientInGame(client))
{
SetEntityRenderColor(client, 255, 255, 255, 255);
}
}
void KillAllFireBombs()
{
for (int i = 1; i <= MaxClients; i++)
{
KillFireBomb(i);
}
}
void PerformBurn(int client, int target, float seconds)
{
IgniteEntity(target, seconds);
LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
}
void PerformFireBomb(int client, int target)
{
if (g_FireBombSerial[client] == 0)
{
CreateFireBomb(target);
LogAction(client, target, "\"%L\" set a FireBomb on \"%L\"", client, target);
}
else
{
KillFireBomb(target);
SetEntityRenderColor(client, 255, 255, 255, 255);
LogAction(client, target, "\"%L\" removed a FireBomb on \"%L\"", client, target);
}
}
public Action Timer_FireBomb(Handle timer, any value)
{
int client = value & 0x7f;
int serial = value >> 7;
if (!IsClientInGame(client)
|| !IsPlayerAlive(client)
|| g_FireBombSerial[client] != serial)
{
KillFireBomb(client);
return Plugin_Stop;
}
g_FireBombTime[client]--;
float vec[3];
GetClientEyePosition(client, vec);
if (g_FireBombTime[client] > 0)
{
int color;
if (g_FireBombTime[client] > 1)
{
color = RoundToFloor(g_FireBombTime[client] * (255.0 / g_Cvar_FireBombTicks.FloatValue));
if (g_BeepSound[0])
{
EmitAmbientSound(g_BeepSound, vec, client, SNDLEVEL_RAIDSIREN);
}
}
else
{
color = 0;
if (g_FinalSound[0])
{
EmitAmbientSound(g_FinalSound, vec, client, SNDLEVEL_RAIDSIREN);
}
}
SetEntityRenderColor(client, 255, color, color, 255);
char name[MAX_NAME_LENGTH];
GetClientName(client, name, sizeof(name));
PrintCenterTextAll("%t", "Till Explodes", name, g_FireBombTime[client]);
if (g_BeamSprite > -1 && g_HaloSprite > -1)
{
GetClientAbsOrigin(client, vec);
vec[2] += 10;
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_FireBombRadius.FloatValue / 3.0, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
TE_SendToAll();
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_FireBombRadius.FloatValue / 3.0, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, whiteColor, 10, 0);
TE_SendToAll();
}
return Plugin_Continue;
}
else
{
if (g_ExplosionSprite > -1)
{
TE_SetupExplosion(vec, g_ExplosionSprite, 0.1, 1, 0, g_Cvar_FireBombRadius.IntValue, 5000);
TE_SendToAll();
}
if (g_BeamSprite > -1 && g_HaloSprite > -1)
{
GetClientAbsOrigin(client, vec);
vec[2] += 10;
TE_SetupBeamRingPoint(vec, 50.0, g_Cvar_FireBombRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.5, 30.0, 1.5, orangeColor, 5, 0);
TE_SendToAll();
vec[2] += 15;
TE_SetupBeamRingPoint(vec, 40.0, g_Cvar_FireBombRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 30.0, 1.5, orangeColor, 5, 0);
TE_SendToAll();
vec[2] += 15;
TE_SetupBeamRingPoint(vec, 30.0, g_Cvar_FireBombRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.7, 30.0, 1.5, orangeColor, 5, 0);
TE_SendToAll();
vec[2] += 15;
TE_SetupBeamRingPoint(vec, 20.0, g_Cvar_FireBombRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.8, 30.0, 1.5, orangeColor, 5, 0);
TE_SendToAll();
}
if (g_BoomSound[0])
{
EmitAmbientSound(g_BoomSound, vec, client, SNDLEVEL_RAIDSIREN);
}
IgniteEntity(client, g_Cvar_BurnDuration.FloatValue);
KillFireBomb(client);
SetEntityRenderColor(client, 255, 255, 255, 255);
if (g_Cvar_FireBombMode.IntValue > 0)
{
int teamOnly = ((g_Cvar_FireBombMode.IntValue == 1) ? true : false);
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
{
continue;
}
if (teamOnly && GetClientTeam(i) != GetClientTeam(client))
{
continue;
}
float pos[3];
GetClientAbsOrigin(i, pos);
float distance = GetVectorDistance(vec, pos);
if (distance > g_Cvar_FireBombRadius.FloatValue)
{
continue;
}
float duration = g_Cvar_BurnDuration.FloatValue;
duration *= (g_Cvar_FireBombRadius.FloatValue - distance) / g_Cvar_FireBombRadius.FloatValue;
IgniteEntity(i, duration);
}
}
return Plugin_Stop;
}
}
public void AdminMenu_Burn(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Burn player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayBurnMenu(param);
}
}
public void AdminMenu_FireBomb(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "FireBomb player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayFireBombMenu(param);
}
}
void DisplayBurnMenu(int client)
{
Menu menu = new Menu(MenuHandler_Burn);
char title[100];
Format(title, sizeof(title), "%T:", "Burn player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
menu.Display(client, MENU_TIME_FOREVER);
}
void DisplayFireBombMenu(int client)
{
Menu menu = new Menu(MenuHandler_FireBomb);
char title[100];
Format(title, sizeof(title), "%T:", "FireBomb player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
menu.Display(client, MENU_TIME_FOREVER);
}
public int MenuHandler_Burn(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
PerformBurn(param1, target, 20.0);
ShowActivity2(param1, "[SM] ", "%t", "Set target on fire", "_s", name);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayBurnMenu(param1);
}
}
return 0;
}
public int MenuHandler_FireBomb(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
PerformFireBomb(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Toggled FireBomb on target", "_s", name);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayFireBombMenu(param1);
}
}
return 0;
}
public Action Command_Burn(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_burn <#userid|name> [time]");
return Plugin_Handled;
}
char arg[65];
GetCmdArg(1, arg, sizeof(arg));
float seconds = g_Cvar_BurnDuration.FloatValue;
if (args > 1)
{
if (!GetCmdArgFloatEx(2, seconds))
{
ReplyToCommand(client, "[SM] %t", "Invalid Amount");
return Plugin_Handled;
}
}
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++)
{
PerformBurn(client, target_list[i], seconds);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Set target on fire", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Set target on fire", "_s", target_name);
}
return Plugin_Handled;
}
public Action Command_FireBomb(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_firebomb <#userid|name>");
return Plugin_Handled;
}
char arg[65];
GetCmdArg(1, arg, sizeof(arg));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++)
{
PerformFireBomb(client, target_list[i]);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", "_s", target_name);
}
return Plugin_Handled;
}

View File

@@ -0,0 +1,245 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basefuncommands Plugin
* Provides gravity functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
int g_GravityTarget[MAXPLAYERS+1];
void PerformGravity(int client, int target, float amount)
{
SetEntityGravity(target, amount);
LogAction(client, target, "\"%L\" set gravity on \"%L\" (amount \"%f\")", client, target, amount);
}
public void AdminMenu_Gravity(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Gravity player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayGravityMenu(param);
}
}
void DisplayGravityMenu(int client)
{
Menu menu = new Menu(MenuHandler_Gravity);
char title[100];
Format(title, sizeof(title), "%T:", "Gravity player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
menu.Display(client, MENU_TIME_FOREVER);
}
void DisplayGravityAmountMenu(int client)
{
Menu menu = new Menu(MenuHandler_GravityAmount);
char title[100];
Format(title, sizeof(title), "%T: %N", "Gravity amount", client, GetClientOfUserId(g_GravityTarget[client]));
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTranslatedMenuItem(menu, "4.0", "Gravity Very High", client);
AddTranslatedMenuItem(menu, "2.0", "Gravity High", client);
AddTranslatedMenuItem(menu, "1.0", "Gravity Normal", client);
AddTranslatedMenuItem(menu, "0.5", "Gravity Low", client);
AddTranslatedMenuItem(menu, "0.1", "Gravity Very Low", client);
menu.Display(client, MENU_TIME_FOREVER);
}
public int MenuHandler_Gravity(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
g_GravityTarget[param1] = userid;
DisplayGravityAmountMenu(param1);
return 0; // Return, because we went to a new menu and don't want the re-draw to occur.
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayGravityMenu(param1);
}
}
return 0;
}
public int MenuHandler_GravityAmount(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
float amount;
int target;
menu.GetItem(param2, info, sizeof(info));
amount = StringToFloat(info);
if ((target = GetClientOfUserId(g_GravityTarget[param1])) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
PerformGravity(param1, target, amount);
ShowActivity2(param1, "[SM] ", "%t", "Set gravity on target", "_s", name, amount);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayGravityMenu(param1);
}
}
return 0;
}
public Action Command_Gravity(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_gravity <#userid|name> [amount]");
return Plugin_Handled;
}
char arg[65];
GetCmdArg(1, arg, sizeof(arg));
float amount = 1.0;
if (args > 1)
{
if (!GetCmdArgFloatEx(2, amount))
{
ReplyToCommand(client, "[SM] %t", "Invalid Amount");
return Plugin_Handled;
}
if (amount < 0.0)
{
amount = 0.0;
}
}
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++)
{
PerformGravity(client, target_list[i], amount);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", "_s", target_name);
}
return Plugin_Handled;
}

View File

@@ -0,0 +1,584 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basefuncommands Plugin
* Provides freeze and freezebomb functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
int g_FreezeSerial[MAXPLAYERS+1] = { 0, ... };
int g_FreezeBombSerial[MAXPLAYERS+1] = { 0, ... };
int g_FreezeTime[MAXPLAYERS+1] = { 0, ... };
int g_FreezeBombTime[MAXPLAYERS+1] = { 0, ... };
ConVar g_Cvar_FreezeDuration;
ConVar g_Cvar_FreezeBombTicks;
ConVar g_Cvar_FreezeBombRadius;
ConVar g_Cvar_FreezeBombMode;
void FreezeClient(int client, int time)
{
if (g_FreezeSerial[client] != 0)
{
UnfreezeClient(client);
return;
}
SetEntityMoveType(client, MOVETYPE_NONE);
SetEntityRenderColor(client, 0, 128, 255, 192);
if (g_FreezeSound[0])
{
float vec[3];
GetClientEyePosition(client, vec);
EmitAmbientSound(g_FreezeSound, vec, client, SNDLEVEL_RAIDSIREN);
}
g_FreezeTime[client] = time;
g_FreezeSerial[client] = ++ g_Serial_Gen;
CreateTimer(1.0, Timer_Freeze, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);
}
void UnfreezeClient(int client)
{
g_FreezeSerial[client] = 0;
g_FreezeTime[client] = 0;
if (IsClientInGame(client))
{
if (g_FreezeSound[0])
{
float vec[3];
GetClientAbsOrigin(client, vec);
vec[2] += 10;
GetClientEyePosition(client, vec);
EmitAmbientSound(g_FreezeSound, vec, client, SNDLEVEL_RAIDSIREN);
}
SetEntityMoveType(client, MOVETYPE_WALK);
SetEntityRenderColor(client, 255, 255, 255, 255);
}
}
void CreateFreezeBomb(int client)
{
if (g_FreezeBombSerial[client] != 0)
{
KillFreezeBomb(client);
return;
}
g_FreezeBombTime[client] = g_Cvar_FreezeBombTicks.IntValue;
g_FreezeBombSerial[client] = ++g_Serial_Gen;
CreateTimer(1.0, Timer_FreezeBomb, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);
}
void KillFreezeBomb(int client)
{
g_FreezeBombSerial[client] = 0;
g_FreezeBombTime[client] = 0;
if (IsClientInGame(client))
{
SetEntityRenderColor(client, 255, 255, 255, 255);
}
}
void KillAllFreezes()
{
for(int i = 1; i <= MaxClients; i++)
{
if (g_FreezeSerial[i] != 0)
{
UnfreezeClient(i);
}
if (g_FreezeBombSerial[i] != 0)
{
KillFreezeBomb(i);
}
}
}
void PerformFreeze(int client, int target, int time)
{
FreezeClient(target, time);
LogAction(client, target, "\"%L\" froze \"%L\"", client, target);
}
void PerformFreezeBomb(int client, int target)
{
if (g_FreezeBombSerial[target] != 0)
{
KillFreezeBomb(target);
LogAction(client, target, "\"%L\" removed a FreezeBomb on \"%L\"", client, target);
}
else
{
CreateFreezeBomb(target);
LogAction(client, target, "\"%L\" set a FreezeBomb on \"%L\"", client, target);
}
}
public Action Timer_Freeze(Handle timer, any value)
{
int client = value & 0x7f;
int serial = value >> 7;
if (!IsClientInGame(client)
|| !IsPlayerAlive(client)
|| g_FreezeSerial[client] != serial)
{
UnfreezeClient(client);
return Plugin_Stop;
}
if (g_FreezeTime[client] == 0)
{
UnfreezeClient(client);
/* HintText doesn't work on Dark Messiah */
if (g_GameEngine != Engine_DarkMessiah)
{
PrintHintText(client, "%t", "Unfrozen");
}
else
{
PrintCenterText(client, "%t", "Unfrozen");
}
return Plugin_Stop;
}
if (g_GameEngine != Engine_DarkMessiah)
{
PrintHintText(client, "%t", "You will be unfrozen", g_FreezeTime[client]);
}
else
{
PrintCenterText(client, "%t", "You will be unfrozen", g_FreezeTime[client]);
}
g_FreezeTime[client]--;
SetEntityMoveType(client, MOVETYPE_NONE);
SetEntityRenderColor(client, 0, 128, 255, 135);
float vec[3];
GetClientAbsOrigin(client, vec);
vec[2] += 10;
if (g_GlowSprite > -1)
{
TE_SetupGlowSprite(vec, g_GlowSprite, 0.95, 1.5, 50);
TE_SendToAll();
}
else if (g_HaloSprite > -1)
{
TE_SetupGlowSprite(vec, g_HaloSprite, 0.95, 1.5, 50);
TE_SendToAll();
}
return Plugin_Continue;
}
public Action Timer_FreezeBomb(Handle timer, any value)
{
int client = value & 0x7f;
int serial = value >> 7;
if (!IsClientInGame(client)
|| !IsPlayerAlive(client)
|| g_FreezeBombSerial[client] != serial)
{
KillFreezeBomb(client);
return Plugin_Stop;
}
float vec[3];
GetClientEyePosition(client, vec);
g_FreezeBombTime[client]--;
if (g_FreezeBombTime[client] > 0)
{
int color;
if (g_FreezeBombTime[client] > 1)
{
color = RoundToFloor(g_FreezeBombTime[client] * (255.0 / g_Cvar_FreezeBombTicks.FloatValue));
if (g_BeepSound[0])
{
EmitAmbientSound(g_BeepSound, vec, client, SNDLEVEL_RAIDSIREN);
}
}
else
{
color = 0;
if (g_FinalSound[0])
{
EmitAmbientSound(g_FinalSound, vec, client, SNDLEVEL_RAIDSIREN);
}
}
SetEntityRenderColor(client, color, color, 255, 255);
char name[MAX_NAME_LENGTH];
GetClientName(client, name, sizeof(name));
PrintCenterTextAll("%t", "Till Explodes", name, g_FreezeBombTime[client]);
if (g_BeamSprite > -1 && g_HaloSprite > -1)
{
GetClientAbsOrigin(client, vec);
vec[2] += 10;
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_FreezeBombRadius.FloatValue / 3.0, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
TE_SendToAll();
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_FreezeBombRadius.FloatValue / 3.0, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, whiteColor, 10, 0);
TE_SendToAll();
}
return Plugin_Continue;
}
else
{
if (g_ExplosionSprite > -1)
{
TE_SetupExplosion(vec, g_ExplosionSprite, 5.0, 1, 0, g_Cvar_FreezeBombRadius.IntValue, 5000);
TE_SendToAll();
}
if (g_BoomSound[0])
{
EmitAmbientSound(g_BoomSound, vec, client, SNDLEVEL_RAIDSIREN);
}
KillFreezeBomb(client);
FreezeClient(client, g_Cvar_FreezeDuration.IntValue);
if (g_Cvar_FreezeBombMode.IntValue > 0)
{
bool teamOnly = ((g_Cvar_FreezeBombMode.IntValue == 1) ? true : false);
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
{
continue;
}
if (teamOnly && GetClientTeam(i) != GetClientTeam(client))
{
continue;
}
float pos[3];
GetClientEyePosition(i, pos);
float distance = GetVectorDistance(vec, pos);
if (distance > g_Cvar_FreezeBombRadius.FloatValue)
{
continue;
}
if (g_HaloSprite > -1)
{
if (g_BeamSprite2 > -1)
{
TE_SetupBeamPoints(vec, pos, g_BeamSprite2, g_HaloSprite, 0, 1, 0.7, 20.0, 50.0, 1, 1.5, blueColor, 10);
TE_SendToAll();
}
else if (g_BeamSprite > -1)
{
TE_SetupBeamPoints(vec, pos, g_BeamSprite, g_HaloSprite, 0, 1, 0.7, 20.0, 50.0, 1, 1.5, blueColor, 10);
TE_SendToAll();
}
}
FreezeClient(i, g_Cvar_FreezeDuration.IntValue);
}
}
return Plugin_Stop;
}
}
public void AdminMenu_Freeze(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Freeze player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayFreezeMenu(param);
}
}
public void AdminMenu_FreezeBomb(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "FreezeBomb player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayFreezeBombMenu(param);
}
}
void DisplayFreezeMenu(int client)
{
Menu menu = new Menu(MenuHandler_Freeze);
char title[100];
Format(title, sizeof(title), "%T:", "Freeze player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
menu.Display(client, MENU_TIME_FOREVER);
}
void DisplayFreezeBombMenu(int client)
{
Menu menu = new Menu(MenuHandler_FreezeBomb);
char title[100];
Format(title, sizeof(title), "%T:", "FreezeBomb player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
menu.Display(client, MENU_TIME_FOREVER);
}
public int MenuHandler_Freeze(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
PerformFreeze(param1, target, g_Cvar_FreezeDuration.IntValue);
ShowActivity2(param1, "[SM] ", "%t", "Froze target", "_s", name);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayFreezeMenu(param1);
}
}
return 0;
}
public int MenuHandler_FreezeBomb(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
PerformFreezeBomb(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Toggled FreezeBomb on target", "_s", name);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayFreezeBombMenu(param1);
}
}
return 0;
}
public Action Command_Freeze(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_freeze <#userid|name> [time]");
return Plugin_Handled;
}
char arg[65];
GetCmdArg(1, arg, sizeof(arg));
int seconds = g_Cvar_FreezeDuration.IntValue;
if (args > 1 && !GetCmdArgIntEx(2, seconds))
{
ReplyToCommand(client, "[SM] %t", "Invalid Amount");
return Plugin_Handled;
}
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++)
{
PerformFreeze(client, target_list[i], seconds);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Froze target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Froze target", "_s", target_name);
}
return Plugin_Handled;
}
public Action Command_FreezeBomb(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_freezebomb <#userid|name>");
return Plugin_Handled;
}
char arg[65];
GetCmdArg(1, arg, sizeof(arg));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++)
{
PerformFreezeBomb(client, target_list[i]);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Toggled FreezeBomb on target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Toggled FreezeBomb on target", "_s", target_name);
}
return Plugin_Handled;
}

View File

@@ -0,0 +1,173 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basefuncommands Plugin
* Provides noclip functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
void PerformNoClip(int client, int target)
{
MoveType movetype = GetEntityMoveType(target);
if (movetype != MOVETYPE_NOCLIP)
{
SetEntityMoveType(target, MOVETYPE_NOCLIP);
}
else
{
SetEntityMoveType(target, MOVETYPE_WALK);
}
LogAction(client, target, "\"%L\" toggled noclip on \"%L\"", client, target);
}
public void AdminMenu_NoClip(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "NoClip player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayNoClipMenu(param);
}
}
void DisplayNoClipMenu(int client)
{
Menu menu = new Menu(MenuHandler_NoClip);
char title[100];
Format(title, sizeof(title), "%T:", "NoClip player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
menu.Display(client, MENU_TIME_FOREVER);
}
public int MenuHandler_NoClip(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
PerformNoClip(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Toggled noclip on target", "_s", name);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayNoClipMenu(param1);
}
}
return 0;
}
public Action Command_NoClip(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_noclip <#userid|name>");
return Plugin_Handled;
}
char arg[65];
GetCmdArg(1, arg, sizeof(arg));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++)
{
PerformNoClip(client, target_list[i]);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", "_s", target_name);
}
return Plugin_Handled;
}

View File

@@ -0,0 +1,339 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basefuncommands Plugin
* Provides TimeBomb functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
int g_TimeBombSerial[MAXPLAYERS+1] = { 0, ... };
int g_TimeBombTime[MAXPLAYERS+1] = { 0, ... };
ConVar g_Cvar_TimeBombTicks;
ConVar g_Cvar_TimeBombRadius;
ConVar g_Cvar_TimeBombMode;
void CreateTimeBomb(int client)
{
g_TimeBombSerial[client] = ++g_Serial_Gen;
CreateTimer(1.0, Timer_TimeBomb, client | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);
g_TimeBombTime[client] = g_Cvar_TimeBombTicks.IntValue;
}
void KillTimeBomb(int client)
{
g_TimeBombSerial[client] = 0;
if (IsClientInGame(client))
{
SetEntityRenderColor(client, 255, 255, 255, 255);
}
}
void KillAllTimeBombs()
{
for (int i = 1; i <= MaxClients; i++)
{
KillTimeBomb(i);
}
}
void PerformTimeBomb(int client, int target)
{
if (g_TimeBombSerial[target] == 0)
{
CreateTimeBomb(target);
LogAction(client, target, "\"%L\" set a TimeBomb on \"%L\"", client, target);
}
else
{
KillTimeBomb(target);
SetEntityRenderColor(client, 255, 255, 255, 255);
LogAction(client, target, "\"%L\" removed a TimeBomb on \"%L\"", client, target);
}
}
public Action Timer_TimeBomb(Handle timer, any value)
{
int client = value & 0x7f;
int serial = value >> 7;
if (!IsClientInGame(client)
|| !IsPlayerAlive(client)
|| serial != g_TimeBombSerial[client])
{
KillTimeBomb(client);
return Plugin_Stop;
}
g_TimeBombTime[client]--;
float vec[3];
GetClientEyePosition(client, vec);
if (g_TimeBombTime[client] > 0)
{
int color;
if (g_TimeBombTime[client] > 1)
{
color = RoundToFloor(g_TimeBombTime[client] * (128.0 / g_Cvar_TimeBombTicks.FloatValue));
if (g_BeepSound[0])
{
EmitAmbientSound(g_BeepSound, vec, client, SNDLEVEL_RAIDSIREN);
}
}
else
{
color = 0;
if (g_FinalSound[0])
{
EmitAmbientSound(g_FinalSound, vec, client, SNDLEVEL_RAIDSIREN);
}
}
SetEntityRenderColor(client, 255, 128, color, 255);
char name[MAX_NAME_LENGTH];
GetClientName(client, name, sizeof(name));
PrintCenterTextAll("%t", "Till Explodes", name, g_TimeBombTime[client]);
if (g_BeamSprite > -1 && g_HaloSprite > -1)
{
GetClientAbsOrigin(client, vec);
vec[2] += 10;
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_TimeBombRadius.FloatValue / 3.0, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
TE_SendToAll();
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_TimeBombRadius.FloatValue / 3.0, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, whiteColor, 10, 0);
TE_SendToAll();
}
return Plugin_Continue;
}
else
{
if (g_ExplosionSprite > -1)
{
TE_SetupExplosion(vec, g_ExplosionSprite, 5.0, 1, 0, g_Cvar_TimeBombRadius.IntValue, 5000);
TE_SendToAll();
}
if (g_BoomSound[0])
{
EmitAmbientSound(g_BoomSound, vec, client, SNDLEVEL_RAIDSIREN);
}
ForcePlayerSuicide(client);
KillTimeBomb(client);
SetEntityRenderColor(client, 255, 255, 255, 255);
if (g_Cvar_TimeBombMode.IntValue > 0)
{
int teamOnly = ((g_Cvar_TimeBombMode.IntValue == 1) ? true : false);
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
{
continue;
}
if (teamOnly && GetClientTeam(i) != GetClientTeam(client))
{
continue;
}
float pos[3];
GetClientEyePosition(i, pos);
float distance = GetVectorDistance(vec, pos);
if (distance > g_Cvar_TimeBombRadius.FloatValue)
{
continue;
}
int damage = 220;
damage = RoundToFloor(damage * ((g_Cvar_TimeBombRadius.FloatValue - distance) / g_Cvar_TimeBombRadius.FloatValue));
SlapPlayer(i, damage, false);
if (g_ExplosionSprite > -1)
{
TE_SetupExplosion(pos, g_ExplosionSprite, 0.05, 1, 0, 1, 1);
TE_SendToAll();
}
/* ToDo
float dir[3];
SubtractVectors(vec, pos, dir);
TR_TraceRayFilter(vec, dir, MASK_SOLID, RayType_Infinite, TR_Filter_Client);
if (i == TR_GetEntityIndex())
{
int damage = 100;
int radius = g_Cvar_TimeBombRadius.IntValue / 2;
if (distance > radius)
{
distance -= radius;
damage = RoundToFloor(damage * ((radius - distance) / radius));
}
SlapPlayer(i, damage, false);
}
*/
}
}
return Plugin_Stop;
}
}
public void AdminMenu_TimeBomb(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "TimeBomb player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayTimeBombMenu(param);
}
}
void DisplayTimeBombMenu(int client)
{
Menu menu = new Menu(MenuHandler_TimeBomb);
char title[100];
Format(title, sizeof(title), "%T:", "TimeBomb player", client);
menu.SetTitle(title);
menu.ExitBackButton = true;
AddTargetsToMenu(menu, client, true, true);
menu.Display(client, MENU_TIME_FOREVER);
}
public int MenuHandler_TimeBomb(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
PerformTimeBomb(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Toggled TimeBomb on target", "_s", name);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayTimeBombMenu(param1);
}
}
return 0;
}
public Action Command_TimeBomb(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_timebomb <#userid|name>");
return Plugin_Handled;
}
char arg[65];
GetCmdArg(1, arg, sizeof(arg));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++)
{
PerformTimeBomb(client, target_list[i]);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Toggled TimeBomb on target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Toggled TimeBomb on target", "_s", target_name);
}
return Plugin_Handled;
}