I have and I need a filterscript anti-money
#1

I have and I need a filterscript anti-money for the player to no longer give money to s0b. . I found one but when I give money to "/ givemoney" reset me on them. . Namely:

#include <a_samp>

#define Maximal_Players 500
#define Cheat_Type_Money 0
#define Cheat_Type_Weapons 1
#define Cheat_Type_Player_Speed 2
#define Cheat_Type_Vehicle_Speed 3

new AntiCheatDetectTimer;
enum PlayerInfo
{
PlayerMoney,
PlayerWeapon[13],
PlayerAmmunition[13]
};
new Player[Maximal_Players][PlayerInfo];

public OnFilterScriptInit()
{
AntiCheatDetectTimer = SetTimer("AntiCheatDetect",1000,1);
return 1;
}

public OnFilterScriptExit()
{
KillTimer(AntiCheatDetectTimer);
return 1;
}

public OnPlayerConnect(playerid)
{
Player[playerid][PlayerMoney] = 0;
for(new W = 0; W < 12; W++)
{
Player[playerid][PlayerWeapon][W] = 0;
Player[playerid][PlayerAmmunition][W] = 0;
}
return 1;
}

forward AntiCheat(PlayerId,Cheat_Type,WeaponId);
public AntiCheat(PlayerId,Cheat_Type,WeaponId)
{
if(Cheat_Type == Cheat_Type_Money) SetMoney(PlayerId,Player[PlayerId][PlayerMoney]);
if(Cheat_Type == Cheat_Type_Weapons) ResetWeapon(PlayerId,WeaponId);
if(Cheat_Type == Cheat_Type_Player_Speed) SetPlayerHealth(PlayerId,0);
if(Cheat_Type == Cheat_Type_Vehicle_Speed) DestroyVehicle(GetPlayerVehicleID(PlayerId));
return 1;
}

stock GetMoney(PlayerId)
{
if(!IsPlayerConnected(PlayerId)) return 0;
return Player[PlayerId][PlayerMoney];
}

stock GiveMoney(PlayerId,Amount)
{
if(!IsPlayerConnected(PlayerId)) return 0;
if(Amount == 0) return 0;
Player[PlayerId][PlayerMoney] += Amount;
GivePlayerMoney(PlayerId,Amount);
return 1;
}

stock SetMoney(PlayerId,Amount)
{
if(!IsPlayerConnected(PlayerId)) return 0;
Player[PlayerId][PlayerMoney] = Amount;
ResetPlayerMoney(PlayerId);
GivePlayerMoney(PlayerId,Player[PlayerId][PlayerMoney]);
return 1;
}

stock ResetMoney(PlayerId)
{
if(!IsPlayerConnected(PlayerId)) return 0;
Player[PlayerId][PlayerMoney] = 0;
ResetPlayerMoney(PlayerId);
return 1;
}

stock GiveWeapon(PlayerId,WeaponId,Ammunition)
{
if(!IsPlayerConnected(PlayerId)) return 0;
if(WeaponId < 0 || WeaponId == 19 || WeaponId == 20 || WeaponId == 21 || WeaponId > 46) return 0;
if(Ammunition == 0) return 0;
for(new W = 0; W < 12; W++)
{
GetPlayerWeaponData(PlayerId,W,Player[PlayerId][PlayerWeapon][W],Player[PlayerId][PlayerAmmunition][W]);
}
Player[PlayerId][PlayerWeapon][GetWeaponSlot(WeaponId)] = WeaponId;
Player[PlayerId][PlayerAmmunition][GetWeaponSlot(WeaponId)] = Ammunition;
SetPlayerAmmo(PlayerId,Player[PlayerId][PlayerWeapon][GetWeaponSlot(WeaponId)],0);
GivePlayerWeapon(PlayerId,WeaponId,Ammunition);
SetPlayerArmedWeapon(PlayerId,WeaponId);
return 1;
}

