diff --git a/plugins/l4d2_feedthetrolls.smx b/plugins/l4d2_feedthetrolls.smx index 3bae44c..a8574d7 100644 Binary files a/plugins/l4d2_feedthetrolls.smx and b/plugins/l4d2_feedthetrolls.smx differ diff --git a/plugins/l4d2_hats.smx b/plugins/l4d2_hats.smx index ccf9280..9bb1f8f 100644 Binary files a/plugins/l4d2_hats.smx and b/plugins/l4d2_hats.smx differ diff --git a/scripting/include/feedthetrolls/misc.inc b/scripting/include/feedthetrolls/misc.inc index 4e13a4f..9a27b0b 100644 --- a/scripting/include/feedthetrolls/misc.inc +++ b/scripting/include/feedthetrolls/misc.inc @@ -176,7 +176,7 @@ ArrayList GetPhrasesArray(const char[] key) { stock int FindClosestClientAdminPriority(int source, float pos[3]) { int c = FindClosestAdmin(source, pos); - if(c == -1) return FindClosestClient(source, ignoreBots, pos); + if(c == -1) return FindClosestClient(source, true,pos); else return c; } diff --git a/scripting/include/feedthetrolls/trolls.inc b/scripting/include/feedthetrolls/trolls.inc index 2ad4208..cd2987a 100644 --- a/scripting/include/feedthetrolls/trolls.inc +++ b/scripting/include/feedthetrolls/trolls.inc @@ -527,7 +527,7 @@ bool ApplyAffect(int victim, const Troll troll, int activator, trollModifier mod while(numFlags > 0) { // Apply a random flag rndFlags |= GetRandomInt(0, maxFlags) - maxFlags--; + numFlags--; } trollModifier rndMod = Trolls[rndTroll].GetDefaultMod(); if(Trolls[rndTroll].HasMod(TrollMod_Constant) && GetURandomFloat() > 0.5) { diff --git a/scripting/include/hats/hats.sp b/scripting/include/hats/hats.sp index c350525..dc77abb 100644 --- a/scripting/include/hats/hats.sp +++ b/scripting/include/hats/hats.sp @@ -125,6 +125,9 @@ Action Command_DoAHat(int client, int args) { ReplyToCommand(client, "Flags: %d", hatData[client].flags); // ReplyToCommand(client, "CurOffset: %f %f %f", ); return Plugin_Handled; + } else if(arg[0] == 'a') { + ShowAttachPointMenu(client); + return Plugin_Handled; } // int orgEntity = entity; if(HasFlag(client, HAT_REVERSED)) { @@ -455,13 +458,63 @@ Action Command_DoAHat(int client, int args) { } +#define MAX_ATTACHMENT_POINTS 20 +char ATTACHMENT_POINTS[MAX_ATTACHMENT_POINTS][] = { + "eyes", + "molotov", + "pills", + "grenade", + "primary", + "medkit", + "melee", + "survivor_light", + "bleedout", + "forward", + "survivor_neck", + "muzzle_flash", + "spine", + "legL", + "legR", + "thighL", + "thighR", + "lfoot", + "rfoot", + "mouth", +}; + +void ShowAttachPointMenu(int client) { + Menu menu = new Menu(AttachPointHandler); + menu.SetTitle("Choose an attach point"); + for(int i = 0; i < MAX_ATTACHMENT_POINTS; i++) { + menu.AddItem(ATTACHMENT_POINTS[i], ATTACHMENT_POINTS[i]); + } + menu.Display(client, 0); +} + +int AttachPointHandler(Menu menu, MenuAction action, int client, int param2) { + if (action == MenuAction_Select) { + char attachPoint[32]; + menu.GetItem(param2, attachPoint, sizeof(attachPoint)); + if(!HasHat(client)) { + ReplyToCommand(client, "No hat is equipped"); + } else { + int hat = GetHat(client); + char classname[32]; + GetEntityClassname(hat, classname, sizeof(classname)); + EquipHat(client, hat, classname, hatData[client].flags, attachPoint); + CReplyToCommand(client, "Attachment point set to {olive}%s", attachPoint); + } + } else if (action == MenuAction_End) + delete menu; + return 0; +} // Handles consent that a person to be hatted by another player -public int HatConsentHandler(Menu menu, MenuAction action, int target, int param2) { +int HatConsentHandler(Menu menu, MenuAction action, int target, int param2) { if (action == MenuAction_Select) { - static char info[8]; + char info[8]; menu.GetItem(param2, info, sizeof(info)); - static char str[2][8]; + char str[2][8]; ExplodeString(info, "|", str, 2, 8, false); int activator = GetClientOfUserId(StringToInt(str[0])); int hatAction = StringToInt(str[1]); diff --git a/scripting/l4d2_extraplayeritems.sp b/scripting/l4d2_extraplayeritems.sp index 0db8655..9d6939a 100644 --- a/scripting/l4d2_extraplayeritems.sp +++ b/scripting/l4d2_extraplayeritems.sp @@ -369,8 +369,6 @@ public void OnPluginStart() { } - - Action Timer_Director(Handle h) { if(abmExtraCount <= 4) return Plugin_Continue;