Fix minor prompting bugs

This commit is contained in:
Jackzie 2022-03-15 20:56:04 -05:00
parent aedbf9d77b
commit ff3ba744fd
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
5 changed files with 14 additions and 13 deletions

Binary file not shown.

View file

@ -28,8 +28,8 @@ enum trollFlag {
StringMap trollKV;
char trollIds[MAX_TROLLS+1][MAX_TROLL_NAME_LENGTH];
char DEFAULT_FLAG_PROMPT_MULTIPLE[] = "Choose flags (Multiple)";
char DEFAULT_FLAG_PROMPT[] = "Choose flags";
char DEFAULT_FLAG_PROMPT_MULTIPLE[] = "Enable options (Multiple)";
char DEFAULT_FLAG_PROMPT[] = "Select an option";
bool SilentMenuSelected[MAXPLAYERS+1];
static int g_trollAddPromptIndex;

View file

@ -412,19 +412,19 @@ public Action Event_ItemPickup(int client, int weapon) {
int flags = Trolls[NoPickupIndex].activeFlagClients[client];
if(flags & 1 && GetPlayerWeaponSlot(client, view_as<int>(L4DWeaponSlot_Primary)) == weapon) {
// No Primary
return Plugin_Stop;
} else if(flags & 2 && StrEqual(wpnName, "weapon_melee")) {
return Plugin_Handled;
} else if(flags & 2 && GetEntityClassname(weapon, wpnName, sizeof(wpnName)) && StrEqual(wpnName, "weapon_melee")) {
// No melee
return Plugin_Stop;
return Plugin_Handled;
} else if(flags & 4 && GetPlayerWeaponSlot(client, view_as<int>(L4DWeaponSlot_Grenade)) == weapon) {
// No throwables
return Plugin_Stop;
} else if(flags & 8 && StrEqual(wpnName, "weapon_first_aid_kit")) {
return Plugin_Handled;
} else if(flags & 8 && GetEntityClassname(weapon, wpnName, sizeof(wpnName)) && StrEqual(wpnName, "weapon_first_aid_kit")) {
// No Kits
return Plugin_Stop;
return Plugin_Handled;
} else if(flags & 16 && GetPlayerWeaponSlot(client, view_as<int>(L4DWeaponSlot_Pills)) == weapon) {
// No Pills / Adr
return Plugin_Stop;
return Plugin_Handled;
}
return Plugin_Continue;
} else {

View file

@ -292,6 +292,7 @@ public int ChooseTrollFlagHandler(Menu menu, MenuAction action, int param1, int
static TrollFlagPrompt prompt;
// If told to go to next prompt, find the next VALID prompt
// Valid prompt is one where the required flags for it, are active
if(isDone || index == -1) {
int nextIndex = GetNextPrompt(troll, flags, index);
// If there is a prompt available, show it, else fall down
@ -506,7 +507,7 @@ int GetNextPrompt(Troll troll, int flags, int currentPrompt = 0) {
if(currentPrompt + 1 == troll.flagPrompts.Length) return -1;
for(int i = currentPrompt + 1; i < troll.flagPrompts.Length; i++) {
troll.GetFlagPrompt(i, prompt);
if(prompt.requireFlags & flags) {
if(flags & prompt.requireFlags == prompt.requireFlags) {
return i;
}
}

View file

@ -36,9 +36,9 @@ void SetupTrolls() {
Trolls[index].AddFlagPrompt(true);
Trolls[index].AddFlag("No Primary", false);
Trolls[index].AddFlag("No Melee", false);
Trolls[index].AddFlag("No Throwables", false);
Trolls[index].AddFlag("No Kits", false);
Trolls[index].AddFlag("No Pills / Adr", false);
Trolls[index].AddFlag("No Throwables", true);
Trolls[index].AddFlag("No Kits", true);
Trolls[index].AddFlag("No Pills / Adr", true);
index = SetupTroll("UziRules / AwpSmells", "Picking up a weapon gives them a UZI or AWP instead", TrollMod_Constant);
Trolls[index].AddFlagPrompt(false);
Trolls[index].AddFlag("UZI Only", true);