Server random die
#1

Hi guys.

My server random die if online 20+ player.


I think my weapon anticheat is bad.

Whats the problem?

The check run every 3 second.
My code:

Код:
new Ammosave[MAX_PLAYERS][13];

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;
}


//https://sampforum.blast.hk/showthread.php?pid=782197#pid782197

stock CheckWeapons(playerid)
{
    if(IsPlayerConnected(playerid))
    {

		new weaponid = GetPlayerWeapon(playerid);
		new slot = GetWeaponSlot(weaponid);
		if(Weapons[playerid][slot] != weaponid)
		{
		    	ResetPlayerWeapons(playerid);
		        KickEx(playerid,-1,"((Weapon hack!))");
		}
		else
		{
		    if(Ammosave[playerid][slot] < GetPlayerAmmo(playerid))
		    {
		        ResetPlayerWeapons(playerid);
		        KickEx(playerid,-1,"((Ammo hack!))");
		    }
		}
		printf("Lőszer lefutбs!");
	}
}

stock ServerWeapon(playerid, weaponid, ammo)
{
	new slot = GetWeaponSlot(weaponid);
	Weapons[playerid][slot] = weaponid;
	Ammosave[playerid][slot] += ammo;
	GivePlayerWeapon(playerid, weaponid, ammo);
}
Thanks!
Reply


Messages In This Thread
Server random die - by Brandon001 - 02.11.2017, 22:06

Forum Jump:


Users browsing this thread: 1 Guest(s)