01.09.2014, 12:26
pawn Код:
CMD:oipcheck(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
if(!sscanf(params, "s[64]", tmp))
{
new dotcount = 0;
for(new i = 0; i < strlen(tmp); i++)
{
if(tmp[i] == '.') dotcount++;
}
if(dotcount == 3)
{
new link[256];
format(ipchecking[playerid], 24, "%s", tmp);
format(link, sizeof(link), "api.ipinfodb.com/v3/ip-city/?key=********&ip=%s", tmp);
HTTP(playerid, HTTP_GET, link, "", "IPCheckResponse");
}
else
{
format(ipchecking[playerid], 24, "%s", tmp);
strcat(tmp, ".ini")
if(!fexist(tmp)) return SendClientMessage(playerid, COLOR_GRAD1, "That player does not exist.");
new link[256];
format(link, sizeof(link), "api.ipinfodb.com/v3/ip-city/?key=******&ip=%s", dini_Get(tmp, "IP"));
HTTP(playerid, HTTP_GET, link, "", "IPCheckResponse");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /oipcheck [Player Name or IP]");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
return 1;
}