Raised This Month: $94 Target: $400
 23% 

Show GeoIP


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Statistical        Approver:   Geesu (62)
Indiana
Member
Join Date: Nov 2004
Location: Landshut, Germany
Old 12-30-2004 , 15: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 - 9566 views - 2.4 KB)
Indiana is offline
Indiana
Member
Join Date: Nov 2004
Location: Landshut, Germany
Old 12-30-2004 , 18:32  
Reply With Quote #2

A Screenshot say more than words ...
Indiana is offline
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 12-31-2004 , 08:14   nice
Reply With Quote #3

nice done man.
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
ToT | V!PER
Senior Member
Join Date: Jun 2004
Location: Germany
Old 01-07-2005 , 14:08  
Reply With Quote #4

Could you include the function to show the country the players are from, while beeing spectator/specmode?

You could display it below the playername you´re specating.
ToT | V!PER is offline
Send a message via ICQ to ToT | V!PER
Kamikaze
Senior Member
Join Date: Mar 2004
Location: Butler, PA
Old 01-07-2005 , 14:32  
Reply With Quote #5

If I add this, this will be my third GEOIP plugin, nice job.

If you add the specating info, I can remove the one plugin I have that already does this
Kamikaze is offline
Send a message via ICQ to Kamikaze Send a message via AIM to Kamikaze Send a message via MSN to Kamikaze Send a message via Yahoo to Kamikaze
Indiana
Member
Join Date: Nov 2004
Location: Landshut, Germany
Old 01-07-2005 , 15:27  
Reply With Quote #6

I didn't sea any reason to merge them into one plugin.
Maybe somebody didn't want the spec. country info.
__________________
C'ya
Indiana

Visit my Fun-Clan: www.wc3-freaks.de
Indiana is offline
ToT | V!PER
Senior Member
Join Date: Jun 2004
Location: Germany
Old 01-08-2005 , 05:05  
Reply With Quote #7

Because if you are running two plugins which nearly do the same, both plugins are checking for IPs. You could simply use some cvars/menu to turn stuff on/off. ;-)
ToT | V!PER is offline
Send a message via ICQ to ToT | V!PER
Indiana
Member
Join Date: Nov 2004
Location: Landshut, Germany
Old 01-08-2005 , 06:45  
Reply With Quote #8

if you turn off something by cvar, the plugin must check every time the cvar.
if you remove a plugin from the .ini, it is absolut off.

They will nearly do the same, but haven't really any shared code.
==> no benefit to merge them.
__________________
C'ya
Indiana

Visit my Fun-Clan: www.wc3-freaks.de
Indiana is offline
Geesu
AMX Mod X Plugin Approver
Join Date: Mar 2004
Location: Cincinnati, OH
Old 12-13-2005 , 11:50  
Reply With Quote #9

Author PM me to have this plugin approved

Pls fix SS
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
reggienoble
Junior Member
Join Date: Jan 2006
Old 01-11-2006 , 00:00  
Reply With Quote #10

hm doenst work... still playas from france or us are connecting to the server... but plugin is running... and the comands amx_whogeo works...
reggienoble is offline
Reply


Thread Tools
Display Modes

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 02:02.


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