I have quite a bit of plugins managing different things with players - are they admins, donators, are they in the Steam group, are they in Friendly mode, have they joined via the favourites tab (and a bunch of my map-specific booleans), etc.
If I want to check for a certain player property in a different plugin, for example, if they have joined via the favourites tab, I'd have to create an .inc file for that specific plugin which is a lot of work for something that small. Checking the first three is a breeze since I can just check their flags, but there's only so many custom ones out there.
TL;DR Here -> Which brings me to my question: Is there an official way of setting certain properties of an (player) entity just for the sole reason of something else reading from it?
I was thinking of using some "unused" property of a player entity such as
m_hOwnerEntity or
m_flNextAttack or [TF2]
m_nCurrency (while not in MvM). But I think simply setting the name of the player entity to a flags number would be the best solution.
Another question: I have not been playing around with bitwise operations before, so please correct me if any of this is wrong:
PHP Code:
#define FLAG_NONE 0
#define FLAG_FRIENDLY 1
#define FLAG_JOINEDBYFAV 2
#define FLAG_BONUSSTAGE 4
#define FLAG_ARENASTAGE 8
#define FLAG_DUELCONTESTANT 16
new iPlayerFlags[MAXPLAYERS+1] = {0, ...};
OnArenaEnter(client){
iPlayerFlags[client] |= FLAG_ARENASTAGE;
}
OnArenaExit(client){
iPlayerFlags[client] |= ~FLAG_ARENASTAGE;
}
bool:IsClientInBonusStage(client){
if(iPlayerFlags[client] & FLAG_BONUSSTAGE)
return true;
return false;
}
Thanks for reading and any help; and a happy New Year to all!