17.02.2019, 21:49
By the way, should you set some variable on the server side to store the health of each player, and avoid the cheaters?
Something like this:
Something like this:
PHP код:
//OnPlayerConnect
Player_Info[playerid][player_Health] = 100.0;
SetPlayerHealth(playerid, Player_Info[playerid][player_Health]);
//OnPlayerTakeDamage
Player_Info[playerid][player_Health] -= amount;
if(Player_Info[playerid][player_Health] <= 0.0)
{
SetPlayerHealth(playerid, 0.0);
}
//Command /kill
CMD:kill(playerid, params[])
{
Player_Info[playerid][player_Health] = 0.0;
SetPlayerHealth(playerid, Player_Info[playerid][player_Health]);
return 1;
}
//Command /health
CMD:health(playerid, params[])
{
if(sscanf(params, "df", params[0], params[1])) return SendClientMessage(playerid,-1, "/health <playerid> <health>");
Player_Info[params[0]][player_Health] = params[1];
SetPlayerHealth(params[0], params[1]);
return 1;
}