business system

This commit is contained in:
Lorenc 2017-09-21 21:11:41 +10:00
parent 5c1a0ae5f7
commit a67fa3bcaa
7 changed files with 5856 additions and 1920 deletions

10
ac_config.ini Normal file
View File

@ -0,0 +1,10 @@
[defaults]
main_ac_checks = 1
inf_sprint = 1
sprint_all_surfaces = 1
macro_limits = 1
switch_reload = 1
crouch_bug = 9999
frame_limit = 9999
vehicle_blips = 1
sprint_speed_limit = 0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -138,11 +138,7 @@ public OnRconLoginAttempt(ip[], password[], success)
if( strcmp( name, "Lorenc", true ) ) if( strcmp( name, "Lorenc", true ) )
{ {
#if defined CNR_SERVER
BanPlayerISP( playerid );
#else
RangeBanPlayer( playerid ); RangeBanPlayer( playerid );
#endif
return 0; return 0;
} }
} }
@ -250,3 +246,40 @@ stock Float: GetDistanceBetweenPlayers( iPlayer1, iPlayer2, &Float: fDistance =
return fDistance; return fDistance;
} }
stock RangeBanPlayer( playerid )
{
if ( !IsPlayerConnected( playerid ) )
return 0;
new
szBan[ 24 ],
szIP[ 16 ]
;
GetPlayerIp( playerid, szIP, sizeof( szIP ) );
GetRangeIP( szIP, sizeof( szIP ) );
format( szBan, sizeof( szBan ), "banip %s", szIP );
SendRconCommand( szBan );
KickPlayerTimed( playerid );
return 1;
}
stock GetRangeIP( szIP[ ], iSize = sizeof( szIP ) )
{
new
iCount = 0
;
for( new i; szIP[ i ] != '\0'; i ++ )
{
if ( szIP[ i ] == '.' && ( iCount ++ ) == 1 )
{
strdel( szIP, i, strlen( szIP ) );
break;
}
}
format( szIP, iSize, "%s.*.*", szIP );
return szIP;
}

View File

