Raised This Month: $51 Target: $400
 12% 

Show GeoIP


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Plugin Info:     Modification:   ALL        Category:   Statistical        Approver:   Geesu (62)
Indiana
Member
Join Date: Nov 2004
Location: Landshut, Germany
Old 12-30-2004 , 14:57   Show GeoIP
Reply With Quote #1

Hi,

here is my second plugin

Require geoip module loaded.
Permission: ADMIN_LEVEL_D

You get two client comands:
amx_whogeo
Is the same as amx_who but include the 2 and 45 length country code instead of the flaggs.
Nice to see where all the players came from.

amy_whostats
Output a HUD to ALL player with a statistic of players per country.
On the left side of the screen it looks like:
Code:
080% (08) Deutschland
020% (02) Austria
At the end of the plugin you see a out-commended function which kicks all connecting clients outside DE/AT/CH (=> Means only german speaking player can connect).
You can easly modify this function to match the countries you allaow.
Or convert it to only exclude some countries.
But don't forget to remove the comment lines to activate the function if you want them.

Code:
// indy_geoip.sma // Written by Indiana #include <amxmodx> #include <amxmisc> #include <geoip> public plugin_init() {     register_plugin("Show GeoIP", "0.2", "Indiana")     register_clcmd("amx_whogeo","cmdWhoGeoIP",ADMIN_LEVEL_D,"- displays all Players with Country")     register_clcmd("amx_whostats","cmdWhoStats",ADMIN_LEVEL_D,"- displays Country Stats")     register_dictionary("adminslots.txt")     return PLUGIN_CONTINUE } public cmdWhoStats(id,level,cid) {     if (!cmd_access(id, level, cid, 1))         return PLUGIN_HANDLED     new players[32], inum     new ip[17],ccode_a[46]     new StringList[32][46]     new IntList[32]     new ii, icount, inow     icount = 0     get_players(players,inum)     for (new a = 0; a < inum; ++a) {         get_user_ip(players[a],ip,16,1)         geoip_country ( ip, ccode_a , 45 )         inow = -1         for (ii = 0; ii < icount; ++ii) {             if(equal(StringList[ii],ccode_a)) {                 inow = ii             }         }         if(inow==-1) {             copy(StringList[icount], 45, ccode_a)             IntList[icount]=1             icount++         } else {             IntList[inow]++         }     }     new message[512], part[128]     copy(message,511,"Countries on the Server:")     for (new b = 0; b < icount; ++b) {         format( part , 127 , "^n %03d%% (%02d) %s",(IntList[b]*100/inum),IntList[b],StringList[b])         add(message,511,part)     }     set_hudmessage( 150, 150, 255, 0.02, -1.0 , 0, 1.0, 12.0, 0.1, 0.2,2)     show_hudmessage(0,message)     return PLUGIN_HANDLED } public cmdWhoGeoIP(id,level,cid) {     if (!cmd_access(id, level, cid, 1))         return PLUGIN_HANDLED     new players[32], inum     new authid[32], name[32]     new ip[17],ccode_a[3],ccode_c[46]     get_players(players,inum)     for (new a = 0; a < inum; ++a) {         get_user_authid(players[a],authid,31)         get_user_name(players[a],name,31)                 get_user_ip(players[a],ip,16,1)         geoip_code2 ( ip, ccode_a )         geoip_country ( ip, ccode_c, 45 )         console_print(id,"%2d  %-16.16s  %-20.20s  %s  %s", players[a],name,authid,ccode_a,ccode_c)     }     return PLUGIN_HANDLED } /* public client_connect(id) {     new ip[17],ccode_a[3]     get_user_ip(id,ip,16,1)     geoip_code2 ( ip, ccode_a )     if(equali(ccode_a,"DE")) return PLUGIN_CONTINUE     if(equali(ccode_a,"AT")) return PLUGIN_CONTINUE     if(equali(ccode_a,"CH")) return PLUGIN_CONTINUE     new lReason[64]     format(lReason,63,"%L",id,"DROPPED_RES")     server_cmd("kick #%d ^"%s^"", get_user_userid(id), lReason )     return PLUGIN_HANDLED } */
Attached Files
File Type: sma Get Plugin or Get Source (indy_geoip.sma - 10576 views - 2.4 KB)
Indiana is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:38.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode