Money Hacking e.t.c.
#1

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?
Reply
#2

so, which Public or whatever?
Reply
#3

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

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

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.
Reply
#6

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

Sorry, i forgot a semicolon after MAX_PLAYERS

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

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. :/
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)