Combacior
Wiek: 29 Na forum: 5795 dni Posty: 1516
Piwa : 2161
Przyk?adowy skrypt, kt?ry wykrywa kraj gracza
Kod: #include <a_samp>
#include <a_http>
public OnPlayerConnect(playerid)
{
new IP[16],string[256];
GetPlayerIp(playerid, IP, sizeof(IP));
format(string,sizeof(string),"api.wipmania.com/%s",IP);
HTTP(playerid, HTTP_GET ,string, "", "MyHttpResponse");
return 1;
}
forward MyHttpResponse(index, response_code, data[]);
public MyHttpResponse(index, response_code, data[])
{
if(response_code == 403 || response_code == 404 || response_code == 500)
{
new pname[MAX_PLAYER_NAME], string[256];
GetPlayerName(index, pname, sizeof(pname));
format(string,sizeof(string),"%s connected",pname);
SendClientMessageToAll(0xffffffff,string);
}
else
{
new pname[MAX_PLAYER_NAME], string[256];
GetPlayerName(index, pname, sizeof(pname));
format(string,sizeof(string),"%s connected [country: %s]",pname,data);
SendClientMessageToAll(0xffffffff,string);
}
return 1;
}