2021-05-12, 09:41 PM
2021-05-12: Adding y_groups Support
Obviously various YSI libraries have y_groups support, via functions such as:
But none of these functions actually exist anywhere in code - they?re all generated from a common template at compile-time.? And your own libraries can use the same pattern.? Assuming you are writing an Object library:
Then you just need a way for y_groups to enable and disable individual players.? This is done through a single function, all y_groups does is manage when to add and remove players by calling this one function:
AFter that very little code you have:
And far more.? All the y_groups functions, with ... replaced by your library name.
Obviously various YSI libraries have y_groups support, via functions such as:
Quote:
Group_SetCommand(Group:g, coommand, allowed);
bool:Group_AreaAllowed(Group:g, area);
Group_SetClassDefault(Group:g, allowed);
But none of these functions actually exist anywhere in code - they?re all generated from a common template at compile-time.? And your own libraries can use the same pattern.? Assuming you are writing an Object library:
Quote:
// Just the name, used to generate all the group function names.
#define GROUP_LIBRARY_NAME<%0...%1> %0Object%1
// The maximum number of entities your library can hold.
#define GROUP_LIBRARY_SIZE 512
// The tag for your entity IDs.? Can be ommitted for `_:`.
#define GROUP_LIBRARY_TAG Obj
// And include y_groups after all the defines above (it will undefine them).
#include <YSI_Players\y_groups>
Then you just need a way for y_groups to enable and disable individual players.? This is done through a single function, all y_groups does is manage when to add and remove players by calling this one function:
Quote:
Object_SetPlayer(Obj:entity, playerid, bool:set)
{
____// Do whatever you want here to enable this entity for this player.
}
AFter that very little code you have:
- Group_SetObject(Group:g, Obj:e, set);
- Group_SetObjectDefault(Group:g, Obj:e, set);
- Group_SetGlobalObject(Group:g, Obj:e, set);
And far more.? All the y_groups functions, with ... replaced by your library name.