Money Bug
#1

The problem is when a player recieves money from a job or an Admin when the player buys something he goes into minus. Example The player has 20000$ he buys something and goes -20000$ anyone know a way to fix this?
Reply
#2

Can you show us the code please. Make sure if you are using:

pawn Код:
GivePlayerMoney(playerid, 20000);
That you are not doing this.

pawn Код:
GivePlayerMoney(playerid, -20000);
That will take away all of the player's money.
Reply
#3

You need to check if the player has got enough money before taking it.

pawn Код:
if( GetPlayerMoney(playerid) >= 1000 )
{
    GivePlayerMoney(playerid, -1000);//player has 1000 or more so you can take it without going negative
}
else
{
    //player cannot afford $1000
}
Reply
#4

I am using the right one. the first one. I think the GM has a server side money system and thats the problem heres some code

Код:
#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney
Код:
//STOCKS
new Cash[MAX_PLAYERS];
stock GivePlayerCash(playerid, money)
{
    Cash[playerid] += money;
    ResetMoneyBar(playerid);//Resets Money in the original bar
    UpdateMoneyBar(playerid,Cash[playerid]);//Puts money in the original bar
    return Cash[playerid];
}
stock SetPlayerCash(playerid, money)
{
    Cash[playerid] = money;
    ResetMoneyBar(playerid);//Resets Money in the original bar
    UpdateMoneyBar(playerid,Cash[playerid]);//Puts money in the original bar
    return Cash[playerid];
}
stock ResetPlayerCash(playerid)
{
    Cash[playerid] = 0;
    ResetMoneyBar(playerid);//Resets Money in the original bar
    UpdateMoneyBar(playerid,Cash[playerid]);//Puts money in the original bar
    return Cash[playerid];
}
stock GetPlayerCash(playerid)
{
    return Cash[playerid];
}
I know its because of something like this because everything else is ok
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)