mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
fixed bug at40963
This commit is contained in:
parent
87ac42cd98
commit
6ac889f6e2
@ -3,10 +3,19 @@
|
||||
|
||||
GeoIP *gi = NULL;
|
||||
|
||||
inline void StripPort(char *ip)
|
||||
{
|
||||
char *tmp = strchr(ip, ':');
|
||||
if (!tmp)
|
||||
return;
|
||||
*tmp = '\0';
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL amx_geoip_code2(AMX *amx, cell *params)
|
||||
{
|
||||
int len = 0;
|
||||
char *ip = MF_GetAmxString(amx, params[1], 0, &len);
|
||||
StripPort(ip);
|
||||
const char *ccode = GeoIP_country_code_by_addr(gi, ip);
|
||||
return MF_SetAmxString(amx, params[2], ccode?ccode:"error", 3);
|
||||
}
|
||||
@ -15,6 +24,7 @@ static cell AMX_NATIVE_CALL amx_geoip_code3(AMX *amx, cell *params)
|
||||
{
|
||||
int len = 0;
|
||||
char *ip = MF_GetAmxString(amx, params[1], 0, &len);
|
||||
StripPort(ip);
|
||||
const char *ccode = GeoIP_country_code3_by_addr(gi, ip);
|
||||
return MF_SetAmxString(amx, params[2], ccode?ccode:"error", 4);
|
||||
}
|
||||
@ -23,6 +33,7 @@ static cell AMX_NATIVE_CALL amx_geoip_country(AMX *amx, cell *params)
|
||||
{
|
||||
int len = 0;
|
||||
char *ip = MF_GetAmxString(amx, params[1], 0, &len);
|
||||
StripPort(ip);
|
||||
const char *ccode = GeoIP_country_name_by_addr(gi, ip);
|
||||
return MF_SetAmxString(amx, params[2], ccode?ccode:"error", params[3]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user