<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.bzflag.org/index.php?action=history&amp;feed=atom&amp;title=Bz_IPBanUser</id>
	<title>Bz IPBanUser - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.bzflag.org/index.php?action=history&amp;feed=atom&amp;title=Bz_IPBanUser"/>
	<link rel="alternate" type="text/html" href="https://wiki.bzflag.org/index.php?title=Bz_IPBanUser&amp;action=history"/>
	<updated>2026-04-06T14:11:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://wiki.bzflag.org/index.php?title=Bz_IPBanUser&amp;diff=8059&amp;oldid=prev</id>
		<title>Sigonasr2: Create API Function Page. Include Example.</title>
		<link rel="alternate" type="text/html" href="https://wiki.bzflag.org/index.php?title=Bz_IPBanUser&amp;diff=8059&amp;oldid=prev"/>
		<updated>2011-10-19T07:50:45Z</updated>

		<summary type="html">&lt;p&gt;Create API Function Page. Include Example.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{apicall&lt;br /&gt;
| name        = bz_IPBanUser&lt;br /&gt;
| returns     = Whether or not the ban was executed successfully.&lt;br /&gt;
| returntype  = bool&lt;br /&gt;
| description = Sets up a new IP Rule in the ban list. &amp;#039;&amp;#039;&amp;#039;Note&amp;#039;&amp;#039;&amp;#039; 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.&lt;br /&gt;
| param1      = bannedByIndex&lt;br /&gt;
| param1type  = int&lt;br /&gt;
| param1desc  = The player ID that is banning the IP Address. &amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; 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.&lt;br /&gt;
| param2      = ip&lt;br /&gt;
| param2type  = const char*&lt;br /&gt;
| param2desc  = The IP Address string to ban. Note that this can contain wildcard (*) characters for higher level bans.&lt;br /&gt;
| param3      = duration&lt;br /&gt;
| param3type  = int&lt;br /&gt;
| param3desc  = The amount of time in minutes to ban the player.&lt;br /&gt;
| param4      = reason&lt;br /&gt;
| param4type  = const char*&lt;br /&gt;
| param4desc  = The reason that is displayed to the banned user upon failure to join.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
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.&lt;br /&gt;
 case bz_ePlayerDieEvent: {&lt;br /&gt;
 	if ((double)bz_getPlayerTKs(((bz_PlayerDieEventData_V1*)eventData)-&amp;gt;killerID)&lt;br /&gt;
 	/(double)(bz_getPlayerWins(((bz_PlayerDieEventData_V1*)eventData)-&amp;gt;killerID)&lt;br /&gt;
 		+bz_getPlayerLosses(((bz_PlayerDieEventData_V1*)eventData)-&amp;gt;killerID))&lt;br /&gt;
 	&amp;gt;0.3&lt;br /&gt;
 	&amp;amp;&amp;amp;&lt;br /&gt;
 	bz_getPlayerWins(((bz_PlayerDieEventData_V1*)eventData)-&amp;gt;killerID)&lt;br /&gt;
 		+bz_getPlayerLosses(((bz_PlayerDieEventData_V1*)eventData)-&amp;gt;killerID)&lt;br /&gt;
 		+bz_getPlayerTKs(((bz_PlayerDieEventData_V1*)eventData)-&amp;gt;killerID)&amp;gt;=5) {&lt;br /&gt;
 			//Ban the teamkiller and kick them&lt;br /&gt;
 			bz_IPBanUser(((bz_PlayerDieEventData_V1*)eventData)-&amp;gt;killerID,&lt;br /&gt;
 				bz_getPlayerIPAddress(((bz_PlayerDieEventData_V1*)eventData)-&amp;gt;killerID),&lt;br /&gt;
 				60,&amp;quot;Auto Ban for Intentional Teamkilling.&amp;quot;);&lt;br /&gt;
 			bz_kickUser(((bz_PlayerDieEventData_V1*)eventData)-&amp;gt;killerID,&lt;br /&gt;
 				&amp;quot;Auto Ban for Intentional Teamkilling.&amp;quot;,true);&lt;br /&gt;
 		};&lt;br /&gt;
 }break;&lt;br /&gt;
&lt;br /&gt;
More information on this function can be found on the [[BZFS_API_2.4_Upgrade]] page.&lt;/div&gt;</summary>
		<author><name>Sigonasr2</name></author>
	</entry>
</feed>