AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Player Location 0.7b (https://forums.alliedmods.net/showthread.php?t=16127)

anson_wongy 08-04-2005 06:48

Player Location 0.7b
 
3 Attachment(s)
This plugin will let u know where ppl come from.
And auto kick player with in one of two modes.

Command:
amx_showloc <@CT, @T , @ALL or nick>(Or leave blank for showing all players)

It will reply like this:
(Team display mode)
Code:

Location info of players:
=================================
ID | Name | Ping | Loss | IP | Location | Code
1 | 008DEADinHK | 20 | 0 | 221.127.239.177 | Hong Kong | HK
2 | player A | 25 | 0 | 221.126.141.165 | Hong Kong | HK
3 | player B | 33 | 0 | 218.254.195.87 | Hong Kong | HK
4 | player C | 107 | 3 | 221.215.105.66 | China | CN
5 | player D | 99 | 1 | 61.231.107.107 | Taiwan | TW
=================================
Total player listed: 5 players
========================

(Single player)
Code:

Here is some info of : Sprite | 008DEADinHK
=================================
ID: 1
Ping: 20
Loss: 0
IP: 221.127.239.177
Location: Hong Kong
Code: HK
=========================

CVars:
amx_loc_kick_mode 0 - Auto kick mode (0 = off, 1 = kick players whose country code is amx_loc_kick_code, 2 = kick players whose country code is **NOT** amx_loc_kick_code)

amx_loc_kick_code "" - GeoIP *TWO* dgit code (list of codes are listed in a text file included in the package)

amx_loc_access 2 - Who can access amx_showloc (0 = No one, 1 = All players, 2 = Admin only)

====================================
GeoIP module **REQUIRED**

How to enable GeoIP module?
Open modules.ini, remove the semicolons before:
Code:

;geoip_amxx_i386.so
;geoip_amxx.dll
;geoip_amxx_amd64.so

like this:
Code:

geoip_amxx_i386.so
geoip_amxx.dll
geoip_amxx_amd64.so

Then, save ur files and restart ur server, that's all!

D_Hawk 08-04-2005 11:59

Good job, installing this right now.

Blitz 08-04-2005 14:00

Sweet Plugin...
Good job. :)

gudbjorn 12-26-2005 06:16

Re: Player Location 0.7b
 
Quote:

Originally Posted by anson_wongy
This plugin will let u know where ppl come from.
And auto kick player with in one of two modes.

Command:
amx_showloc <@CT, @T , @ALL or nick>(Or leave blank for showing all players)

It will reply like this:
(Team display mode)
Code:

Location info of players:
=================================
ID | Name | Ping | Loss | IP | Location | Code
1 | 008DEADinHK | 20 | 0 | 221.127.239.177 | Hong Kong | HK
2 | player A | 25 | 0 | 221.126.141.165 | Hong Kong | HK
3 | player B | 33 | 0 | 218.254.195.87 | Hong Kong | HK
4 | player C | 107 | 3 | 221.215.105.66 | China | CN
5 | player D | 99 | 1 | 61.231.107.107 | Taiwan | TW
=================================
Total player listed: 5 players
========================

(Single player)
Code:

Here is some info of : Sprite | 008DEADinHK
=================================
ID: 1
Ping: 20
Loss: 0
IP: 221.127.239.177
Location: Hong Kong
Code: HK
=========================

CVars:
amx_loc_kick_mode 0 - Auto kick mode (0 = off, 1 = kick players whose country code is amx_loc_kick_code, 2 = kick players whose country code is **NOT** amx_loc_kick_code)

amx_loc_kick_code "" - GeoIP *TWO* dgit code (list of codes are listed in a text file included in the package)

amx_loc_access 2 - Who can access amx_showloc (0 = No one, 1 = All players, 2 = Admin only)

====================================
GeoIP module **REQUIRED**

How to enable GeoIP module?
Open modules.ini, remove the semicolons before:
Code:

;geoip_amxx_i386.so
;geoip_amxx.dll
;geoip_amxx_amd64.so

like this:
Code:

geoip_amxx_i386.so
geoip_amxx.dll
geoip_amxx_amd64.so

Then, save ur files and restart ur server, that's all!


badboyz 12-26-2005 19:42

Great Plugin! Going on my server right now! Ill let you know if theres a problem or not.

jimmy_cr 01-09-2006 03:01

Great Plugin!!

I remade it to use more than one "code" - just write them to /configs/country.ini
every code on separate line

here's my code
Code:

