The open.mp logo
Home
FAQ
Forums
Servers
Partners
Docs
Blog

warning Not Translated

This page has not been translated into the language that your browser requested yet. The English content is being shown as a fallback.

If you want to contribute a translation for this page then please click here.

GivePlayerMoney

Description

Give money to or take money from a player.

NameDescription
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.

Returns

1: The function was executed successfully.

0: The function failed to execute. This means the player is not connected.

Examples

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

  • ResetPlayerMoney: Set the money of a player to \$0.
  • GetPlayerMoney: Check how much money a player has.

Community

  • Discord
  • Instagram
  • Twitter
  • Twitch
  • YouTube
  • Facebook
  • VK

More

  • SA-MP
  • Blog
  • GitHub