01.09.2015, 11:04
I did a server side for SetPlayerHealth and look:
This is debug
Where is the problem i don`t understand, i don`t found any bugs ....
This function is called per every minute
PHP код:
PUBLIC: SetPlayerHealthEx(playerid, Float:health)
{
new Float:tmp_health = health,Float:newhp;
if (tmp_health < 0.0) tmp_health = 0.0;
else if (tmp_health > 100.0) tmp_health = 100.0;
AntiCheatInfo[playerid][acHealth] = tmp_health;
SetPlayerHealth(playerid, tmp_health);
GetPlayerHealth(playerid, newhp);
printf("GetPlayerHealth: %.01f\nAntiCheatHealth: %.01f\nHealth: %.01f", newhp, AntiCheatInfo[playerid][acHealth], tmp_health);
return 1;
}
PHP код:
GetPlayerHealth: 99.0
AntiCheatHealth: 98.0
Health: 98.0
PHP код:
PUBLIC: PlayerHealthLoss()
{
new Float:oldhealth, Float:amount;
foreach(Player, x)
{
if(PlayerInfo[x][pStatus] == 1)
{
GetPlayerHealth(x, oldhealth);
amount = floatsub(oldhealth, 1.0);
SetPlayerHealthEx(x, amount);
}
}
return 1;
}