Skip to content

Max Stamina

Ghecco edited this page Jul 10, 2020 · 2 revisions

Note:

The player's current stamina depends on his maximum stamina.

With these functions, if the current stamina is greater than the maximum stamina, it will be set as the latter.

GetPlayerMaxStamina(playerid)

  • Get the player's maximum stamina, the maximum stamina is an integar.

Example:

public OnPlayerDisconnect(playerid, reason)
{
        printf("The Player's Max Stamina value = %d", GetPlayerMaxStamina(playerid));
        return 1;
}

GivePlayerMaxStamina(playerid, value)

  • Add / Subtract the player's maximum stamina, the value is an integar.
  • The current stamina will never exceed the max stamina value.

Example:

public OnPlayerStaminaOver(playerid)
{
        SetPlayerExhausted(playerid, true);
        GivePlayerMaxStamina(playerid, 1);
        return 1;
}

SetPlayerMaxStamina(playerid, value)

  • Set the player's maximum stamina, the value is an integar.
  • The current stamina will never exceed the max stamina value.

Example:

public OnPlayerSpawn(playerid)
{
        SetPlayerMaxStamina(playerid, -1); // When GivePlayerStamina or SetPlayerStamina is called they will also set the current stamina to -1.
        return 1;
}