I use a array for cash which is:- stats[ player.ID ].Cash
Now when I do, stats[player.ID].Cash += 200;
Its 200, but the player.Cash is not getting updated, what to do?
If i use player.Cash, its not getting updated, so what shall i do now?
How to ensure that player.Cash = stats[ player.ID ].Cash, don't say me to change it, I have added it on many things
probably yes you need to change it First time this error also occur on my script you must use
player.Cash = stats[ player.ID ].Cash;
So where shall I add it?, and yes for sure you haven't read the whole topic
Just set player.Cash = pstats Cash when a player logins, then use player.Cash to increase, decrease or condition something. Do not use the pstats Cash. When the player leaves set player.Cash = pstats Cash.
I hope you got the point.
I know that, I have done stats cash everywhere(about 19 times), and I don't have time to edit that, anyways your trick is good, I'll surely use it!
Fixed. Thanks
@Doom_Killer
Haha Nice Trick
@Doom_Killer
If a player hacks and sets his cash to $xxxx, he'll have that much cash for free.
Instead use some function like AddCash( player, Cash )
Eg:
function AddCash( p, c )
{
pstats[p.ID].Cash += c.tointeger();
player.Cash = pstats[p.ID].Cash.tointeger();
}
That argument wont work, use
function AddCash( p, c )
{
pstats[p.ID].Cash += c.tointeger();
player.Cash = pstats[p.ID].Cash.tointeger();
}
"If a player hacks and sets his cash to $xxxx, he'll have that much cash for free.
Instead use some function like AddCash( player, Cash )"
Hacking still works?
Quote from: KAKAN on Sep 19, 2015, 11:40 AM"If a player hacks and sets his cash to $xxxx, he'll have that much cash for free.
Instead use some function like AddCash( player, Cash )"
Hacking still works?
Nope.
Player can only set his cash, not the server side one (if you use my method).
And, thanks Thijn.
Okay!