mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Cleanup some code from previous commits
This commit is contained in:
parent
553663c952
commit
e95d5ed43c
@ -124,13 +124,7 @@ static cell AMX_NATIVE_CALL amx_geoip_country_ex(AMX *amx, cell *params)
|
|||||||
int length;
|
int length;
|
||||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||||
|
|
||||||
int id = -1;
|
const char *path[] = { "country", "names", getLang(params[4]), NULL };
|
||||||
if (*params / sizeof(cell) >= 4)
|
|
||||||
{
|
|
||||||
id = params[4];
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *path[] = { "country", "names", getLang(id), NULL };
|
|
||||||
const char *country = lookupString(ip, path, &length);
|
const char *country = lookupString(ip, path, &length);
|
||||||
|
|
||||||
return MF_SetAmxStringUTF8Char(amx, params[2], country ? country : "", length, params[3] + 1);
|
return MF_SetAmxStringUTF8Char(amx, params[2], country ? country : "", length, params[3] + 1);
|
||||||
|
@ -167,7 +167,9 @@ const char *lookupString(const char *ip, const char **path, int *length)
|
|||||||
if (!lookupByIp(ip, path, &result))
|
if (!lookupByIp(ip, path, &result))
|
||||||
{
|
{
|
||||||
if (length)
|
if (length)
|
||||||
|
{
|
||||||
*length = 0;
|
*length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user