Difference between revisions of "Bz hasPerm"

From BZFlagWiki
Jump to: navigation, search
(New page: {{apicall | name = bz_hasPerm | description = Checks to see if the player specified has the permission specified. | param1 = playerID | param1type = int | param1desc ...)
 
 
Line 11: Line 11:
 
| returns      = True if the player specified has the permission specified, false if they do not have the permission specified
 
| returns      = True if the player specified has the permission specified, false if they do not have the permission specified
 
}}
 
}}
 +
 +
===Example===
 +
Using a groups file, if you specify the +OPERATOR permission (You make it up) and then check for that permission upon a player join, you can as an example, set a player as the operator.
 +
case bz_ePlayerJoinEvent: {
 +
if (bz_hasPerm(((bz_PlayerJoinPartEventData_V1*)eventData)->playerID,"OPERATOR")) {
 +
bz_setPlayerOperator(((bz_PlayerJoinPartEventData_V1*)eventData)->playerID);
 +
}
 +
}break;

Latest revision as of 05:17, 19 October 2011

bool bz_hasPerm (int playerID, const char* perm)


Checks to see if the player specified has the permission specified.

Parameters:
playerID  -  The id of the player to check
perm  -  The name of the permission to check for
Returns:
True if the player specified has the permission specified, false if they do not have the permission specified


Example[edit]

Using a groups file, if you specify the +OPERATOR permission (You make it up) and then check for that permission upon a player join, you can as an example, set a player as the operator.

case bz_ePlayerJoinEvent: {
	if (bz_hasPerm(((bz_PlayerJoinPartEventData_V1*)eventData)->playerID,"OPERATOR")) {
		bz_setPlayerOperator(((bz_PlayerJoinPartEventData_V1*)eventData)->playerID);
	}
}break;