Skip to content

Commit

Permalink
fixed logic error, change alerts to be in chat instead
Browse files Browse the repository at this point in the history
  • Loading branch information
higps committed Apr 20, 2024
1 parent 9afd008 commit 1c519ad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
10 changes: 6 additions & 4 deletions berobot_dmg_handler.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1195,9 +1195,9 @@ public Action Event_post_inventory_application(Event event, const char[] name, b
{
if (IsValidWeaponForClassBuff(Weapon1))
{
stat1 = 0.85;
TF2Attrib_SetByName(Weapon1, "dmg taken from fire reduced", stat1);
Format(chat_display, sizeof(chat_display), "%s\n{teamcolor}Pyro: {orange}+%0.0f%%%% fire resistance",chat_display, LessIsMore(stat1));
stat1 = 0.85;
TF2Attrib_SetByName(Weapon1, "dmg taken from fire reduced", stat1);
Format(chat_display, sizeof(chat_display), "%s\n{teamcolor}Pyro: {orange}+%0.0f%%%% fire resistance",chat_display, LessIsMore(stat1));
}

if (IsThirdDegree(Weapon3))
Expand Down Expand Up @@ -3330,11 +3330,13 @@ public void CheckSpellBook(int iClient)
bool IsValidWeaponForClassBuff(int weapon)
{

if (weapon == -1 && weapon <= MaxClients)
if (weapon != -1)
{
PrintToChatAll("Was valid weapon");
return true;
}else
{
PrintToChatAll("Was not valid weapon");
return false;
}
}
Expand Down
12 changes: 8 additions & 4 deletions berobot_handler.sp
Original file line number Diff line number Diff line change
Expand Up @@ -2227,7 +2227,8 @@ int Native_EnsureRobotCount(Handle plugin, int numParams)
//Only type this one time when damage value is restarted
if (g_f_Damage_Bonus == -1.0 && (g_b_changed_dmg || !g_b_broadcast_msg))
{
PrintCenterTextAll("Alert: Robot Power Restored\nRobots take normal damage");
// PrintCenterTextAll("Alert: Robot Power Restored\nRobots take normal damage");
MC_PrintToChatAll("{magenta}Alert: Robot Power Restored\nRobots take normal damage");
g_b_broadcast_msg = true;
}

Expand All @@ -2237,7 +2238,8 @@ int Native_EnsureRobotCount(Handle plugin, int numParams)
{
char word[5]; // Assuming "more" or "less" won't exceed 4 characters
GetDamageWord(word, sizeof(word));
PrintCenterTextAll("Alert: Low Power!\nRobots take %.0f %% %s damage!", (g_f_Damage_Bonus-1.0)*100,word);
MC_PrintToChatAll("{magenta}Alert: Low Power!\nRobots take {orange}%.0f %% %s {magenta}damage!", (g_f_Damage_Bonus-1.0)*100,word);
// PrintCenterTextAll("Alert: Low Power!\nRobots take %.0f %% %s damage!", (g_f_Damage_Bonus-1.0)*100,word);
g_b_broadcast_msg = true;
}

Expand All @@ -2258,7 +2260,8 @@ int Native_EnsureRobotCount(Handle plugin, int numParams)
{
char word[5]; // Assuming "more" or "less" won't exceed 4 characters
GetDamageWord(word, sizeof(word));
PrintCenterTextAll("Alert: High Power!\nRobots take %.0f %% %s damage!", (g_f_Damage_Bonus-1.0)*100, word);
MC_PrintToChatAll("{magenta}Alert: High Power!\nRobots take {orange}%.0f %% %s {magenta}damage!", (g_f_Damage_Bonus-1.0)*100,word);
// PrintCenterTextAll("Alert: High Power!\nRobots take %.0f %% %s damage!", (g_f_Damage_Bonus-1.0)*100, word);
g_b_broadcast_msg = true;
}

Expand All @@ -2275,7 +2278,8 @@ int Native_EnsureRobotCount(Handle plugin, int numParams)
{
char word[5]; // Assuming "more" or "less" won't exceed 4 characters
GetDamageWord(word, sizeof(word));
PrintCenterTextAll("Alert: Low Power!\nRobots take %.0f %% %s damage!", (g_f_Damage_Bonus-1.0)*100, word);
MC_PrintToChatAll("{magenta}Low Power!\nRobots take {orange}%.0f %% %s {teamcolmagentaor}damage!", (g_f_Damage_Bonus-1.0)*100,word);
// PrintCenterTextAll("Alert: Low Power!\nRobots take %.0f %% %s damage!", (g_f_Damage_Bonus-1.0)*100, word);
g_b_broadcast_msg = true;
}
break;
Expand Down

0 comments on commit 1c519ad

Please sign in to comment.