@ -5,19 +5,19 @@
*/ */
// Macros // Macros
#define GetPlayerHost(%1) (g_lookup_PlayerData[%1][E_HOST]) //#define GetPlayerHost(%1) (g_lookup_PlayerData[%1][E_HOST])
#define GetPlayerISP(%1) (g_lookup_PlayerData[%1][E_ISP]) //#define GetPlayerISP(%1) (g_lookup_PlayerData[%1][E_ISP])
#define GetPlayerCountryCode(%1) (g_lookup_PlayerData[%1][E_CODE]) #define GetPlayerCountryCode(%1) (g_lookup_PlayerData[%1][E_CODE])
#define GetPlayerCountryName(%1) (g_lookup_PlayerData[%1][E_COUNTRY]) #define GetPlayerCountryName(%1) (g_lookup_PlayerData[%1][E_COUNTRY])
#define GetPlayerCountryRegion(%1) (g_lookup_PlayerData[%1][E_REGION]) //#define GetPlayerCountryRegion(%1) (g_lookup_PlayerData[%1][E_REGION])
#define IsProxyUser(%1) (g_lookup_PlayerData[%1][E_PROXY]) //#define IsProxyUser(%1) (g_lookup_PlayerData[%1][E_PROXY])
#define IsProxyEnabledForPlayer(%1) (g_lookup_Success{%1}) #define IsProxyEnabledForPlayer(%1) (g_lookup_Success{%1})
// Variables // Variables
enum E_LOOKUP_DATA enum E_LOOKUP_DATA
{ {
E_HOST[ 60 ], E_CODE[ 3 ], E_COUNTRY[ 45 ], E_CODE[ 3 ], E_COUNTRY[ 45 ]
E_REGION[ 43 ], E_ISP[ 128 ], E_PROXY //E_REGION[ 43 ], E_ISP[ 128 ], E_PROXY
}; };
stock stock
@ -50,23 +50,26 @@ stock LookupPlayerIP( playerid ) {
GetPlayerIp( playerid, szIP, sizeof( szIP ) ); GetPlayerIp( playerid, szIP, sizeof( szIP ) );
format( szQuery, sizeof( szQuery ), "iphub.info/api.php?ip=%s&showtype=2", szIP ); format( szQuery, sizeof( szQuery ), "freegeoip.net/csv/%s", szIP );
return HTTP( playerid, HTTP_GET, szQuery, "", "OnLookupResponse" ); return HTTP( playerid, HTTP_GET, szQuery, "", "OnLookupResponse" );
} }
stock ResetPlayerIPData( playerid ) { stock ResetPlayerIPData( playerid ) {
format( g_lookup_PlayerData[ playerid ] [ E_HOST ], 10, "Unknown" ); //format( g_lookup_PlayerData[ playerid ] [ E_HOST ], 10, "Unknown" );
format( g_lookup_PlayerData[ playerid ] [ E_CODE ], 3, "XX" ); format( g_lookup_PlayerData[ playerid ] [ E_CODE ], 3, "XX" );
format( g_lookup_PlayerData[ playerid ] [ E_COUNTRY ], 10, "Unknown" ); format( g_lookup_PlayerData[ playerid ] [ E_COUNTRY ], 10, "Unknown" );
format( g_lookup_PlayerData[ playerid ] [ E_REGION ], 10, "Unknown" ); //format( g_lookup_PlayerData[ playerid ] [ E_REGION ], 10, "Unknown" );
format( g_lookup_PlayerData[ playerid ] [ E_ISP ], 10, "Unknown" ); //format( g_lookup_PlayerData[ playerid ] [ E_ISP ], 10, "Unknown" );
g_lookup_PlayerData[ playerid ] [ E_PROXY ] = 0; //g_lookup_PlayerData[ playerid ] [ E_PROXY ] = 0;
g_lookup_Success{ playerid } = 0; g_lookup_Success{ playerid } = 0;
} }
// Callbacks // Callbacks
public OnLookupResponse( playerid, response, data[ ] ) { public OnLookupResponse( playerid, response, data[ ] ) {
static
CountryData[ 96 ];
if( !IsPlayerConnected( playerid ) ) if( !IsPlayerConnected( playerid ) )
return 0; return 0;
@ -81,7 +84,17 @@ public OnLookupResponse( playerid, response, data[ ] ) {
} }
else else
{ {
if( sscanf( data, "p< >e<s[60]s[3]s[45]s[43]s[128]d>", g_lookup_PlayerData[ playerid ] ) ) new
firstComma = strfind( data, ",", true ),
secondComma = strfind( data, ",", true, firstComma + 1 ),
thirdComma = strfind( data, ",", true, secondComma + 1 )
;
strmid( CountryData, data, firstComma + 1, thirdComma );
//printf("Received data:%s",CountryData);
//210.50.38.234,AU,Australia,VIC,Victoria,Melbourne,3000,Australia/Melbourne,-37.8103,144.9544,0
if( sscanf( CountryData, "p<,>e<s[3]s[45]>", g_lookup_PlayerData[ playerid ] ) ) // "p< >e<s[60]s[3]s[45]s[43]s[128]d>"
{ {
if( !g_lookup_Retry{ playerid } ) { if( !g_lookup_Retry{ playerid } ) {
g_lookup_Retry{ playerid } = 1; g_lookup_Retry{ playerid } = 1;
@ -92,8 +105,9 @@ public OnLookupResponse( playerid, response, data[ ] ) {
} }
else else
{ {
//printf("Information: %s %s \n",g_lookup_PlayerData[ playerid ] [ E_CODE ], g_lookup_PlayerData[ playerid ] [ E_COUNTRY ] );
strreplacechar( g_lookup_PlayerData[ playerid ] [ E_COUNTRY ], '_', ' ' ); strreplacechar( g_lookup_PlayerData[ playerid ] [ E_COUNTRY ], '_', ' ' );
strreplacechar( g_lookup_PlayerData[ playerid ] [ E_ISP ], '_', ' ' ); //strreplacechar( g_lookup_PlayerData[ playerid ] [ E_ISP ], '_', ' ' );
g_lookup_Success{ playerid } = 1; g_lookup_Success{ playerid } = 1;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ maxplayers 325
port 7777 port 7777
hostname » Call of Duty For SA-MP (0.3.7) « hostname » Call of Duty For SA-MP (0.3.7) «
gamemode0 sf-cnr 1 gamemode0 sf-cnr 1
filterscripts filterscripts iVO
announce 0 announce 0
query 1 query 1
weburl www.sa-mp.com weburl www.sa-mp.com
@ -14,7 +14,7 @@ incar_rate 40
weapon_rate 40 weapon_rate 40
stream_distance 300.0 stream_distance 300.0
stream_rate 1000 stream_rate 1000
plugins mysql crashdetect sscanf streamer socket Whirlpool regex gvar FileManager profiler FCNPC plugins mysql crashdetect sscanf streamer socket Whirlpool regex gvar FileManager profiler FCNPC mapandreas RouteConnectorPlugin
maxnpc 200 maxnpc 200
logtimeformat [%H:%M:%S] logtimeformat [%H:%M:%S]
language All language All