sourcemod-plugins/scripting/include/feedthetrolls/commands.inc
2021-10-03 15:23:51 -05:00

348 lines
No EOL
10 KiB
SourcePawn

public Action Command_InstaSpecial(int client, int args) {
if(args < 1) {
Menu menu = new Menu(Insta_PlayerHandler);
menu.SetTitle("InstaSpecial: Choose a player");
for(int i = 1; i < MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2) {
static char userid[8], display[16];
Format(userid, sizeof(userid), "%d|0", GetClientUserId(i));
GetClientName(i, display, sizeof(display));
menu.AddItem(userid, display);
}
}
menu.ExitButton = true;
menu.Display(client, 0);
} else {
char arg1[32], arg2[32] = "jockey";
GetCmdArg(1, arg1, sizeof(arg1));
if(args >= 2) {
GetCmdArg(2, arg2, sizeof(arg2));
}
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
MaxClients,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0
) {
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
int specialType = GetSpecialType(arg2);
static float pos[3];
if(specialType == -1) {
ReplyToCommand(client, "Unknown special \"%s\"", arg2);
return Plugin_Handled;
}
int successes = 0;
for (int i = 0; i < target_count; i++) {
int target = target_list[i];
if(GetClientTeam(target) == 2) {
if(SpawnSpecialNear(target, specialType)) {
LogAction(client, target, "\"%L\" spawned Insta-%s™ nearby \"%L\"", client, arg2, target);
successes++;
} else {
ReplyToCommand(client, "[FTT] Could not spawn %s near %s", arg2, target_name);
}
}else{
ReplyToTargetError(client, target_count);
}
}
if(successes > 0)
ShowActivityEx(client, "[FTT] ", "spawned Insta-%s™ near %s", arg2, target_name);
}
return Plugin_Handled;
}
public Action Command_InstaSpecialFace(int client, int args) {
if(args < 1) {
Menu menu = new Menu(Insta_PlayerHandler);
menu.SetTitle("Inface: Choose a player");
for(int i = 1; i < MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2) {
static char userid[8], display[16];
Format(userid, sizeof(userid), "%d|1", GetClientUserId(i));
GetClientName(i, display, sizeof(display));
menu.AddItem(userid, display);
}
}
menu.ExitButton = true;
menu.Display(client, 0);
} else {
char arg1[32], arg2[32] = "jockey";
GetCmdArg(1, arg1, sizeof(arg1));
if(args >= 2) {
GetCmdArg(2, arg2, sizeof(arg2));
}
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
MaxClients,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0
) {
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
int specialType = GetSpecialType(arg2);
static float pos[3];
if(specialType == -1) {
ReplyToCommand(client, "Unknown special \"%s\"", arg2);
return Plugin_Handled;
}
int successes = 0;
for (int i = 0; i < target_count; i++) {
int target = target_list[i];
if(GetClientTeam(target) == 2) {
if(SpawnSpecialInFace(target, specialType)) {
LogAction(client, target, "\"%L\" spawned Insta-%s™ at player \"%L\"", client, arg2, target);
successes++;
} else {
ReplyToCommand(client, "[FTT] Could not spawn %s on %s", arg2, target_name);
}
}else{
ReplyToTargetError(client, target_count);
}
}
if(successes > 0)
ShowActivityEx(client, "[FTT] ", "spawned Insta-%s™ on %s", arg2, target_name);
}
return Plugin_Handled;
}
public Action Command_WitchAttack(int client, int args) {
if(args < 1) {
ReplyToCommand(client, "Usage: sm_witch_attack <user>");
} else {
char arg1[32];
GetCmdArg(1, arg1, sizeof(arg1));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
1,
COMMAND_FILTER_ALIVE | COMMAND_FILTER_NO_MULTI, /* Only allow alive players */
target_name,
sizeof(target_name),
tn_is_ml)) <= 0
) {
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
int target = target_list[0];
if(GetClientTeam(target) == 2) {
int witch = INVALID_ENT_REFERENCE;
while ((witch = FindEntityByClassname(witch, "witch")) != INVALID_ENT_REFERENCE) {
SetWitchTarget(witch, target);
ShowActivityEx(client, "[FTT] ", "set all witches to target %s", target_name);
LogAction(client, target, "\"%L\" set all witches to attack \"%L\"", client, target);
}
}else{
ReplyToTargetError(client, target_count);
}
}
return Plugin_Handled;
}
public Action Command_FeedTheCrescendoTroll(int client, int args) {
if(lastCrescendoUser > -1) {
ActivateAutoPunish(lastCrescendoUser);
ReplyToCommand(client, "Activated auto punish on %N", lastCrescendoUser);
LogAction(client, lastCrescendoUser, "\"%L\" autopunished crescendo rusher \"%L\"", client, lastCrescendoUser);
ShowActivityEx(client, "[FTT] ", "activated autopunish for crescendo activator %N",lastCrescendoUser);
}else{
ReplyToCommand(client, "No player could be found to autopunish.");
}
return Plugin_Handled;
}
public Action Command_ResetUser(int client, int args) {
if(args < 1) {
ReplyToCommand(client, "Usage: sm_ftr <user(s)>");
}else{
char arg1[32];
GetCmdArg(1, arg1, sizeof(arg1));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_CONNECTED, /* Only allow alive players */
target_name,
sizeof(target_name),
tn_is_ml)) <= 0
) {
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++) {
if(ActiveTrolls[target_list[i]] > 0) {
ResetClient(target_list[i], true);
LogAction(client, target_list[i], "\"%L\" reset all troll effects for \"%L\"", client, target_list[i]);
ShowActivityEx(client, "[FTT] ", "reset troll effects for \"%N\". ", target_list[i]);
}
}
}
return Plugin_Handled;
}
public Action Command_ApplyUser(int client, int args) {
if(args < 1) {
ShowTrollMenu(client);
}else{
char arg1[32];
GetCmdArg(1, arg1, sizeof(arg1));
static char target_name[MAX_TARGET_LENGTH];
int target_list[1], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
1,
COMMAND_FILTER_NO_MULTI,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0
&& target_list[0] > 0) {
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
SetupCategoryMenu(client, target_list[0]);
}
return Plugin_Handled;
}
public Action Command_ListModes(int client, int args) {
static char name[MAX_TROLL_NAME_LENGTH];
static Troll troll;
for(int i = 0; i <= MAX_TROLLS; i++) {
GetTrollByKeyIndex(i, troll);
ReplyToCommand(client, "%d. %s - %s", i, troll.name, troll.description);
}
return Plugin_Handled;
}
public Action Command_ListTheTrolls(int client, int args) {
int count = 0;
char[][] modeListArr = new char[MAX_TROLLS+1][MAX_TROLL_NAME_LENGTH];
static char modeList[255];
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) > 1 && ActiveTrolls[i] > 0) {
if(IsFakeClient(i)) {
int player = GetRealClient(i);
if(player != -1) i = player;
}
int modeCount = 0;
static char name[MAX_TROLL_NAME_LENGTH];
for(int j = 1; j <= MAX_TROLLS; j++) {
if(trollIds[j][0] != '\0' && IsTrollActive(i, trollIds[j])) {
strcopy(modeListArr[modeCount], MAX_TROLL_NAME_LENGTH, trollIds[j]);
modeCount++;
}
}
ImplodeStrings(modeListArr, modeCount, ", ", modeList, sizeof(modeList));
if(IsPlayerAlive(i))
ReplyToCommand(client, "%N | %s", i, modeList);
else
ReplyToCommand(client, "%N (Paused) | %s", i, modeList);
count++;
}
}
if(count == 0) {
ReplyToCommand(client, "No clients have a mode applied.");
}
return Plugin_Handled;
}
public Action Command_MarkPendingTroll(int client, int args) {
if(args == 0) {
Menu menu = new Menu(ChooseMarkedTroll);
menu.SetTitle("Choose a troll to mark");
static char userid[8], display[16];
for(int i = 1; i < MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2) {
AdminId admin = GetUserAdmin(i);
if(admin == INVALID_ADMIN_ID) {
Format(userid, sizeof(userid), "%d", GetClientUserId(i));
GetClientName(i, display, sizeof(display));
menu.AddItem(userid, display);
}else{
ReplyToCommand(client, "%N is an admin cannot be marked.", i);
}
}
}
menu.ExitButton = true;
menu.Display(client, 0);
} else {
char arg1[32];
GetCmdArg(1, arg1, sizeof(arg1));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
1,
COMMAND_FILTER_NO_MULTI , /* Only allow alive players */
target_name,
sizeof(target_name),
tn_is_ml)) <= 0
) {
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
int target = target_list[0];
if(GetClientTeam(target) == 2) {
ToggleMarkPlayer(client, target);
}else{
ReplyToCommand(client, "Player does not exist or is not a survivor.");
}
}
return Plugin_Handled;
}
public Action Command_FeedTheTrollMenu(int client, int args) {
ReplyToCommand(client, "sm_ftl - Lists all the active trolls on players");
ReplyToCommand(client, "sm_ftm - Lists all available troll modes & descriptions");
ReplyToCommand(client, "sm_ftr - Resets target users' of their trolls");
ReplyToCommand(client, "sm_fta - Applies a troll mode on targets");
ReplyToCommand(client, "sm_ftt - Opens this menu");
ReplyToCommand(client, "sm_ftc - Will apply a punishment to last crescendo activator");
ReplyToCommand(client, "sm_mark - Marks the user to be banned on disconnect, prevents their FF.");
return Plugin_Handled;
}