Мой первый античит.
Вроде непробиваемый, сколько не пробовали, сразу палил.
PHP код:
new plgun[MAX_PLAYERS][13], plammo[MAX_PLAYERS][13];
public OnPlayerConnect(playerid)
{
ResetWeaponAll(playerid);
return 1;
}
public OnPlayerUpdate(playerid)
{
new datagunid, dataammo;
for(new s; s != 13; s++)
{
GetPlayerWeaponData(playerid, s, datagunid, dataammo);
if(datagunid != 0 && datagunid != 46 && datagunid != 40 && ((datagunid != plgun[playerid]) || (datagunid == plgun[playerid] && dataammo != plammo[playerid])))
{
// тут действие при выявлении чита, кик, мессага, прочее
SendClientMessageToAll(-1, "McLuhan USED WEAPON/AMMO CHEAT");
Kick(playerid); // обязательно Kick, а не исправленный кик, потому что в исправленом есть задержка,
// ..а нужно кикать сразу, чтобы игрок не успел провеизвести выстрел.
}
}
return 1;
}
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new gunslot = getWeaponIdSlot(weaponid);
if(plammo[playerid][gunslot] > 0) plammo[playerid][gunslot]--;
return 1;
}
stock ResetWeaponAll(playerid)
{
for(new s; s != 13; s++)
{
plgun[playerid] = 0;
plammo[playerid] = 0;
}
ResetPlayerWeapons(playerid);
return 1;
}
stock ResetWeapon(playerid, slotgunid)
{
ResetPlayerWeapons(playerid);
plgun[playerid][slotgunid] = 0;
plammo[playerid][slotgunid] = 0;
for(new s; s != 13; s++)
{
GiveWeapon(playerid, plgun[playerid], plammo[playerid]);
}
return 1;
}
stock getWeaponIdSlot(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 -1;
}
stock GiveWeapon(playerid, gunid, ammo)
{
new slotgunid = getWeaponIdSlot(gunid);
plgun[playerid][slotgunid] = gunid;
plammo[playerid][slotgunid] = ammo;
GivePlayerWeapon(playerid, gunid, ammo);
return 1;
}