SA-MP Forums Archive
[Tutorial] Anti firing bullets from non-bullet weapon hack - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Anti firing bullets from non-bullet weapon hack (/showthread.php?tid=673873)



Anti firing bullets from non-bullet weapon hack - beckzy - 07.04.2020

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



Re: Anti firing bullets from non-bullet weapon hack - MarianImmortalGod - 07.04.2020

So we need to determine every single weapon that will be used in our server ?

or we can just put
Code:
switch (weaponid)
    {
        default:
        {
            // invalid bullet weapon
            return 0; // desync the shot
        }
    }



Re: Anti firing bullets from non-bullet weapon hack - beckzy - 07.04.2020

Quote:
Originally Posted by MarianImmortalGod
View Post
So we need to determine every single weapon that will be used in our server ?

or we can just put
Code:
switch (weaponid)
    {
        default:
        {
            // invalid bullet weapon
            return 0; // desync the shot
        }
    }
That'll desync every shot for every weapon. Use the code I posted.


Re: Anti firing bullets from non-bullet weapon hack - Kasichok - 07.04.2020

weird i tried such thing on my server (R2) didnt crash anyone


Re: Anti firing bullets from non-bullet weapon hack - beckzy - 07.04.2020

Quote:
Originally Posted by Kasichok
View Post
weird i tried such thing on my server (R2) didnt crash anyone
Is your server version also R2-2? Also did you try weapon ID 0? It's weapon ID 0 that was being used to crash players in my server (0.3.7 R2-2).


Re: Anti firing bullets from non-bullet weapon hack - Kasichok - 07.04.2020

Quote:
Originally Posted by beckzy
View Post
Is your server version also R2-2? Also did you try weapon ID 0? It's weapon ID 0 that was being used to crash players in my server (0.3.7 R2-2).
Yes and yes


Re: Anti firing bullets from non-bullet weapon hack - beckzy - 07.04.2020

Quote:
Originally Posted by Kasichok
View Post
Yes and yes
Someone must've updated the tool that does it (or made their own?) . OnPlayerWeaponShot rapidly printed that a player was using weapon ID 0 to fire bullets on my server (my 0.3.7 R2-2 server).


Re: Anti firing bullets from non-bullet weapon hack - Kasichok - 07.04.2020

Quote:
Originally Posted by beckzy
View Post
Someone must've updated the tool that does it (or made their own?) . OnPlayerWeaponShot rapidly printed that a player was using weapon ID 0 to fire bullets on my server (my 0.3.7 R2-2 server).
Yea he prob edited

heres my debug:
Code:
playerid | weaponid | hittype | hitid 
0              0           1      1
no crash no freeze


Re: Anti firing bullets from non-bullet weapon hack - Uberanwar - 07.04.2020

Quote:
Originally Posted by Kasichok
View Post
weird i tried such thing on my server (R2) didnt crash anyone
Maybe you might have some mods installed on your SA-MP? Like SA-MP Addon, or GTA SA Crashfix ASI etc.


Re: Anti firing bullets from non-bullet weapon hack - Kasichok - 07.04.2020

Quote:
Originally Posted by Uberanwar
View Post
Maybe you might have some mods installed on your SA-MP? Like SA-MP Addon, or GTA SA Crashfix ASI etc.
Iv'e got only anti afk if that somehow prevents this