Skip to content

Callback & Controls

Ghecco edited this page Jul 10, 2020 · 1 revision

OnPlayerStaminaOver(playerid) Callback

  • called when the player's current stamina reaches 0.

Example:

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

IsPlayerRunning(playerid)

  • Check if the player is running, true if he runs, else false.

Example:

public OnPlayerUpdate(playerid)
{
        if(IsPlayerRunning(playerid)) SendClientMessage(playerid, -1, "Running");
        return 1;
}

IsPlayerExhausted(playerid)

  • Get the player's PVAR "Exhausted", if it is 1 return true, else false.

Example:

public OnPlayerText(playerid, text[]))
{
        if(IsPlayerExhausted(playerid)) SendClientMessage(playerid, -1, "You cannot speak if you are exhausted.");
        return 1;
}

SetPlayerExhausted(playerid, bool:Exhausted)

  • Set the player's PVAR "Exhausted".
  • If it is true, the player will do a recovery animation, time is defined by: #define STAMINA_DEFAULT_RECOVERYTIME (4000)

Example:

public OnPlayerText(playerid, text[]))
{
        if(IsPlayerExhausted(playerid)) SendClientMessage(playerid, -1, "You cannot speak if you are exhausted.");
        return 1;
}