21.09.2015, 01:34
Why would you want to use HTTP interactions and not simply connect to the MySQL server? Though, you can if you absolutely need to use the HTTP(pretty easy to find) function.
e.g:
e.g:
pawn Код:
#include <a_samp>
#include <a_http>
#include <zcmd>
#include <sscanf2>
CMD:searchbans(playerid, params[])
{
new playerName[MAX_PLAYER_NAME];
if(sscanf(params, "s[25]", playerName))
return SendClientMessage(playerid, 0xFF08080FF, "USAGE: /searchbans [playerName]");
new string[128];
format(string, sizeof string, "http://yoursite.com/banlog.txt?name=%s", playerName);
HTTP(playerid, HTTP_GET, string, "", "OnBanLogSearch");
return 1;
}
forward OnBanLogSearch(index, response_code, data[]);
public OnBanLogSearch(index, response_code, data[])
{
if(IsPlayerConnected(index))
{
if(response_code != 200)
return SendClientMessage(index, 0xFF08080FF, "A HTTP error occured.");
ShowPlayerDialog(index, 0, DIALOG_STYLE_MSGBOX, "Banlog - search", data, "Close", "");
}
return 1;
}