Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //==========================================================
- // Cents include version 1.0 by MadeMan
- //==========================================================
- #if defined _cents_included
- #endinput
- #endif
- #define _cents_included
- stock Cents_GivePlayerMoney(playerid, dollars, cents=0)
- {
- new _cents = GetPVarInt(playerid, "Cents");
- _cents += cents;
- while(_cents > 99)
- {
- dollars++; _cents -= 100;
- }
- while(_cents < -99)
- {
- dollars--; _cents += 100;
- }
- new _cents_money = GetPlayerMoney(playerid)+dollars;
- if(_cents_money > 0 && _cents < 0)
- {
- dollars--; _cents += 100;
- }
- if(_cents_money < 0 && _cents > 0)
- {
- dollars++; _cents -= 100;
- }
- SetPVarInt(playerid, "Cents", _cents);
- new _cents_string[16];
- format(_cents_string, sizeof(_cents_string), "%02d", _cents);
- if(_cents_string[0] == '-') strdel(_cents_string, 0, 1);
- if(_cents < 0 || (_cents == 0 && _cents_money < 0)) strins(_cents_string, "~r~.", 0);
- else strins(_cents_string, "~g~.", 0);
- CallRemoteFunction("UpdateCentsDisplay", "ds", playerid, _cents_string);
- return GivePlayerMoney(playerid, dollars);
- }
- stock Cents_ResetPlayerMoney(playerid)
- {
- SetPVarInt(playerid, "Cents", 0);
- CallRemoteFunction("UpdateCentsDisplay", "ds", playerid, "~g~.00");
- return ResetPlayerMoney(playerid);
- }
- #define GivePlayerMoney Cents_GivePlayerMoney
- #define ResetPlayerMoney Cents_ResetPlayerMoney
- stock GetPlayerCents(playerid)
- {
- return GetPVarInt(playerid, "Cents");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement