Anti Weapon cheat
#1

Код:
#define WEAPON_SLOT_COUNT 13 //0 - 12

new Weapons[MAX_PLAYERS][WEAPON_SLOT_COUNT];

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

stock CheckWeapons(playerid)
{
	new weaponid = GetPlayerWeapon(playerid);
	new slot = GetWeaponSlot(weaponid);
	if(Weapons[playerid][slot] != weaponid && GetPlayerWeapon(playerid) != 46)
	{
		WeaponHack(playerid);
	}
}

stock GiveWeapon(playerid, weaponid, ammo)
{
	new slot = GetWeaponSlot(weaponid);
	Weapons[playerid][slot] = weaponid;
	GivePlayerWeapon(playerid, weaponid, ammo);
}

why it banning Innocent Players who just Connect to server?
1 Problem was that when Player Get Parachute he got banned when he Jump from vehicle is Fixed.
Other Problem is when some budy connect some time they got banned this will be Fixed also.
why some people got banned randomly?
Reply
#2

Put an exception on weapon ID0 (Fist)
Reply
#3

Код:
I make a loop for check that for all players and see this that what u talking about ?
	new weaponid = GetPlayerWeapon(i);
	new slot = GetWeaponSlot(weaponid);
	if(Weapons[i][slot] != weaponid && GetPlayerWeapon(i) != 46 && GetPlayerWeapon(i) != 0 )
	{
		WeaponHack(i);
	}
	}
Reply
#4

Exactly
Reply
#5

You sure there are no other Bugs?
Reply
#6

Why ? Is there still a problem after my fix ?
Reply
#7

I'll try it +Rep
Reply
#8

Not Fixed its now not banning any hacker..
new weaponid = GetPlayerWeapon(i);
new slot = GetWeaponSlot(weaponid);
if(Weapons[i][slot] != weaponid && GetPlayerWeapon(i) != 46 && GetPlayerWeapon(i) != 0 )
{
WeaponHack(i);
}
Reply
#9

its Detecting Hackers
But
some Problems.
when some budy Buy the weapon ID 39 which is WEAPON_SATCHEL
and if he already have GRENADES in that slot its ban that player for buying WEAPON_SATCHEL

also with some other weapons !.. they got ban some time 1or 2 when they try to buy weapons..

Код:
#define WEAPON_SLOT_COUNT 13 //0 - 12

new Weapons[MAX_PLAYERS][WEAPON_SLOT_COUNT];

stock GetWeaponSlot(weaponid)
{
    new slot;
    switch (weaponid)
    {
        case 0: slot = 0;
        case 1: slot = 0;
        case 2: slot = 1;
        case 3: slot = 1;
        case 4: slot = 1;
        case 5: slot = 1;
        case 6: slot = 1;
        case 7: slot = 1;
        case 8: slot = 1;
        case 9: slot = 1;
        case 22: slot = 2;
        case 23: slot = 2;
        case 24: slot = 2;
        case 25: slot = 3;
        case 26: slot = 3;
        case 27: slot = 3;
        case 28: slot = 4;
        case 29: slot = 4;
        case 32: slot = 4;
        case 30: slot = 5;
        case 31: slot = 5;
        case 33: slot = 6;
        case 34: slot = 6;
        case 35: slot = 7;
        case 36: slot = 7;
        case 37: slot = 7;
        case 38: slot = 7;
        case 16: slot = 8;
        case 17: slot = 8;
        case 18: slot = 8;
        case 39: slot = 8;
        case 41: slot = 9;
        case 42: slot = 9;
        case 43: slot = 9;
        case 10: slot = 10;
        case 11: slot = 10;
        case 12: slot = 10;
        case 13: slot = 10;
        case 14: slot = 10;
        case 15: slot = 10;
        case 44: slot = 11;
        case 45: slot = 11;
        case 46: slot = 11;
        case 40: slot = 12;
    }
    return slot;
}

stock ServerWeapon(playerid, weaponid, ammo)
{
	new slot = GetWeaponSlot(weaponid);
	Weapons[playerid][slot] = weaponid;
	GivePlayerWeapon(playerid, weaponid, ammo);
}
Reply
#10

Why using slots? You can use a boolean on every weapon you give.
Код:
new bool:SSWeapon[MAX_PLAYERS][47]; //global

//when a player connects
for (new i = 0; i != 47; i++) SSWeapon[playerid][i] = false;

//under your GivePlayerWeapon hook or stock you set the var to true.
SSWeapon[playerid][weaponid] = true;

//when you reset the player's weapons set it to false
for (new i = 0; i != 47; i++) SSWeapon[playerid][i] = false;

//for detection, you can use the OnPlayerWeaponShot callback and detect it (note that not all weapons call that function)
if (!SSWeapon[playerid][weaponid]) Kick(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)