Anti money cheat
#1

i need anti money cheat like when is player killed an he get money it is not cheat
and when admin /giveallcash /givecash it is not cheat

i want when player have cheat ban for this player how to do it
Reply
#2

Код:
//AT THE TOP
#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney
new Cash[MAX_PLAYERS];

//OnPlayerConnect
ResetPlayerCash(playerid);

//somewhere in your script
stock GivePlayerCash(playerid, money)
{
	Cash[playerid] += money;
	ResetMoneyBar(playerid);
	UpdateMoneyBar(playerid,Cash[playerid]);
	return Cash[playerid];
}

stock SetPlayerCash(playerid, money)
{
	Cash[playerid] = money;
	ResetMoneyBar(playerid);
	UpdateMoneyBar(playerid,Cash[playerid]);
	return Cash[playerid];
}

stock ResetPlayerCash(playerid)
{
	Cash[playerid] = 0;
	ResetMoneyBar(playerid);
	UpdateMoneyBar(playerid,Cash[playerid]);
	return Cash[playerid];
}

stock GetPlayerCash(playerid)
{
	return Cash[playerid];
}
If you were to Give someone money, use GivePlayerCash and not GivePlayerMoney. So with ResetPlayerMoney, use ResetPlayerCash.. etc.

Example command

pawn Код:
CMD:givemoney(playerid, params[])
{
    new amount, id;
   
    if( sscanf( params, "sd", id, amount ) )
        return SendClientMessage( playerid, -1, "USAGE: /givemoney [ID] [Money" );
       

    if( id == playerid )
        return SendClientMessage(playerid, -1, "ERROR: You cannot set your own cash!");

    if( id == INVALID_PLAYER_ID )
        return SendClientMessage(playerid, -1, "ERROR: Player is not connected");
       
    GivePlayerCash(id, money); // Don't use GivePlayerMoney, use the function created
    return 1;
}
To check if the player hacked the money, make a timer and do something like this

pawn Код:
// OnPlayerConnect
SetTimerEx( "AntiCheat",100, true, "i", playerid);

//Somewhere in your script
forward AntiCheat(playerid);
public AntiCheat(playerid)
{
    if(GetPlayerCash(playerid) != GetPlayerMoney(playerid))
    {
        ResetMoneyBar(playerid);
        UpdateMoneyBar(playerid, GetPlayerCash(playerid));
               
        Kick(playerid); // kick or ban the playerid and do what you want with the player
    }
}
Reply
#3

Quote:
Originally Posted by FunnyBear
Посмотреть сообщение
Код:
//AT THE TOP
#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney
new Cash[MAX_PLAYERS];

//OnPlayerConnect
ResetPlayerCash(playerid);

//somewhere in your script
stock GivePlayerCash(playerid, money)
{
	Cash[playerid] += money;
	ResetMoneyBar(playerid);
	UpdateMoneyBar(playerid,Cash[playerid]);
	return Cash[playerid];
}

stock SetPlayerCash(playerid, money)
{
	Cash[playerid] = money;
	ResetMoneyBar(playerid);
	UpdateMoneyBar(playerid,Cash[playerid]);
	return Cash[playerid];
}

stock ResetPlayerCash(playerid)
{
	Cash[playerid] = 0;
	ResetMoneyBar(playerid);
	UpdateMoneyBar(playerid,Cash[playerid]);
	return Cash[playerid];
}

stock GetPlayerCash(playerid)
{
	return Cash[playerid];
}
If you were to Give someone money, use GivePlayerCash and not GivePlayerMoney. So with ResetPlayerMoney, use ResetPlayerCash.. etc.

Example command

pawn Код:
CMD:givemoney(playerid, params[])
{
    new amount, id;
   
    if( sscanf( params, "sd", id, amount ) )
        return SendClientMessage( playerid, -1, "USAGE: /givemoney [ID] [Money" );
       

    if( id == playerid )
        return SendClientMessage(playerid, -1, "ERROR: You cannot set your own cash!");

    if( id == INVALID_PLAYER_ID )
        return SendClientMessage(playerid, -1, "ERROR: Player is not connected");
       
    GivePlayerCash(id, money); // Don't use GivePlayerMoney, use the function created
    return 1;
}
To check if the player hacked the money, make a timer and do something like this

pawn Код:
// OnPlayerConnect
SetTimerEx( "AntiCheat",100, true, "i", playerid);

//Somewhere in your script
forward AntiCheat(playerid);
public AntiCheat(playerid)
{
    if(GetPlayerCash(playerid) != GetPlayerMoney(playerid))
    {
        ResetMoneyBar(playerid);
        UpdateMoneyBar(playerid, GetPlayerCash(playerid));
               
        Kick(playerid); // kick or ban the playerid and do what you want with the player
    }
}
Just combinate with your script and use
REMEMBER: Add it on GameMode not in FilterScript
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)