SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Tutorials (https://forum.sa-mp.com/forumdisplay.php?f=70)
-   -   [Tutorial] Anti firing bullets from non-bullet weapon hack (https://forum.sa-mp.com/showthread.php?t=673873)

beckzy 07/04/2020 06:42 AM

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


MarianImmortalGod 07/04/2020 07:50 AM

Re: Anti firing bullets from non-bullet weapon hack
 
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
        }
    }


beckzy 07/04/2020 08:23 AM

Re: Anti firing bullets from non-bullet weapon hack
 
Quote:

Originally Posted by MarianImmortalGod (Post 4138087)
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.

Kasichok 07/04/2020 02:23 PM

Re: Anti firing bullets from non-bullet weapon hack
 
weird i tried such thing on my server (R2) didnt crash anyone

beckzy 07/04/2020 02:30 PM

Re: Anti firing bullets from non-bullet weapon hack
 
Quote:

Originally Posted by Kasichok (Post 4138156)
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).

Kasichok 07/04/2020 02:34 PM

Re: Anti firing bullets from non-bullet weapon hack
 
Quote:

Originally Posted by beckzy (Post 4138157)
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

beckzy 07/04/2020 03:08 PM

Re: Anti firing bullets from non-bullet weapon hack
 
Quote:

Originally Posted by Kasichok (Post 4138159)
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).

Kasichok 07/04/2020 04:08 PM

Re: Anti firing bullets from non-bullet weapon hack
 
Quote:

Originally Posted by beckzy (Post 4138169)
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

Uberanwar 07/04/2020 07:07 PM

Re: Anti firing bullets from non-bullet weapon hack
 
Quote:

Originally Posted by Kasichok (Post 4138156)
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.

Kasichok 07/04/2020 08:59 PM

Re: Anti firing bullets from non-bullet weapon hack
 
Quote:

Originally Posted by Uberanwar (Post 4138225)
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


All times are GMT. The time now is 12:40 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.