//1.
new value = 105;
if (value > 100) value = 100;
//2.
new value = 108;
value = clamp(value, 0, 100);
|
pawn Код:
|
if(dialogid == DIALOG_FOODKIOSK)
{
if(response)
{
if(listitem == 0)
{
if(GetPlayerCash(playerid) < 30) return SCM(playerid, COLOR_GREEN, "[PRODAVAC]: "COL_WHITE"Nemate dovoljno novaca. Hotdog kosta 3$.");
if(PlayerInfo[playerid][pSnaga] == 100) return SCM(playerid, COLOR_GREEN, "[ZIVOT]: "COL_WHITE"Ne mozete vise jesti.");
SendClientMessage(playerid, COLOR_GREEN, "[PRODAVAC]: "COL_WHITE"Kupili ste hotdog. Dobar tek.");
GivePlayerCash(playerid, -3);
PlayerInfo[playerid][pSnaga] += 7;
SetPlayerHealth(playerid, +7);
}
//
}
return 1;
}
|
new Float:Health; GetPlayerHealth(playerid, Health); if(Health < 94) { SetPlayerHealth(playerid, +7); } |
PlayerInfo[playerid][pSnaga] = clamp(PlayerInfo[playerid][pSnaga] + 7, 0, 100)
SetPlayerHealth(playerid, PlayerInfo[playerid][pSnaga]);