serverside money
#1

i have a problem with my serverside money.
all works fine, but when i buy something from ammu nation or from the soda machine my old money will be restored what is annoying.

my current code:

pawn Code:
forward MoneyHack();
public MoneyHack()
{
    foreach(Player, i)
    {
        if(GetPlayerCash(i) != GetPlayerMoney(i))
        {
            SetPlayerCash(i, GetPlayerCash(i));
        }
    }
}
this one is the best.

for example when I use

if(GetPlayerCash(i) > GetPlayerMoney(i)) (so he bought a soda or something)
to set the new money it will bug sometimes (when they received money with my 'GivePlayerCash' function, it will restored).

best solution would be to check if the player is using the soda machine / ammu nation.
Reply
#2

You need to script the soda machines / ammu nations to fit with your anti cheat not use the default GTA ones.
Reply
#3

what exactly you mean?
how can i script them??
Reply
#4

you need to exclude them from your anticheat, which may not be possible with the default samp soda machine ( i think)
Reply
#5

i know that i must exclude / script them, the question is how and if that is possible..
Reply
#6

bump***********
Reply
#7

you can see moneys? in textdraw?
Reply
#8

what?
i dont have money in textdraws.
Reply
#9

add a check for the players client money compared to your server money variable
if the client (game) GetPlayerMoney is bigger, then the player cheated.
if its smaller, then set the serversided variable to the one you got from the client. no cheater will set his money to $0 i bet...
Code:
forward MoneyHack();public MoneyHack(){
	new ClientCash;
	foreach(Player, i)
	{
		ClientCash=GetPlayerMoney(i);
		if(ClientCash < GetPlayerCash(i))//like a SyncPlayerServerMoneyToClientMoneyWhenBoughtSomethin()
		{
			SetPlayerCash(i, ClientCash);
		}
		else if(ClientCash > GetPlayerCash(i))
		{
			//player got too much cash :)
		}
	}
	return 1;
}
Reply
#10

i have this code already.
and from my players the money sometimes suddenly restores (to zero)..
also when im spawning i scripted that you will get $1000, but sometimes my $1000 will be restored to my old money. so i think the problems belong together.

i think it's because of the ClientCash < GetPlayerCash(i), because when i only do the code from my first post, my spawn money will not be restored.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)