SetPlayerScore

From SA-MP Wiki

Jump to: navigation, search


Description:

Set a player's score. Players' scores are shown in the scoreboard (shown by holding the TAB key).


Parameters:
(playerid, score)
playeridThe ID of the player to set the score of.
scoreThe value to set the player's score to.


Return Values:

  • 1: The function executed successfully.
  • 0: The function failed to execute. This means the player specified does not exist.


Example Usage:

public OnPlayerDeath(playerid, killerid, reason)
{
    // Add 1 to this killer's score. We must check it is valid first.
    if(killerid != INVALID_PLAYER_ID)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    }
    return 1;
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

Personal tools
Navigation
Toolbox
In other languages