Money working server-side, but not player-side
#1

The money on my server is working correctly, and displays in a /stats command, but it doesn't show up in the player's HUD (top right), that just says 0, no matter what i do.
That also makes it impossible to use stuff as Pay'N'Spray or tuning cars, and generally annoying and confusing.

I have no idea what code in the script might be causing this, but anyone has any idea?
Reply
#2

Код:
OnPlayerUpdate(playerid)
{
 GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
 return 1;
}
Reply
#3

Quote:
Originally Posted by Runn3R
Посмотреть сообщение
Код:
OnPlayerUpdate(playerid)
{
 GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
 return 1;
}
That would make his money explode.

You need to subtract the player's current money value.
Reply
#4

pawn Код:
forward UpdateMoney();
public UpdateMoney()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        ResetPlayerMoney(i);
        GivePlayerMoney(i,PlayerInfo[i][Cash]); // your money var here.
    }
}
// OnGameModeInIt
SetTimer("UpdateMoney",1000,1);
Reply
#5

Why set a timer thats going to loop hundreds of times a second and not have checks in place to see if the playerid is valid or not?

pawn Код:
IsPlayerConnected(playerid);
here's how i do it http://pastebin.com/P2RBfCUA just an example of a basic server side money. Of course you'd have to add checks for vending machines, pay n sprays and tune shops.
Reply
#6

I would just create my own textdraw over the money and give them a 99999999 every time they spawn since they wouldn't see it anyways that would take care of repairing/modshops etc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)