Участник
Пользователь
- Сообщения
- 290
- Реакции
- 28
- Помог
- 2 раз(а)
Does anyone know or can create a plugin like this but with sxgeo?:D
Код:
#include < amxmodx >
#include < amxmisc >
#include < geoip >
#define STR_LEN 32
#define PLUGIN "SHOW IP + LAST IP"
#define VERSION "2.0"
#define AUTHOR "Alka + x"
enum _:Infos
{
gUserIp[ STR_LEN ],
gUserName[ STR_LEN ],
gUserAuthID[ STR_LEN ]
}
new gLastUsers[ 5 ][ Infos ];
#pragma semicolon 1
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_concmd( "amx_showip", "cmd_showip" );
register_concmd( "amx_last", "cmdLastIp" );
}
public cmd_showip ( id )
{
if (( get_user_flags ( id ) & ADMIN_SLAY ) )
{
console_print( id, "IP-urile prezente pe server sunt:" );
console_print( id, "------------------------------------------------" );
new players[ 32 ], num;
get_players( players, num );
new i;
new szCountry[ 20 ];
for( i=0; i<num; i++ )
{
new name[ 32 ];
new ip[ 32 ];
new steamid[ 34 ];
get_user_name( players[ i ], name, 31 );
get_user_ip( players[ i ], ip, 31, 1 );
get_user_authid( players[ i ], steamid, 34 );
geoip_country_ex( ip, szCountry, 19 );
console_print( id, " - %s - %s - %s - %s", name, ip, steamid, szCountry );
}
console_print(id, "-----------------------------------------------");
}
return PLUGIN_HANDLED;
}
public cmdLastIp( id )
{
if (( get_user_flags ( id ) & ADMIN_SLAY ) )
{
if( !gLastUsers[ 0 ][ gUserName ][ 0 ] )
{
console_print ( id, "[LastIp] Inca nu a iesit nici un jucator de pe server." );
return 1;
}
for( new i = 0; i < 5; i++ )
{
if( !gLastUsers [i] [gUserName] [0] || ! gLastUsers [i] [gUserIp ] [0] || !gLastUsers [i] [gUserAuthID] [0] )
continue;
console_print ( id,"%s - %s - %s", gLastUsers [i] [gUserName], gLastUsers [i] [gUserIp], gLastUsers [i] [gUserAuthID] );
}
}
return 1;
}
public client_disconnected( id )
{
static sName[ 32 ];
get_user_name( id, sName, sizeof sName - 1 );
for( new i = 0; i < sizeof gLastUsers; i++ )
{
if( equali ( gLastUsers [i] [gUserName], sName ) )
return 1;
}
static iNum;
get_user_name ( id, gLastUsers [iNum] [gUserName], STR_LEN - 1 );
get_user_ip ( id, gLastUsers [iNum] [gUserIp], STR_LEN - 1, 1 );
get_user_authid ( id, gLastUsers [iNum][ gUserAuthID], STR_LEN - 1 );
iNum++;
if( iNum >= 5 )
iNum = 0;
return 0;
}