Money working server-side, but not player-side - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Money working server-side, but not player-side (
/showthread.php?tid=548412)
Money working server-side, but not player-side -
CalvinC - 29.11.2014
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?
Re: Money working server-side, but not player-side -
Runn3R - 29.11.2014
Код:
OnPlayerUpdate(playerid)
{
GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
return 1;
}
Re: Money working server-side, but not player-side -
Joe Staff - 29.11.2014
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.
Re: Money working server-side, but not player-side -
Beckett - 29.11.2014
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);
Re: Money working server-side, but not player-side -
DobbysGamertag - 29.11.2014
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.
Re: Money working server-side, but not player-side -
Pottus - 29.11.2014
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.