stock ResetWeapon(PlayerId,WeaponId)
{
if(!IsPlayerConnected(PlayerId)) return 0;
if(WeaponId < 0 || WeaponId == 19 || WeaponId == 20 || WeaponId == 21 || WeaponId > 46) return 0;
for(new W = 0; W < 12; W++)
{
GetPlayerWeaponData(PlayerId,W,Player[PlayerId][PlayerWeapon][W],Player[PlayerId][PlayerAmmunition][W]);
}
Player[PlayerId][PlayerWeapon][GetWeaponSlot(WeaponId)] = 0;
Player[PlayerId][PlayerAmmunition][GetWeaponSlot(WeaponId)] = 0;
ResetPlayerWeapons(PlayerId);
for(new W = 0; W < 12; W++)
{
GivePlayerWeapon(PlayerId,Player[PlayerId][PlayerWeapon][W],Player[PlayerId][PlayerAmmunition][W]);
}
SetPlayerArmedWeapon(PlayerId,0);
return 1;
}

stock ResetWeapons(PlayerId)
{
if(!IsPlayerConnected(PlayerId)) return 0;
for(new W = 0; W < 12; W++)
{
Player[PlayerId][PlayerWeapon][W] = 0;
Player[PlayerId][PlayerAmmunition][W] = 0;
}
ResetPlayerWeapons(PlayerId);
return 1;
}

stock GetWeaponSlot(WeaponId)
{
switch(WeaponId)
{
case 0,1: return 0;
case 2..9: return 1;
case 10..15: return 10;
case 16..18,39: return 8;
case 22..24: return 2;
case 25..27: return 3;
case 28,29,32: return 4;
case 30,31: return 5;
case 33,34: return 6;
case 35..38: return 7;
case 40: return 12;
case 41..43: return 9;
case 44..46: return 11;
}
return 0;
}

forward AntiCheatDetect();
public AntiCheatDetect()
{
for(new P = 0; P < Maximal_Players; P++)
{
if(IsPlayerConnected(P))
{
if(GetPlayerMoney(P) != GetMoney(P)) CallLocalFunction("AntiCheat","dd",P,Cheat_Type_Mo ney);
if(Player[P][PlayerWeapon][GetWeaponSlot(GetPlayerWeapon(P))] != GetPlayerWeapon(P)) CallLocalFunction("AntiCheat","ddd",P,Cheat_Type_W eapons,GetPlayerWeapon(P));
if(GetPlayerState(P) == PLAYER_STATE_ONFOOT)
{
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerVelocity(P,X,Y,Z);
if(floatround(X) > 1 || floatround(Y) > 1 || floatround(Z) > 1) CallLocalFunction("AntiCheat","dd",P,Cheat_Type_Pl ayer_Speed);
}
if(GetPlayerState(P) == PLAYER_STATE_DRIVER)
{
new Float:X;
new Float:Y;
new Float:Z;
GetVehicleVelocity(GetPlayerVehicleID(P),X,Y,Z);
if(floatround(X) > 1 || floatround(Y) > 1 || floatround(Z) > 3 || floatround(X) < -1 || floatround(Y) < -1 || floatround(Z) < -3) CallLocalFunction("AntiCheat","dd",P,Cheat_Type_Ve hicle_Speed);
}
}
}
return 1;
}


Help me please !
Reply
#2

Well, it's pretty easy to create an anti money cheat :

PHP код:

#define GivePlayerMoney AC_GivePlayerMoney
#define ResetPlayerMoney AC_ResetPlayerMoney

new bool:pMoney[MAX_PLAYERS], oldM[MAX_PLAYERS];

stock AC_GivePlayerMoney(playeridmoney)
{
    
pMoney[playerid] = true;
    
GivePlayerMoney(playeridmoney);
    
SetTimerEx("stopMoney"50false"i"playerid);
    return 
1;
}

stock AC_ResetPlayerMoney(playerid)
{
    
pMoney[playerid] = true;
    
ResetPlayerMoney(playerid);
    
SetTimerEx("stopMoney"50false"i"playerid);
    return 
1;
}

forward stopMoney(playerid);
public 
stopMoney(playerid) { pMoney[playerid] = false; return 1; }

public 
OnPlayerUpdate(playerid)
{
    new 
money GetPlayerMoney(playerid);
    if(
money != oldM[playerid] && !pMoney[playerid])
    {
        
// The player cheats
    
}
    
oldM[playerid] = money;
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)