mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-07 09: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];
|
||||
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.
|
||||
//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
|
||||
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);
|
||||
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);
|
||||
|
@ -218,13 +228,15 @@ void ApplyModeToClient(int client, int victim, trollMode mode, TrollModifier mod
|
|||
PrintToServer("Troll Mode #%d not implemented (%s)", mode, TROLL_MODES_NAMES[mode]);
|
||||
}
|
||||
}
|
||||
if(HasTrollMode(victim, mode)) {
|
||||
ShowActivity(client, "deactivated troll \"%s\" on %N. ", TROLL_MODES_NAMES[mode], victim);
|
||||
}else{
|
||||
if(modifier == TrollMod_Repeat)
|
||||
ShowActivity(client, "activated troll \"%s\" on repeat for %N. ", TROLL_MODES_NAMES[mode], victim);
|
||||
else
|
||||
ShowActivity(client, "activated troll \"%s\" for %N. ", TROLL_MODES_NAMES[mode], victim);
|
||||
if(!silent) {
|
||||
if(HasTrollMode(victim, mode)) {
|
||||
ShowActivity(client, "deactivated troll \"%s\" on %N. ", TROLL_MODES_NAMES[mode], victim);
|
||||
}else{
|
||||
if(modifier == TrollMod_Repeat)
|
||||
ShowActivity(client, "activated troll \"%s\" on repeat for %N. ", TROLL_MODES_NAMES[mode], victim);
|
||||
else
|
||||
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(modifier == TrollMod_Repeat || modifier == TrollMod_None) {
|
||||
|
|
|
@ -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 <sdktools>
|
||||
#include <sdkhooks>
|
||||
#include "jutils.inc"
|
||||
#include <multicolors>
|
||||
#include <jutils>
|
||||
#include <left4dhooks>
|
||||
#include <sceneprocessor>
|
||||
#include <feedthetrolls>
|
||||
|
||||
#undef REQUIRE_PLUGIN
|
||||
#include <adminmenu>
|
||||
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "L4D2 Feed The Trolls",
|
||||
|
@ -26,20 +25,6 @@ public Plugin myinfo =
|
|||
version = PLUGIN_VERSION,
|
||||
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
|
||||
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() {
|
||||
EngineVersion g_Game = GetEngineVersion();
|
||||
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);
|
||||
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_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.");
|
||||
|
@ -456,9 +439,12 @@ public Action Command_ApplyUser(int client, int args) {
|
|||
menu.ExitButton = true;
|
||||
menu.Display(client, 0);
|
||||
}else{
|
||||
char arg1[32], arg2[32];
|
||||
char arg1[32], arg2[32], arg3[8];
|
||||
GetCmdArg(1, arg1, sizeof(arg1));
|
||||
GetCmdArg(2, arg2, sizeof(arg2));
|
||||
GetCmdArg(3, arg3, sizeof(arg3));
|
||||
|
||||
bool silent = StrEqual(arg3, "silent", "hide", "quiet");
|
||||
|
||||
int mode = StringToInt(arg2);
|
||||
if(mode == 0) {
|
||||
|
@ -484,7 +470,7 @@ public Action Command_ApplyUser(int client, int args) {
|
|||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
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