mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-08 14:43:20 +00:00
ftt: Move all variables to inc
This commit is contained in:
parent
2ab0ad2c77
commit
e0e61418db
3 changed files with 27 additions and 61 deletions
|
@ -99,11 +99,21 @@ int autoPunished = -1, autoPunishMode, lastButtonUser, lastCrescendoUser;
|
||||||
bool g_bPendingItemGive[MAXPLAYERS+1], g_PendingBanTroll[MAXPLAYERS+1];
|
bool g_bPendingItemGive[MAXPLAYERS+1], g_PendingBanTroll[MAXPLAYERS+1];
|
||||||
GlobalForward g_PlayerMarkedForward;
|
GlobalForward g_PlayerMarkedForward;
|
||||||
|
|
||||||
|
//HANDLES
|
||||||
|
Handle hThrowTimer;
|
||||||
|
//CONVARS
|
||||||
|
ConVar hVictimsList, hThrowItemInterval, hAutoPunish, hMagnetChance, hShoveFailChance, hAutoPunishExpire;
|
||||||
|
//BOOLS
|
||||||
|
bool lateLoaded; //Is plugin late loaded
|
||||||
|
bool bChooseVictimAvailable = false; //For charge player feature, is it available?
|
||||||
|
//INTEGERS
|
||||||
|
int g_iAmmoTable; //Loads the ammo table to get ammo amounts
|
||||||
|
int gChargerVictim = -1; //For charge player feature
|
||||||
|
|
||||||
//Applies the selected trollMode to the victim.
|
//Applies the selected trollMode to the victim.
|
||||||
//Modifiers are as followed: 0 -> Both (fire instant, and timer), 1 -> Fire Once, 2 -> Start timer
|
//Modifiers are as followed: 0 -> Both (fire instant, and timer), 1 -> Fire Once, 2 -> Start timer
|
||||||
//TODO: change it to only modifier at once? at least for instant fire & repeat. Menu runs ApplyMode twice
|
//TODO: change it to only modifier at once? at least for instant fire & repeat. Menu runs ApplyMode twice
|
||||||
void ApplyModeToClient(int client, int victim, trollMode mode, TrollModifier modifier) {
|
void ApplyModeToClient(int client, int victim, trollMode mode, TrollModifier modifier, bool silent = false) {
|
||||||
ResetClient(victim, false);
|
ResetClient(victim, false);
|
||||||
if(view_as<int>(mode) > TROLL_MODE_COUNT || view_as<int>(mode) < 0) {
|
if(view_as<int>(mode) > TROLL_MODE_COUNT || view_as<int>(mode) < 0) {
|
||||||
ReplyToCommand(client, "Unknown troll mode ID '%d'. Pick a mode between 1 and %d", mode, TROLL_MODE_COUNT - 1);
|
ReplyToCommand(client, "Unknown troll mode ID '%d'. Pick a mode between 1 and %d", mode, TROLL_MODE_COUNT - 1);
|
||||||
|
@ -218,6 +228,7 @@ void ApplyModeToClient(int client, int victim, trollMode mode, TrollModifier mod
|
||||||
PrintToServer("Troll Mode #%d not implemented (%s)", mode, TROLL_MODES_NAMES[mode]);
|
PrintToServer("Troll Mode #%d not implemented (%s)", mode, TROLL_MODES_NAMES[mode]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!silent) {
|
||||||
if(HasTrollMode(victim, mode)) {
|
if(HasTrollMode(victim, mode)) {
|
||||||
ShowActivity(client, "deactivated troll \"%s\" on %N. ", TROLL_MODES_NAMES[mode], victim);
|
ShowActivity(client, "deactivated troll \"%s\" on %N. ", TROLL_MODES_NAMES[mode], victim);
|
||||||
}else{
|
}else{
|
||||||
|
@ -226,6 +237,7 @@ void ApplyModeToClient(int client, int victim, trollMode mode, TrollModifier mod
|
||||||
else
|
else
|
||||||
ShowActivity(client, "activated troll \"%s\" for %N. ", TROLL_MODES_NAMES[mode], victim);
|
ShowActivity(client, "activated troll \"%s\" for %N. ", TROLL_MODES_NAMES[mode], victim);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//If instant fire mod not provided (aka instead of no modifiers which equals both) OR repeat turned on, set bit:
|
//If instant fire mod not provided (aka instead of no modifiers which equals both) OR repeat turned on, set bit:
|
||||||
if(modifier == TrollMod_Repeat || modifier == TrollMod_None) {
|
if(modifier == TrollMod_Repeat || modifier == TrollMod_None) {
|
||||||
g_iTrollUsers[victim] ^= 1 << view_as<int>(mode) -1;
|
g_iTrollUsers[victim] ^= 1 << view_as<int>(mode) -1;
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
#if defined _smlib_included
|
|
||||||
#endinput
|
|
||||||
#endif
|
|
||||||
#define _smlib_included
|
|
||||||
|
|
||||||
#define SMLIB_VERSION "0.9.7"
|
|
||||||
|
|
||||||
#include <smlib/general>
|
|
||||||
|
|
||||||
#include <smlib/arrays>
|
|
||||||
#include <smlib/clients>
|
|
||||||
#include <smlib/colors>
|
|
||||||
#include <smlib/concommands>
|
|
||||||
#include <smlib/convars>
|
|
||||||
#include <smlib/crypt>
|
|
||||||
#include <smlib/debug>
|
|
||||||
#include <smlib/dynarrays>
|
|
||||||
#include <smlib/edicts>
|
|
||||||
#include <smlib/effects>
|
|
||||||
#include <smlib/entities>
|
|
||||||
#include <smlib/files>
|
|
||||||
#include <smlib/game>
|
|
||||||
#include <smlib/math>
|
|
||||||
#include <smlib/menus>
|
|
||||||
//#include <smlib/pluginmanager>
|
|
||||||
#include <smlib/server>
|
|
||||||
#include <smlib/strings>
|
|
||||||
#include <smlib/sql>
|
|
||||||
#include <smlib/teams>
|
|
||||||
#include <smlib/vehicles>
|
|
||||||
#include <smlib/weapons>
|
|
||||||
#include <smlib/world>
|
|
|
@ -9,15 +9,14 @@
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
#include <sdktools>
|
#include <sdktools>
|
||||||
#include <sdkhooks>
|
#include <sdkhooks>
|
||||||
#include "jutils.inc"
|
#include <jutils>
|
||||||
#include <multicolors>
|
|
||||||
#include <left4dhooks>
|
#include <left4dhooks>
|
||||||
#include <sceneprocessor>
|
#include <sceneprocessor>
|
||||||
|
#include <feedthetrolls>
|
||||||
|
|
||||||
#undef REQUIRE_PLUGIN
|
#undef REQUIRE_PLUGIN
|
||||||
#include <adminmenu>
|
#include <adminmenu>
|
||||||
|
|
||||||
|
|
||||||
public Plugin myinfo =
|
public Plugin myinfo =
|
||||||
{
|
{
|
||||||
name = "L4D2 Feed The Trolls",
|
name = "L4D2 Feed The Trolls",
|
||||||
|
@ -26,20 +25,6 @@ public Plugin myinfo =
|
||||||
version = PLUGIN_VERSION,
|
version = PLUGIN_VERSION,
|
||||||
url = ""
|
url = ""
|
||||||
};
|
};
|
||||||
//HANDLES
|
|
||||||
Handle hThrowTimer;
|
|
||||||
//CONVARS
|
|
||||||
ConVar hVictimsList, hThrowItemInterval, hAutoPunish, hMagnetChance, hShoveFailChance, hAutoPunishExpire;
|
|
||||||
//BOOLS
|
|
||||||
bool lateLoaded; //Is plugin late loaded
|
|
||||||
bool bChooseVictimAvailable = false; //For charge player feature, is it available?
|
|
||||||
//INTEGERS
|
|
||||||
int g_iAmmoTable; //Loads the ammo table to get ammo amounts
|
|
||||||
int gChargerVictim = -1; //For charge player feature
|
|
||||||
|
|
||||||
|
|
||||||
#include "feedthetrolls.inc"
|
|
||||||
|
|
||||||
|
|
||||||
//plugin start
|
//plugin start
|
||||||
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) {
|
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) {
|
||||||
|
@ -48,7 +33,6 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void OnPluginStart() {
|
public void OnPluginStart() {
|
||||||
EngineVersion g_Game = GetEngineVersion();
|
EngineVersion g_Game = GetEngineVersion();
|
||||||
if(g_Game != Engine_Left4Dead2) {
|
if(g_Game != Engine_Left4Dead2) {
|
||||||
|
@ -66,7 +50,6 @@ public void OnPluginStart() {
|
||||||
hMagnetChance = CreateConVar("sm_ftt_magnet_chance", "1.0", "% of the time that the magnet will work on a player.", FCVAR_NONE, true, 0.0, true, 1.0);
|
hMagnetChance = CreateConVar("sm_ftt_magnet_chance", "1.0", "% of the time that the magnet will work on a player.", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||||
hShoveFailChance = CreateConVar("sm_ftt_shove_fail_chance", "0.5", "The % chance that a shove fails", FCVAR_NONE, true, 0.0, true, 1.0);
|
hShoveFailChance = CreateConVar("sm_ftt_shove_fail_chance", "0.5", "The % chance that a shove fails", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||||
|
|
||||||
//TODO: Add punish last button presser/crescendo starter
|
|
||||||
RegAdminCmd("sm_ftl", Command_ListTheTrolls, ADMFLAG_KICK, "Lists all the trolls currently ingame.");
|
RegAdminCmd("sm_ftl", Command_ListTheTrolls, ADMFLAG_KICK, "Lists all the trolls currently ingame.");
|
||||||
RegAdminCmd("sm_ftm", Command_ListModes, ADMFLAG_KICK, "Lists all the troll modes and their description");
|
RegAdminCmd("sm_ftm", Command_ListModes, ADMFLAG_KICK, "Lists all the troll modes and their description");
|
||||||
RegAdminCmd("sm_ftr", Command_ResetUser, ADMFLAG_KICK, "Resets user of any troll effects.");
|
RegAdminCmd("sm_ftr", Command_ResetUser, ADMFLAG_KICK, "Resets user of any troll effects.");
|
||||||
|
@ -456,9 +439,12 @@ public Action Command_ApplyUser(int client, int args) {
|
||||||
menu.ExitButton = true;
|
menu.ExitButton = true;
|
||||||
menu.Display(client, 0);
|
menu.Display(client, 0);
|
||||||
}else{
|
}else{
|
||||||
char arg1[32], arg2[32];
|
char arg1[32], arg2[32], arg3[8];
|
||||||
GetCmdArg(1, arg1, sizeof(arg1));
|
GetCmdArg(1, arg1, sizeof(arg1));
|
||||||
GetCmdArg(2, arg2, sizeof(arg2));
|
GetCmdArg(2, arg2, sizeof(arg2));
|
||||||
|
GetCmdArg(3, arg3, sizeof(arg3));
|
||||||
|
|
||||||
|
bool silent = StrEqual(arg3, "silent", "hide", "quiet");
|
||||||
|
|
||||||
int mode = StringToInt(arg2);
|
int mode = StringToInt(arg2);
|
||||||
if(mode == 0) {
|
if(mode == 0) {
|
||||||
|
@ -484,7 +470,7 @@ public Action Command_ApplyUser(int client, int args) {
|
||||||
for (int i = 0; i < target_count; i++)
|
for (int i = 0; i < target_count; i++)
|
||||||
{
|
{
|
||||||
if(IsClientConnected(target_list[i]) && IsClientInGame(target_list[i]) && GetClientTeam(target_list[i]) == 2)
|
if(IsClientConnected(target_list[i]) && IsClientInGame(target_list[i]) && GetClientTeam(target_list[i]) == 2)
|
||||||
ApplyModeToClient(client, target_list[i], view_as<trollMode>(mode), TrollMod_None);
|
ApplyModeToClient(client, target_list[i], view_as<trollMode>(mode), TrollMod_None, silent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue