14.01.2011, 10:56
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
image3.php
and sa-mp code:
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);
}
?>
Код:
<?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);
?>
Код:
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, "", "");
}


... when I posted this message I thought it's one too much so I removed it lol..