This wiki is archived and useful information is being migrated to the main bzflag.org website

bz_hasPerm

From BZFlagWiki
Jump to: navigation, search

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;