[Tutorial] Anti firing bullets from non-bullet weapon hack

Started by SA:MP, May 05, 2023, 05:48 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

SA:MP

[Tutorial] Anti firing bullets from non-bullet weapon hack

In recent days players in my server have been suffering from a game freeze/crash caused by hackers firing bullets from weapon ID 0 (a non-bullet weapon). This was supposedly fixed in the 0.3.7-R2 server, but it doesn't seem to be. This is how you can fix it:




Code:

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    switch (weaponid)
    {
        case 22 .. 34, 38:
        {
            // valid bullet weapon
        }
        default:
        {
            // invalid bullet weapon
            return 0; // desync the shot
        }
    }
    return 1;
}


Source: [Tutorial] Anti firing bullets from non-bullet weapon hack