SA-MP Forums Archive
Money Hacking e.t.c. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Money Hacking e.t.c. (/showthread.php?tid=66556)



Money Hacking e.t.c. - Martin_Smith - 22.02.2009

for my server, i want to make a ANTI hack system, i know how im going to do it..sort of..

Basicly, what i want to do is if you get 501 money or more in a second, its kick and i anna do it if ur a special team and Have blah blah guns, u get banned

So, all i need to know is where do i put the code for these?


Re: Money Hacking e.t.c. - Martin_Smith - 22.02.2009

so, which Public or whatever?


Re: Money Hacking e.t.c. - Sandra18[NL] - 22.02.2009

Code:
new LastMoney[MAX_PLAYERS];
//OnGameModeInit
Code:
SetTimer("AntiMoneyCheat", 1000, 1);

//OnPlayerConnect(playerid)
Code:
LastMoney[playerid] = 0;
Code:
forward AntiMoneyCheat();
public AntiMoneyCheat()
{
  for(new i; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    { 
      if(LastMoney[i] > 0)
      {
        if(GetPlayerMoney(i) - LastMoney[i] > 500)
        {
          SendClientMessage(i, 0xFF0000AA, "Money Cheater");
          Ban(i);
        }
      }
      LastMoney[i] = GetPlayerMoney(i);
    }
  }
}



Re: Money Hacking e.t.c. - Martin_Smith - 22.02.2009

Does this make it, so if you gain 500 in a second, ur banned?


Re: Money Hacking e.t.c. - Sandra18[NL] - 22.02.2009

Quote:
Originally Posted by Martin_Smith
Does this make it, so if you gain 500 in a second, ur banned?
Yes, it compares every second your money with the money you had a second ago, if the diffrence is more than 500, you'll get banned.


Re: Money Hacking e.t.c. - Martin_Smith - 22.02.2009

ffs, im too tired for errors:

Code:
C:\Documents and Settings\test\Desktop\GTA\GTA\GTA San Andreas\samp02Xserver.win32\gamemodes\nazi.pwn(948) : error 001: expected token: ";", but found "-identifier-"

Code:
public AntiMoneyCheat()
{
  for(new i; i<MAX_PLAYERS i++)  // LINE 948!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  {
    if(IsPlayerConnected(i))
    {
      if(LastMoney[i] > 0)
      {
        if(GetPlayerMoney(i) - LastMoney[i] > 5000)
        {
          SendClientMessage(i, 0xFF0000AA, "Money Cheater");
          Kick(i);
        }
      }
      LastMoney[i] = GetPlayerMoney(i);
    }
  }
}



Re: Money Hacking e.t.c. - Sandra18[NL] - 22.02.2009

Sorry, i forgot a semicolon after MAX_PLAYERS

This should work:
Code:
for(new i; i<MAX_PLAYERS; i++)



Re: Money Hacking e.t.c. - dowster - 07.07.2011

just make an array
new money[MAX_PLAYERS]

then inside onplayerupdate put

if(GetPlayerMoney(playerid) != money[playerid])
{
new changeinmoney;
changeinmoney = (money[playerid] - GetPlayerMoney(playerid));
GivePlayerMoney(playerid, changeinmoney);
return 1;
}

this will make all money serversided so instead of giveplayermoney to actually give them money it would be
money[playerid] = (money[playerid] + amount)

shit sorry for bump, this had popped up in suggested threads, didnt bother checking the date. :/


Re: Money Hacking e.t.c. - cessil - 08.07.2011

Quote:
Originally Posted by Sandra18[NL]
View Post
Yes, it compares every second your money with the money you had a second ago, if the diffrence is more than 500, you'll get banned.
That's one of the worst anti cheats I have ever seen, you completely ignored the possibility of lag.
If you want something that will work hook GivePlayerMoney and have it check and set a variable that stores that players max money that they've ever had during their connect time, then run a timer and see if their GetPlayerMoney is larger than that variable then you can do some punishment

edit: didn't read the above edit, oh well maybe someone else will stumble across this and it'll help them out too, for more tips on ACs check the link in my sig