//* AMX Mod X - Player Location Plugin
*
* by 008DEADinHK (anson_wongy)
*
* Website: XGamerHK.Com - http://xgamerhk.com - PLAY GAME BECAUSE GAME
* Forum: http://forum.xgamerhk.com
* E-Mail: [email protected] or [email protected]
*
* şôŻ¸: XGamerHK.Com - http://xgamerhk.com - ¬°ąCŔ¸ˇE¦ÓąCŔ¸
* ˝×ľÂ: http://forum.xgamerhk.com
* E-Mail: [email protected] or [email protected]
*
* Any question? Visit XGamerrHK Forum! http://forum.xgamerhk.com/
* ¦ł°ÝĂD? ĹwŞď¨ě XGAmerHK Forum µo°Ý! http://forum.xgamerhk.com/
*
* WARNING!: GeoIP module **REQUIRED** for this plugin.
* Ş`·N!: ¦ą´ˇĄó/Ą~±ľ»Ý*n GeoIP ĽŇ˛Ő.
*
* This plugin has been tested on AMXModX 1.01 successfully.
*
* CVars:
* amx_loc_kick_mode 0 - Auto kick mode
* (0 = off, 1 = kick players whose country code is amx_loc_kick_code, 2 = kick players whose country code is **NOT** amx_loc_kick_code)
*
* amx_loc_access 2 - Players who can access amx_showloc (0 = disabled, 1 = All players, 2 = Admin only)
*
****************************************************************************
*
*  This program is free software; you can redistribute it and/or
*  modify it under the terms of the GNU General Public License
*  as published by the Free Software Foundation; either version 2
*  of the License, or (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*
****************************************************************************
*/

#include <amxmodx>
#include <amxmisc>
#include <geoip>

new configsdir[200]
new configfile[200]
new country[255][2]
new totalcountries;


public plugin_init() {
        register_plugin("Player Location", "0.7b", "008DEADinHK (anson_wongy)")
       
        register_cvar("amx_loc_kick_mode", "0")
        register_cvar("amx_loc_access", "2")
       
        new showloc_access[2]
        get_cvar_string("amx_loc_access", showloc_access, 1)
       
        if (!equali(showloc_access, "0")) {
                if (!equali(showloc_access, "1")) {
                        register_concmd("amx_showloc", "show_playerlocation", ADMIN_KICK, "<target> - @ALL, @CT, @T, playername")
                } else if (!equali(showloc_access, "2")) {
                        register_concmd("amx_showloc", "show_playerlocation", -1, "<target> - @ALL, @CT, @T, playername")
                }
        }
        Load_File()
        Read_File()
}

public kickplayer(id) {
        new Reason[64]
        format(Reason, 63, "Player from your country/area isnt allowed to join this server.")
        server_cmd("kick #%d ^"%s^"", get_user_userid(id), Reason)
}

public client_authorized(id) {
        new kick_mode[2]
        new found
        new i
        get_cvar_string("amx_loc_kick_mode", kick_mode, 1)
       
        if (!equali(kick_mode, "0")) {
                new playerip[16], geoip_code[3], kick_code[3]
                get_user_ip(id, playerip, 15, 1)               
                if (!equali(playerip, "127.0.0.1")) {

                            if (equali(kick_mode, "1")) {
                                found = 0
                        }
                        if (equali(kick_mode, "2")) {
                                found = 1
                        }

//                        log_message("found set to %d", found)

                        for(i = 0 ;i < totalcountries; ++i) {

                                geoip_code2(playerip, geoip_code)

                                kick_code = country[i+1]

//                                new uname[33]
//                                get_user_name(id,uname,32)

                                if (equali(kick_mode, "1")) {
                                        if (equali(geoip_code[0], kick_code[0])) {
//                                                log_message("Player %s NOT approved to connect - %s", uname, geoip_code[0])
                                                found = 1
                                        }
                                } else if (equali(kick_mode, "2")) { 
                                        if (equali(geoip_code[0], kick_code[0])) {
//                                                log_message("Player %s approved to connect - %s", uname, geoip_code[0])
                                                found = 0
                                        }
                                }
                        }

                        if (found==1) {
                                kickplayer(id)
                        }
                }
        }       
        return PLUGIN_HANDLED
}

public show_playerlocation(id, level, cid) {
        if (!cmd_access(id,level,cid,1))
                return PLUGIN_HANDLED
       
        new Arg1[24]
        read_argv(1, Arg1, 23)
       
        if (equali(Arg1, "")) {
                format(Arg1, 24, "@ALL")
        }
               
        new playername[32], playerping, playerloss, playerip[16], playerloc[46], playerloccode[3]
        if (Arg1[0] == '@')
        {
                new Team = 0
                if (equali(Arg1[1], "CT")) {
                        Team = 2
                } else if (equali(Arg1[1], "T")) {
                        Team = 1
                  } else if (equali(Arg1[1], "ALL")) {
                          Team = 0
                  } else {
                          Team = 0
                  }
                  new players[32], num, i
                get_players(players, num)
               
               
                console_print(id, "Location info of players: ")
                console_print(id, "=================================")
                console_print(id, "ID | Name | Ping | Loss | IP | Location | Code")
               
                new playernum               
                for (i=0; i<num; i++)
                {
                        if (!Team)
                        {                               
                                get_user_name(players[i], playername, 31)
                                get_user_ip(players[i], playerip, 15, 1)
                                get_user_ping(players[i], playerping, playerloss)
                                if (!equali(playerip, "127.0.0.1")) {
                                        geoip_country(playerip, playerloc, 45)
                                        geoip_code2(playerip, playerloccode)
                                } else {
                                        format(playerloc, 45, "localhost (unknown)")
                                        format(playerloccode, 2, "")
                                }
                               
                                console_print(id, "%d | %s | %d | %d | %s | %s | %s", players[i], playername, playerping, playerloss, playerip, playerloc, playerloccode)
                                playernum++
                        } else {
                                if (get_user_team(players[i]) == Team)
                                {
                                        get_user_name(players[i], playername, 31)
                                        get_user_ip(players[i], playerip, 15, 1)
                                        get_user_ping(players[i], playerping, playerloss)
                                        if (!equali(playerip, "127.0.0.1")) {
                                                geoip_country(playerip, playerloc, 45)
                                                geoip_code2(playerip, playerloccode)
                                        } else {
                                                format(playerloc, 45, "localhost (unknown)")
                                                format(playerloccode, 2, "")
                                        }
                                        console_print(id, "%d | %s | %d | %d | %s | %s | %s", players[i], playername, playerping, playerloss, playerip, playerloc, playerloccode)
                                        playernum++                                       
                                }
                        }
                }
               
                console_print(id, "=================================")
                console_print(id, "Total player listed: %d players", playernum)
                console_print(id, "=================================")
        } else {
                new player = cmd_target(id, Arg1, 2)
                if (!player)
                {
                        console_print(id, "Sorry, player %s could not be found or targetted!", Arg1)
                        return PLUGIN_HANDLED
                } else {
                        get_user_name(player, playername, 31)
                        get_user_ip(player, playerip, 15, 1)
                        get_user_ping(player, playerping, playerloss)
                       
                        if (!equali(playerip, "127.0.0.1")) {
                                geoip_country(playerip, playerloc, 45)
                                geoip_code2(playerip, playerloccode)
                        } else {
                                format(playerloc, 45, "localhost (unknown)")
                                format(playerloccode, 2, "")
                        }
                       
                        console_print(id, "Here is some info of : %s", playername)
                        console_print(id, "=================================")
                        console_print(id, "ID: %d", player)
                        console_print(id, "Ping: %d", playerping)
                        console_print(id, "Loss: %d", playerloss)
                        console_print(id, "IP: %s", playerip)
                        console_print(id, "Location: %s", playerloc)
                        console_print(id, "Code: %s", playerloccode)
                        console_print(id, "=================================")
                }
        }
        return PLUGIN_HANDLED
}

public Load_File()
{
    get_configsdir(configsdir,63);
   
    format(configfile,63,"%s/country.ini",configsdir);
   
    if(!file_exists(configfile))
    {
        write_file(configfile,"CZ",0);
    }
}

public Read_File()
{
    new data[3][36],line,lnstr[256],len;
    totalcountries=0
    while(read_file(configfile,line++,data[0],255,len))
    {
        if(lnstr[0] == ';' || !len)
        {
            continue;
        }
        copyc(country[line],19,data[0],'.')
        totalcountries++;
    }
}

edit: repaired some code :oops:

Rilley 10-14-2007 08:28

Re: Player Location 0.7b
 
hy jimmy_cr, or somebody.. how can i make jimmy_cr`s EDIT to work .. like this -a new .INI (in amxmodx/configs/) were you can add some ISP`s(like 192.168.*! or 10.0. * classes of ip ) who can join to the server even the palyer_location is config.. for RO or ,, USA.. (ps: sorry for my bad english )

Krillin 12-11-2008 14:35

Re: Player Location 0.7b
 
Quote:

Originally Posted by anson_wongy (Post 136319)
====================================
GeoIP module **REQUIRED**

How to enable GeoIP module?
Open modules.ini, remove the semicolons before:
Code:

;geoip_amxx_i386.so
;geoip_amxx.dll
;geoip_amxx_amd64.so

like this:
Code:

geoip_amxx_i386.so
geoip_amxx.dll
geoip_amxx_amd64.so

Then, save ur files and restart ur server, that's all!

Lunix operators should be aware not to enable both .SO files on their servers.
like this:
Code:

;Enable below for x86 (32bit) builds
geoip_amxx_i386.so
;Enable below for windows builds
;geoip_amxx.dll
;Enable below for a64 (64bit) builds
;geoip_amxx_amd64.so

Enabling both of these on Linux could cause conflicts, security issues and crashes. So know exactly what you are working with before playing with these settings. 64 bit support was removed with version AMXX 1.8 so typically x86 should be used.

From what has been read and absorbed one should never enable what is never used therefore x86 should never have a a64 module running if not in use.

I hope this clears this clears up any confusion.

Also, not useful on connecting to server hosted in a LAN environment. Needs code to allow non-routeable IP addresses.

Quote:

Originally Posted by Network Working Group
Reference Page
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255

Sincerely,
Krillin

ObiPCPP 04-12-2009 20:49

Re: Player Location 0.7b
 
Does this still work and will it lag my server (TF2 server within Australia which I would like locked to AU and NZ players only)?

Marchello 04-09-2010 08:48

Re: Player Location 0.7b
 
is it possible to hide admin's location? So no one could see where the admin from, but still was able to see each other's location.


All times are GMT -4. The time now is 13:34.

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