Add some fixes, add manual throwitall refresh

This commit is contained in:
Jackz 2022-07-24 12:22:46 -05:00
parent 492d5b79ee
commit 280c67157e
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
5 changed files with 34 additions and 12 deletions

Binary file not shown.

View file

@ -256,7 +256,7 @@ public Action Command_ApplyUser(int client, int args) {
}
SilentMenuSelected[client] = false;
SetupCategoryMenu(client, target_list[0]);
SetupCategoryMenu(client, GetClientUserId(target_list[0]));
}
return Plugin_Handled;
}
@ -285,7 +285,7 @@ public Action Command_ApplyComboTrolls(int client, int args) {
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
ShowTrollCombosMenu(client, target_list[0]);
ShowTrollCombosMenu(client, GetClientUserId(target_list[0]));
}
return Plugin_Handled;
}
@ -329,7 +329,7 @@ public Action Command_ApplyUserSilent(int client, int args) {
}
ReplyToCommand(client, "[FTT] Unknown category: '%s'", arg2);
}
SetupCategoryMenu(client, target_list[0]);
SetupCategoryMenu(client, GetClientUserId(target_list[0]));
}
return Plugin_Handled;
}

View file

@ -32,6 +32,17 @@ public void OnClientPutInServer(int client) {
SDKHook(client, SDKHook_OnTakeDamage, Event_TakeDamage);
SDKHook(client, SDKHook_OnTakeDamageAlive, NerfGun_OnTakeDamage);
}
/* Projectile Magnet:
1. Create watch timer on EntityCreateCallback
2. Test velocity over time
3. If velocity goes negative, its at apex:
- TraceRay to victim
- If collision && molotov (maybe acid/):
Get End Position
If Distance From End Position & Victim < 100 units or so
Allow
- If no collision, set angle to player, set velocity accordingly
*/
public void OnEntityCreated(int entity, const char[] classname) {
if(entity >= MaxClients) {
if(StrEqual(classname, "infected", false))
@ -351,9 +362,15 @@ bool WillMagnetRun(const Troll troll, int i) {
}
public Action L4D2_OnEntityShoved(int client, int entity, int weapon, float vecDir[3], bool bIsHighPounce) {
if(client > 0 && client <= MaxClients && IsTrollActive(client, "No Shove") && hShoveFailChance.FloatValue > GetRandomFloat()) {
if(client > 0 && client <= MaxClients) {
static int noShoveIndex;
if(noShoveIndex == 0) noShoveIndex == GetTrollID("No Shove");
if(Trolls[noShoveIndex].IsActive(client) && GetRandomFloat() < hShoveFailChance.FloatValue) {
float shoveTime = L4D2Direct_GetNextShoveTime(client);
L4D2Direct_SetNextShoveTime(client, shoveTime + 2.0);
return Plugin_Handled;
}
}
return Plugin_Continue;
}

View file

@ -82,9 +82,9 @@ public int ChoosePlayerHandler(Menu menu, MenuAction action, int param1, int par
static char info[8];
menu.GetItem(param2, info, sizeof(info));
int userid = StringToInt(info);
int client = GetClientOfUserId(userid);
int victim = GetClientOfUserId(userid);
if(client == 0) {
if(victim == 0) {
ReplyToCommand(param1, "FTT: Could not acquire player");
return 0;
}
@ -146,9 +146,9 @@ public int ChooseCategoryHandler(Menu menu, MenuAction action, int param1, int p
static char str[2][8];
ExplodeString(info, "|", str, 2, 8, false);
int userid = StringToInt(str[0]);
int client = GetClientOfUserId(userid);
if(client == 0) {
ReplyToCommand(param1, "FTT: Could not acquire player");
int victim = GetClientOfUserId(userid);
if(victim == 0) {
ReplyToCommand(param1, "FTT/ChooseCategoryHandler: Could not acquire player");
return 0;
}
@ -171,7 +171,7 @@ public int ChooseModeMenuHandler(Menu menu, MenuAction action, int param1, int p
if (action == MenuAction_Cancel) {
if(param2 == MenuCancel_ExitBack) {
if(iMenuVictimID[param1] == 0) {
ReplyToCommand(param1, "FTT: Could not acquire player");
ReplyToCommand(param1, "FTT/ChooseModeMenuHandler: Could not acquire player");
}
SetupCategoryMenu(param1, iMenuVictimID[param1]);
}
@ -236,6 +236,8 @@ public int ChooseClumsySlotHandler(Menu menu, MenuAction action, int param1, int
for(int i = 0; i <= 4; i++) {
ThrowItemToPlayer(client, param1, i);
}
} else if(slot == -2) {
ShowThrowItAllMenu(param1, userid);
} else {
ThrowItemToPlayer(client, param1, slot);
}
@ -343,6 +345,7 @@ public void StopItemGive(int client) {
}
void SetupCategoryMenu(int client, int victimUserID) {
iMenuVictimID[client] = victimUserID;
Menu categoryMenu = new Menu(ChooseCategoryHandler);
static char category[64], id[16];
// Title with [ in name cause failure
@ -495,6 +498,9 @@ void ShowThrowItAllMenu(int client, int userid) {
itmMenu.SetTitle("Choose Item To Throw");
static char itmName[32];
Format(info, sizeof(info), "%d|-2", userid);
itmMenu.AddItem(info, "Refresh");
Format(info, sizeof(info), "%d|-1", userid);
itmMenu.AddItem(info, "All Items");

View file

@ -21,7 +21,6 @@ void SetupTrolls() {
#if defined _behavior_included
index = SetupTroll("Witch Magnet", "All witches when startled will target any player with this troll", TrollMod_Constant);
#endif
// fireSpitMagnetTrollIndex = SetupTroll("Fire & Acid Magnet", "Make the player gravitate toward danger", TRollMod_Constant);
/// CATEGORY: Infected
SetCategory("Infected");