GivePlayerMoney

From SA-MP Wiki

(Redirected from Function:GivePlayerMoney)
Jump to: navigation, search


Description:

Give money to or take money from a player.


Parameters:
(playerid, money)
playeridThe ID of the player to give money to or take money from.
moneyThe amount of money to give the player. Use a minus value to take money.


Return Values:

  • 1: The function executed successfully.
  • 0: The function failed to execute. This means the player is not connected.


Example Usage:

public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID)
    {
       // Award $1000 to the killer
       GivePlayerMoney(killerid, 1000);
       SendClientMessage(killerid, -1, "You have been awarded $1000 for the kill.");
    }
 
    // Take $500 from the player who died.
    GivePlayerMoney(playerid, -500);
}

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