dataviruset / sm-hosties

The ultimate jailbreak plugin for SourceMod
https://forums.alliedmods.net/forumdisplay.php?f=155
GNU General Public License v3.0
29 stars 27 forks source link

Trigger Announce_Rebel & ColorRebels on native ChangeRebelStatus #60

Closed shanapu closed 7 years ago

shanapu commented 7 years ago

When a plugin uses the native ChangeRebelStatus there was no announcement nor colouring for rebels.

This was my plugins workaround before:

//Extern ConVars
ConVar g_bHostiesAnnounce;
ConVar g_bHostiesAnnounceGlobal;
    g_bHostiesAnnounce = FindConVar("sm_hosties_announce_rebel");
    g_bHostiesAnnounceGlobal = FindConVar("sm_hosties_lr_send_global_msgs");
        if (g_bHostiesAnnounce.BoolValue && IsClientInGame(i))  //hosties cvars
        {
            if (g_bHostiesAnnounceGlobal.BoolValue) //hosties cvars
            {
                CPrintToChatAll("%t %t", "warden_tag", "New Rebel", i);  //hosties phrases
            }
            else
            {
                CPrintToChat(i, "%t %t", "warden_tag", "New Rebel", i);  //hosties phrases
                CPrintToChat(client, "%t %t", "warden_tag", "New Rebel", i);  //hosties phrases
            }
        }

I think this pull request should solve this much cleaner.

data-bomb commented 7 years ago

This will work, but I would like to have a MakeRebel function rather than have similar/same code in two different spots. One section might get forgotten about later if there is a change.

shanapu commented 7 years ago

You are right, I have not considered that. I found similar code on 4 spots in the code and 'merged' them to a new function.

shanapu commented 7 years ago

any news here?

data-bomb commented 7 years ago

This looks great! I added two quick safety checks for problems that we have run into in the past with this section of code.