From BZFlagWiki
Revision as of 07:50, 19 October 2011 by Sigonasr2 (Talk | contribs) (Create API Function Page. Include Example.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

bool bz_IPBanUser (int bannedByIndex, const char* ip, int duration, const char* reason)

Sets up a new IP Rule in the ban list. Note that if the player is currently playing when their IP address is banned it will not take effect immediately until they rejoin. This can be counteracted by kicking the player upon the ban, or using bz_IDBanUser() instead.

bannedByIndex  -  The player ID that is banning the IP Address. NOTE: This has to be a player that is currently on the server, so at least one player must be present for a ban to be created.
ip  -  The IP Address string to ban. Note that this can contain wildcard (*) characters for higher level bans.
duration  -  The amount of time in minutes to ban the player.
reason  -  The reason that is displayed to the banned user upon failure to join.
Whether or not the ban was executed successfully.


This code will check if the TK ratio is greater than 0.3 (30%) after at least 5 rounds of play. If so, the player will be IP Banned and kicked. This is basically an auto TK ban method.

case bz_ePlayerDieEvent: {
	if ((double)bz_getPlayerTKs(((bz_PlayerDieEventData_V1*)eventData)->killerID)
		+bz_getPlayerTKs(((bz_PlayerDieEventData_V1*)eventData)->killerID)>=5) {
			//Ban the teamkiller and kick them
				60,"Auto Ban for Intentional Teamkilling.");
				"Auto Ban for Intentional Teamkilling.",true);

More information on this function can be found on the BZFS_API_2.4_Upgrade page.