Cash error

Started by KAKAN, Sep 19, 2015, 06:20 AM

Previous topic - Next topic

KAKAN

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
oh no

FinchDon

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;
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

KAKAN

So where shall I add it?, and yes for sure you haven't read the whole topic
oh no

DizzasTeR

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.

KAKAN

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!
oh no

KAKAN

oh no

FinchDon

For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

rObInX

#7
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();
}

Thijn

That argument wont work, use
function AddCash( p, c )
{
    pstats[p.ID].Cash += c.tointeger();
    player.Cash = pstats[p.ID].Cash.tointeger();
}

KAKAN

"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?
oh no

rObInX

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.

KAKAN

oh no