mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 21:43:22 +00:00
ftt: Bug fixes
This commit is contained in:
parent
3f5959ec71
commit
4002487677
7 changed files with 25 additions and 19 deletions
Binary file not shown.
|
@ -23,7 +23,7 @@ enum struct Troll {
|
|||
}
|
||||
|
||||
bool HasMod(trollModifier mod) {
|
||||
return ((this.flags >> view_as<int>(mod)) & 1) == view_as<int>(mod);
|
||||
return ((this.flags >> (view_as<int>(mod)) - 1) & 1) == 1;
|
||||
}
|
||||
|
||||
// Gets the default modifier to use
|
||||
|
@ -53,7 +53,7 @@ void ResetClient(int victim, bool wipe = true) {
|
|||
|
||||
int SetupTroll(const char[] name, const char description[128], int flags) {
|
||||
if(flags == 0) {
|
||||
ThrowError("Troll has no flags defined.");
|
||||
ThrowError("Troll \"%s\" has no flags defined.", name);
|
||||
return -1;
|
||||
}
|
||||
static int i = 0;
|
||||
|
@ -117,7 +117,7 @@ void ApplyTroll(int victim, const char[] name, int activator, trollModifier modi
|
|||
ShowActivity(victim, "deactivated troll \"%s\" on %N. ", troll.name, victim);
|
||||
} else {
|
||||
if(modifier == TrollMod_Constant)
|
||||
ShowActivity(victim, "activated troll \"%s\" on repeat for %N. ", troll.name, victim);
|
||||
ShowActivity(victim, "activated constant troll \"%s\" for %N. ", troll.name, victim);
|
||||
else
|
||||
ShowActivity(victim, "activated troll \"%s\" for %N. ", troll.name, victim);
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ void SetupTrolls() {
|
|||
SetupTroll("Tank Magnet", "Attracts ALL tanks to any alive target with this troll enabled", TrollMod_Constant);
|
||||
SetupTroll("Witch Magnet", "All witches when startled will target any player with this troll", TrollMod_Constant);
|
||||
SetupTroll("Vomit Player", "Shortcut to sm_vomitplayer. vomits the player.", TrollMod_Instant);
|
||||
SetupTroll("ThrowItAll", "Player throws all their items at nearby player, periodically", TrollMod_Instant | TrollMod_Constant);
|
||||
SetupTroll("Throw It All", "Player throws all their items at nearby player, periodically", TrollMod_Instant | TrollMod_Constant);
|
||||
SetupTroll("Vocalize Gag", "Prevents player from sending any vocalizations (even automatic)", TrollMod_Constant);
|
||||
SetupTroll("No Profanity", "Replaces some words with random phrases", TrollMod_Constant);
|
||||
SetupTroll("Swarm", "Swarms a player with zombies. Requires swarm plugin", TrollMod_Instant);
|
||||
|
@ -254,18 +254,18 @@ void SetupTrolls() {
|
|||
SetupTroll("Slow Speed", "Sets player speed to 0.8x of normal speed", TrollMod_Constant);
|
||||
SetupTroll("Higher Gravity", "Sets player gravity to 1.3x of normal gravity", TrollMod_Constant);
|
||||
SetupTroll("Half Primary Ammo", "Cuts their primary reserve ammo in half", TrollMod_Instant);
|
||||
SetupTroll("PrimaryDisable", "Player cannot pickup any weapons, only melee/pistols", TrollMod_Constant);
|
||||
SetupTroll("Primary Disable", "Player cannot pickup any weapons, only melee/pistols", TrollMod_Constant);
|
||||
SetupTroll("Clusmy", "Player drops axe periodically or on demand", TrollMod_Instant | TrollMod_Constant);
|
||||
SetupTroll("iCantSpellNoMore", "Chat messages letter will randomly changed with wrong letters", TrollMod_Instant);
|
||||
SetupTroll("KillMeSoftly", "Make player eat or waste pills whenever possible", TrollMod_Instant | TrollMod_Constant);
|
||||
SetupTroll("GunJam", "On reload, small chance their gun gets jammed - Can't reload.", TrollMod_Constant);
|
||||
SetupTroll("NoPickup", "Prevents a player from picking up ANY (new) item. Use ThrowItAll to make them drop", TrollMod_Constant);
|
||||
SetupTroll("Gun Jam", "On reload, small chance their gun gets jammed - Can't reload.", TrollMod_Constant);
|
||||
SetupTroll("No Pickup", "Prevents a player from picking up ANY (new) item. Use ThrowItAll to make them drop", TrollMod_Constant);
|
||||
SetupTroll("Honk", "Honk", TrollMod_Constant);
|
||||
SetupTroll("No Shove", "Prevents a player from shoving", TrollMod_Constant);
|
||||
SetupTroll("Damage Boost", "Makes a player take more damage than normal", TrollMod_Constant);
|
||||
SetupTroll("Temp Health Quick Drain", "Makes a player's temporarily health drain very quickly", TrollMod_Constant);
|
||||
SetupTroll("Slow Drain", "Will make the player slowly lose health over time", TrollMod_Constant);
|
||||
SetupTroll("CameTooEarly", "When they shoot, random chance they empty whole clip", TrollMod_Constant);
|
||||
SetupTroll("Meow", "Makes the player meow", false);
|
||||
SetupTroll("Meow", "Makes the player meow", TrollMod_Constant);
|
||||
//INFO: UP MAX_TROLLS when adding new trolls!
|
||||
}
|
|
@ -261,7 +261,6 @@ public Action Command_ListModes(int client, int args) {
|
|||
|
||||
public Action Command_ListTheTrolls(int client, int args) {
|
||||
int count = 0;
|
||||
//TODO: Update
|
||||
char[][] modeListArr = new char[MAX_TROLLS+1][MAX_TROLL_NAME_LENGTH];
|
||||
static char modeList[255];
|
||||
for(int i = 1; i < MaxClients; i++) {
|
||||
|
|
|
@ -213,14 +213,13 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
|
|||
CPrintToChatAll("{blue}%N {default}: %s", client, newMessage);
|
||||
return Plugin_Handled;
|
||||
}else if(IsTrollActive(client, "NoProfanity")) {
|
||||
//TODO: Check all replacement words, if none were replaced then do full word
|
||||
//TODO: Lowercase .getstring
|
||||
static char strings[32][MAX_PHRASE_LENGTH];
|
||||
ArrayList phrases;
|
||||
bool foundWord = false;
|
||||
int words = ExplodeString(sArgs, " ", strings, 32, MAX_PHRASE_LENGTH);
|
||||
for(int i = 0; i < words; i++) {
|
||||
if(REPLACEMENT_PHRASES.GetValue(strings[i], phrases) && phrases.Length > 0) {
|
||||
//TODO: Check for valid working
|
||||
if((phrases = GetPhrasesArray(strings[i])) && phrases.Length > 0) {
|
||||
foundWord = true;
|
||||
int c = phrases.GetString(GetRandomInt(0, phrases.Length - 1), strings[i], MAX_PHRASE_LENGTH);
|
||||
PrintToServer("replacement: %s (%d)", strings[i], c);
|
||||
|
|
|
@ -66,13 +66,13 @@ public int ChoosePlayerHandler(Menu menu, MenuAction action, int param1, int par
|
|||
trollMenu.SetTitle("Choose a troll mode");
|
||||
//TODO: Update
|
||||
static char id[8];
|
||||
static char name[MAX_TROLL_NAME_LENGTH];
|
||||
static Troll troll;
|
||||
for(int i = 0; i <= MAX_TROLLS; i++) {
|
||||
GetTrollID(i, name);
|
||||
GetTrollByKeyIndex(i, troll);
|
||||
// int trollIndex = GetTrollByKeyIndex(i, troll);
|
||||
// Pass key index
|
||||
Format(id, sizeof(id), "%d|%d", userid, i);
|
||||
trollMenu.AddItem(id, name);
|
||||
trollMenu.AddItem(id, troll.name);
|
||||
}
|
||||
trollMenu.ExitButton = true;
|
||||
trollMenu.Display(param1, 0);
|
||||
|
|
|
@ -68,7 +68,6 @@ stock bool IsPlayerIncapped(int client) {
|
|||
#define MAX_PHRASES_PER_WORD 8
|
||||
#define MAX_PHRASE_LENGTH 191
|
||||
StringMap REPLACEMENT_PHRASES;
|
||||
//TODO: Load from cfg
|
||||
/* Example:
|
||||
exWord
|
||||
{
|
||||
|
@ -96,6 +95,7 @@ void LoadPhrases() {
|
|||
static char buffer[4];
|
||||
do {
|
||||
kv.GetSectionName(word, sizeof(word));
|
||||
StringToLower(word);
|
||||
phrases.Clear();
|
||||
for(;;) {
|
||||
IntToString(++i, buffer, sizeof(buffer));
|
||||
|
@ -108,3 +108,14 @@ void LoadPhrases() {
|
|||
} while (kv.GotoNextKey(false));
|
||||
delete kv;
|
||||
}
|
||||
|
||||
ArrayList GetPhrasesArray(const char[] key) {
|
||||
int len = strlen(key);
|
||||
char[] keyLower = new char[len];
|
||||
for(int i = 0; i < len; i++) {
|
||||
keyLower[i] = CharToLower(key[i]);
|
||||
}
|
||||
ArrayList phrases;
|
||||
REPLACEMENT_PHRASES.GetValue(keyLower, phrases);
|
||||
return phrases;
|
||||
}
|
|
@ -16,8 +16,6 @@
|
|||
#include <ftt>
|
||||
#include <multicolors>
|
||||
|
||||
#undef REQUIRE_PLUGIN
|
||||
#include <adminmenu>
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
|
@ -32,7 +30,6 @@ public Plugin myinfo =
|
|||
//TODO: Friendly trolling VS punishment trolling
|
||||
//TODO: Trolls: Force take pills, Survivor Bot Magnet
|
||||
|
||||
//plugin start
|
||||
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) {
|
||||
if(late) {
|
||||
lateLoaded = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue