SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 19/02/2009, 10:38 AM   #1
Fen1x
Little Clucker
 
Join Date: Dec 2007
Posts: 2
Reputation: 0
Default AntiCheat problem (money)

Ok, look. I was making my anticheat(money) system and here what I have:
When player type /login pass i start timer for him
Code:
moneytimer[playerid] = SetTimerEx("MoneyCheck",3000,1,"i",playerid);
When he disconnects from server i kill it
Code:
KillTimer(moneytimer[playerid]);
Here is how i check player's money
Code:
forward MoneyCheck(playerid);
public MoneyCheck(playerid)
{
  new clientcash;
  clientcash = GetPlayerMoney(playerid);
  if(clientcash > servercash[playerid])
  {
    SetTimerEx("MoneyCheck2",2000,false,"i",playerid);
  }
  else
  {
    servercash[playerid] = clientcash;
  }
  return 1;
}
if player is suspecting in cehating i start 2 timer for him
Code:
forward MoneyCheck2(playerid);
public MoneyCheck2(playerid)
{
  new clientcash;
  clientcash = GetPlayerMoney(playerid);
  if(clientcash > servercash[playerid])
  {
    new string[256],nick[24];
    GetPlayerName(playerid, nick, sizeof(nick));
      format(string, sizeof(string), "[LSPD] Игрок %s был кикнут за читы на деньги.",nick);
      SendClientMessageToAll(COLOR_RED, string);
    ResetPlayerMoney(playerid);
    Kick(playerid);
  }
return 1;
}
And here is my giveplayermoney function
Code:
forward xGivePlayerMoney(playerid, amount);
public xGivePlayerMoney(playerid, amount)
{
  new tmp;
  tmp = GetPlayerMoney(playerid);
  GivePlayerMoney(playerid,amount);
  servercash[playerid] = tmp + amount;
  return 1;
}
So. think that everything is ok. And it's really working. BUT! Sometimes people is kicked from server because of cheats(they are not cheaters). Help me pls.
Fen1x is offline  
Old 19/02/2009, 10:58 AM   #2
CracK
Huge Clucker
 
CracK's Avatar
 
Join Date: Nov 2007
Posts: 437
Reputation: 3
Default Re: AntiCheat problem (money)

I've also had a problem with this... but found a way to avoid errors.
Top of the script:
pawn Code:
forward MoneyGiving(playerid, status);
new givingmoney[MAX_PLAYERS];
OnPlayerConnect:
pawn Code:
givingmoney[playerid] = 0;
Put this in your timer before if(clientcash > servercash[playerid]):
pawn Code:
if(givingmoney[i]) return;
Function:
pawn Code:
public MoneyGiving(playerid, status)
{
    givingmoney[playerid] = status;
}
And finally insert these to your Money funcs:
pawn Code:
givingmoney[playerid] = 1;
SetTimerEx("MoneyGiving", 1500, 0, "i,i", playerid, 0);

З.Ы. русские захватят весь мир))
__________________
Custom Enex loader 1.0
map2pwn
CracK is offline  
Old 19/02/2009, 03:34 PM   #3
Fen1x
Little Clucker
 
Join Date: Dec 2007
Posts: 2
Reputation: 0
Default Re: AntiCheat problem (money)

oooh! thx dude!
p.s. лооооол
Fen1x is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] [INC] Money Anticheat ^Woozie^ Релизы/Releases 70 13/05/2010 05:43 PM
Problem With AntiCheat RenisiL Help Archive 2 14/04/2010 09:07 AM
AntiCheat Problem. RenisiL Help Archive 1 26/03/2010 02:11 PM
Problem with name ban(anticheat) Naxix Help Archive 6 23/11/2009 07:07 PM


All times are GMT. The time now is 04:28 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.