added functions for target immunity testing
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40546
This commit is contained in:
@@ -462,12 +462,33 @@ native FlagArrayToBits(const AdminFlag:array[], numFlags) =0;
|
||||
*/
|
||||
native FlagBitsToArray(bits, AdminFlag:array[], maxSize) =0;
|
||||
|
||||
/**
|
||||
* Tests whether one admin can target another.
|
||||
*
|
||||
* @param admin Admin doing the targetting (may be INVALID_ADMIN_ID).
|
||||
* @param target Target admin (may be INVALID_ADMIN_ID).
|
||||
* @return True if targetable, false if immune.
|
||||
*/
|
||||
native CanAdminTarget(AdminId:admin, AdminId:target);
|
||||
|
||||
/**
|
||||
* Converts a flag to its single bit.
|
||||
*
|
||||
* @param flag Flag to convert.
|
||||
* @return Bit representation of the flag.
|
||||
*/
|
||||
stock FlagToBit(AdminFlag:flag)
|
||||
{
|
||||
return (1<<_:flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a bit to an AdminFlag.
|
||||
*
|
||||
* @param bit Bit to convert.
|
||||
* @param flag Stores the converted flag by reference.
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
stock bool:BitToFlag(bit, &AdminFlag:flag)
|
||||
{
|
||||
new AdminFlag:array[1];
|
||||
|
||||
@@ -328,6 +328,17 @@ native SetUserFlagBits(client, flags);
|
||||
*/
|
||||
native GetUserFlagBits(client);
|
||||
|
||||
/**
|
||||
* Returns whether a user can target another user.
|
||||
* This is a helper function for CanAdminTarget.
|
||||
*
|
||||
* @param client Player's index.
|
||||
* @param target Target player's index.
|
||||
* @return True if target is targettable by the player, false otherwise.
|
||||
* @error Invalid or unconnected player indexers.
|
||||
*/
|
||||
native bool:CanUserTarget(client, target);
|
||||
|
||||
/**
|
||||
* Logs a generic message to the HL2 logs.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user