31.07.2013, 13:10
Emh.. its a bit hard than you think..
I mean:
This should help you to understand the logic.
Then the PHP should save the string he get, anyway a SQLite code might be better since is better to manage than a plain text.
The PAWN script is a simple HTTP request to a page w/ the IP of the connected player as param something like this:
<b>Important</b>: to get this working, when the player is connected w/ the app, the php page should report a response with "1".
I mean:
Код:
static void Main(string[] args)
{
string ip = null;
// Here your code to get the IP
if (ip != null)
{
// now the have the IP
// send it
Console.WriteLine("Your IP is: " + ip);
WebClient wc = new WebClient();
// i never used UploadString, but its just an example
// wc.UploadString("your_php_page", ip);
// then you are ok.
}
else
{
Console.WriteLine("Unable to get your IP");
}
}
Then the PHP should save the string he get, anyway a SQLite code might be better since is better to manage than a plain text.
The PAWN script is a simple HTTP request to a page w/ the IP of the connected player as param something like this:
Код:
public OnPlayerConnect(playerid)
{
new str [16 + 5];
new IP [16];
str = "d=";
GetPlayerIp( playerid , ip , 16 );
strcat(str, ip, 16+5);
HTTP(playerid, HTTP_GET, "your_url", str, "OhWait");
return true;
}
// remember to forward
public OhWait ( ... )
{
if (response_code == 200 && strval(data) == 1)
{
GivePlayerMoney ( playerid , 50 );
}
else
{
// Here or the WEBSITE is down
// Or the player is not connected using Your APP
}
}

