Problem with HTTP Funtion
#1

related to this tutorial: https://sampforum.blast.hk/showthread.php?tid=188241

so I don't know what I've done wrong, however I guess I did something wrong...
my score is somehow not being saved in the window...

I needed to create the file ([HSA]Sgt.txt) on my own as it didn't do anything automatically... so my server IP is 217.18.70.196, therefore I used this IP in the get.php file....
what's wrong?

get.php
Код:
<?php
        if($_SERVER['REMOTE_ADDR'] == '217.18.70.196'){
        if(!isset($_GET['user'])) return false;
 
        if(isset($_GET['score']))
        {
                $file = fopen($_GET['user'] . '.txt', 'w');
                fwrite($file, $_GET['score']);
                fclose($file);
        }

?>
image3.php
Код:
<?php
	header('Content-type: image/png');
	$image = imagecreatefrompng('hsalogo.png');
	$file = fopen($_GET['user'] . '.txt', 'r');
	$score = fread($file, filesize($_GET['user'] . '.txt'));
	fclose($file);
	$black = imagecolorallocate($image, 0, 0, 0);
	imagettftext($image, 15, 0, 15, 45, $black, 'Carnevalee Freakshow.ttf', $_GET['user']);
	imagettftext($image, 15, 0, 30, 60, $black, 'Carnevalee Freakshow.ttf', 'Score: ' . $score);
	imagepng($image);
	imagedestroy($image);
?>
and sa-mp code:
Код:
forward UpdatePlayerImage(playerid);

public OnPlayerUpdate(playerid)
{
    UpdatePlayerImage(playerid);
    return 1;
}

public UpdatePlayerImage(playerid)
{
	new string[256], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	new score = GetPlayerScore(playerid);
	format(string, sizeof(string), "http://sgt-site.tk/hsa/get.php?user=%s&score=%d", pname, score);
	HTTP(-1, HTTP_HEAD, string, "", "");
}
Reply


Messages In This Thread
Problem with HTTP Funtion - by Sascha - 14.01.2011, 10:56
Re: Problem with HTTP Funtion - by Sascha - 14.01.2011, 14:40
Re: Problem with HTTP Funtion - by Jochemd - 14.01.2011, 15:03
Re: Problem with HTTP Funtion - by Sascha - 14.01.2011, 18:02
Re: Problem with HTTP Funtion - by Sascha - 14.01.2011, 18:12
Re: Problem with HTTP Funtion - by JaTochNietDan - 14.01.2011, 18:18
Re: Problem with HTTP Funtion - by Sascha - 14.01.2011, 18:38
Re: Problem with HTTP Funtion - by JaTochNietDan - 14.01.2011, 18:45
Re: Problem with HTTP Funtion - by Sascha - 14.01.2011, 20:16
Re: Problem with HTTP Funtion - by JaTochNietDan - 14.01.2011, 21:48

Forum Jump:


Users browsing this thread: 1 Guest(s)