GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health+30);
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health+50);
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health+100);
GetPlayerHealth(playerid, health); health += value; SetPlayerHealth(playerid, value > 100 ? 100 : value);
Dependendo do contexto da aplicaзгo, vocк pode usar o mуdulo matemбtico. (%)
Ou vocк apenas mandar verificar se jб estourou o limite... para verificar se jб estourou o limite, basta fazer um if no comando. Код:
GetPlayerHealth(playerid, health); health += value; SetPlayerHealth(playerid, value > 100 ? 100 : value); |
if(GetPlayerHealth(playerid, health) > 100);
{
SendClientMessage(playerid, -1, "Voce nao usar mais medicamento");
return 1;
}
GetPlayerHealth(playerid, health); health += value; if (health > 100) { //Mensagem de nгo pode usar mais medicamento } else { SetPlayerHealth(playerid, health); }
GetPlayerHealth(playerid, health);
health += value;
SetPlayerHealth(playerid, value > 100 ? 100 : value);
GetPlayerHealth(playerid, health);
health += value;
SetPlayerHealth(playerid, health > 100 ? 100 : health);