Would this AC hypothetically work ?
#1

Hey, would this Anti Weapon Hack work for your opinion ?
And do you think there is a way to improve it ?

PHP код:
// AntiCheat Callbacks
forward WeaponHack();
public 
WeaponHack()
{
    new 
weaponid;
    foreach(new 
playerid Player)
    {
        
weaponid GetPlayerWeapon(playerid);
        if(
weaponid != PlayerInfo[playerid][pWeapon][GetWeaponSlot(weaponid)]) Kick(playerid);
    }

PHP код:
stock GetWeaponSlot(weaponid)
{
    new 
slot;
    switch(
weaponid)
    {
        case 
01slot 0// No weapon
        
case .. 9slot 1// Melee
        
case 22 .. 24slot 2// Handguns
        
case 25 .. 27slot 3// Shotguns
        
case 282932slot 4// Sub-Machineguns
        
case 3031slot 5// Machineguns
        
case 3334slot 6// Rifles
        
case 35 .. 38slot 7// Heavy Weapons
        
case 161839slot 8// Projectiles
        
case 4243slot 9// Special 1
        
case 14slot 10// Gifts
        
case 44 .. 46slot 11// Special 2
        
case 40slot 12// Detonators
        
default: slot = -1// No slot
    
}
    return 
slot;

Reply
#2

PHP код:
if(weaponid != PlayerInfo[playerid][pWeapon][GetWeaponSlot(weaponid)]) Kick(playerid); 
Will result in false positives. There's always a chance the variable doesn't store immediately, so it's better to send a warning to the admins instead of kicking instantly.
Reply
#3

Quote:
Originally Posted by Satori_Komeiji
Посмотреть сообщение
PHP код:
if(weaponid != PlayerInfo[playerid][pWeapon][GetWeaponSlot(weaponid)]) Kick(playerid); 
Will result in false positives. There's always a chance the variable doesn't store immediately, so it's better to send a warning to the admins instead of kicking instantly.
The variable is stored even before the weapon is given (first variable - then GivePlayerWeapon)
Reply
#4

Information

I would suggest you hook the functions used for weapons. Example:
Код:
stock AC_GivePlayerWeapon( playerid, weaponid, ammo )
{
	// YOUR CODE GOES HERE

	return GivePlayerWeapon( playerid, weaponid, ammo );
}
#if defined _ALS_GivePlayerWeapon
	#undef GivePlayerWeapon
#else
	#define _ALS_GivePlayerWeapon
#endif

#define GivePlayerWeapon AC_GivePlayerWeapon
Save the weapon and ammo to a variable that can hold them, preferably by using weapon slots ( which means the array will be a max of 12 slots instead of all weapons which would mean it was equal to 47 ).

Also add a delay of 800 ms in the hooked functions before setting the weapons and then in the weapon check function, you can check to see if the time has passed and then check their weapons.

then you may use kick, but make sure to test it first.
Reply
#5

Quote:
Originally Posted by azzerking
Посмотреть сообщение
Information

I would suggest you hook the functions used for weapons. Example:
Код:
stock AC_GivePlayerWeapon( playerid, weaponid, ammo )
{
	// YOUR CODE GOES HERE

	return GivePlayerWeapon( playerid, weaponid, ammo );
}
#if defined _ALS_GivePlayerWeapon
	#undef GivePlayerWeapon
#else
	#define _ALS_GivePlayerWeapon
#endif

#define GivePlayerWeapon AC_GivePlayerWeapon
Save the weapon and ammo to a variable that can hold them, preferably by using weapon slots ( which means the array will be a max of 12 slots instead of all weapons which would mean it was equal to 47 ).

Also add a delay of 800 ms in the hooked functions before setting the weapons and then in the weapon check function, you can check to see if the time has passed and then check their weapons.

then you may use kick, but make sure to test it first.
I'm pretty sure I already have it

PHP код:
stock GiveNexWeapon(playeridweaponidammo)
{
    
PlayerPlaySound(playerid10520.00.00.0);
    
PlayerInfo[playerid][pWeapon][GetWeaponSlot(weaponid)] = weaponid;
    
PlayerInfo[playerid][pWeaponAmmo][GetWeaponSlot(weaponid)] = ammo;
    
GivePlayerWeapon(playeridweaponidammo);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)