added functions for target immunity testing

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40546
This commit is contained in:
David Anderson
2007-02-27 03:32:14 +00:00
parent 52de18813c
commit 09887584f4
4 changed files with 63 additions and 0 deletions
+21
View File
@@ -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];
+11
View File
@@ -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.
*