anti money hack[+rep] -
PawnoQ - 03.01.2012
hi,
is this code good?
If i try to cheat money with a cheating tool it works, it deects it and resets it but the client message is also send if the money is not hacked.
to sum it up:
-it detects and resets cheated money (not given with the custom variable)
-It doesnt reset the money given with the custom variable (this is supposed to be so)
-BUT the "hacked money" message is always send when the money gets increased/decreased, no matter if its cheated or not.
pawn Код:
//this is in a foreach loop and a timer with 1 second intervall
if(GetPlayerMoney(i) != pCash[i])
{
ResetPlayerMoney(i);
GivePlayerMoney(i, pCash[i]);
SendClientMessageToAll(0xFF0000FF,"Money Hacked!!");
}
//i give money like this:
pCash[playerid]+=amount;
Please help me
Re : anti money hack[+rep] -
Vukilore - 03.01.2012
pawn Код:
//this is in a foreach loop and a timer with 1 second intervall
if(GetPlayerMoney(i) >= pCash[i])
{
ResetPlayerMoney(i);
GivePlayerMoney(i, pCash[i]);
SendClientMessageToAll(0xFF0000FF,"Money Hacked!!");
}
Stock SafeGivePlayerMoney(playerid, amount)
{
pCash[playerid] =+amount;
GivePlayerMoney(playerid,amount);
}
And Replace all your GivePlayerMoney by SafeGivePlayerMoney. I hope, i help you
Re: anti money hack[+rep] -
PawnoQ - 03.01.2012
thx

Can someone tell, if this code is more efficientor safer then my first code?
And if my code works, why is it always showing the hacked money message?
I want to know that please
Re : anti money hack[+rep] -
Vukilore - 03.01.2012
Cause
if(GetPlayerMoney(i) != pCash[i]) if you give money to your player, its different to pCash, so message will be send.
Re: anti money hack[+rep] -
coole210 - 03.01.2012
Quote:
Originally Posted by PawnoQ
thx 
Can someone tell, if this code is more efficientor safer then my first code?
And if my code works, why is it always showing the hacked money message?
I want to know that please 
|
lol.
Yes It is because your code does not do what you want it to do. (derp)
Edit:
answer to second question: You're code does not set the money, so pCash is never equal to GetPlayerMoney, thats why your getting the message
Re: anti money hack[+rep] -
PawnoQ - 03.01.2012
ok, if i use ur code, can i go on with using GetPlayerMoney then?
Re: anti money hack[+rep] -
PawnoQ - 03.01.2012
sorry for double post but is there any difference if i give my serverside money like this
pawn Код:
pCash[playerid]+=amount;
//this would be as safe as the stock function right?
or this?
pawn Код:
Stock SafeGivePlayerMoney(playerid, amount)
{
pCash[playerid] =+amount;
GivePlayerMoney(playerid,amount);
}
Re: anti money hack[+rep] -
Basssiiie - 03.01.2012
The only difference is that the green money in the top right corner will change too with the second one.
Edit: If you want to use GetPlayerMoney, you can use something like this instead:
Код:
stock SafeGetPlayerMoney(playerid)
{
return pCash[playerid];
}
Re: anti money hack[+rep] -
PawnoQ - 03.01.2012
the first method affects the green money bar as well

So it actually would be the same right?
Re: anti money hack[+rep] -
Basssiiie - 03.01.2012
If it both affects the green money, then there is no difference.