SA-MP Forums Archive
[Tutorial] How to make a Anti-driveby system - 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] How to make a Anti-driveby system (/showthread.php?tid=436122)



How to make a Anti-driveby punishment system - BlackHorse - 10.05.2013

INTRODUCTION
In this we laern about how to make a Anti driveby system because in many servers driveby is now allowed
Step 1
include a_samp which is important for making FS
Код:
#include a_samp
Step 2
when player drive by as passenger or driver
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new playerState = GetPlayerState(killerid); // Get the killer's state
 
    if (playerState == PLAYER_STATE_PASSENGER || playerState == PLAYER_STATE_DRIVER) // If the killer was in a vehicle as driver or passenger too
    {
        //What you do their for player Kick/Ban/Any other thing
     }
    return 1;
}
If you want to not do any thing with passenger when he/she drive by cut this code from your FS
Код:
playerState == PLAYER_STATE_PASSENGER ||



Re: How to make a Anti-driveby system - RajatPawar - 10.05.2013

What the... This is a tutorial on WHAT to do once the driveby is done with. To actually avoid drive - bys,
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
      if(newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER)
      {
            new weapons[13][2];
            for (new i = 0; i < 13; i++)
            {
                GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
            }
            ResetPlayerWeapons(playerid);
            if(newstate == PLAYER_STATE_ONFOOT && (oldstate == PLAYER_STATE_PASSENGER || oldstate == PLAYER_STATE_DRIVER) )
            {
                     for( new i; i < 13; i++)
                     {
                           GivePlayerWeapon(playerid, weapons[i][0], weapons[i][1]);
                     }
             }
            return 1;
}
Or obviously just setting the weapon to 0.


Re: How to make a Anti-driveby system - freddy smyth - 10.05.2013

Thanks for sharing your tutorial, but you should change it to:

"Drive-by Punishment System Tutorial."

In that respect, it was slightly deceiving.


Re: How to make a Anti-driveby system - Vince - 10.05.2013

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
What the... This is a tutorial on WHAT to do once the driveby is done with. To actually avoid drive - bys,
pawn Код:
// bunch of code
Or obviously just setting the weapon to 0.
Or yet simpler: SetPlayerArmedWeapon


Re: How to make a Anti-driveby system - RajatPawar - 10.05.2013

Quote:
Originally Posted by Vince
Посмотреть сообщение
Or yet simpler: SetPlayerArmedWeapon
Yes, I did say that at the bottom. The one I posted is loopholes free


Re: How to make a Anti-driveby system - xser12 - 15.05.2013

Nice


Re: How to make a Anti-driveby system - NL-Sultan - 16.05.2013

Clear, and simple! But as other people mentioned, it's not an 'anti' drive-by, it's a punishment after the drive-by. So people still can perform a drive-by, you should update your tutorial a little.


Re: How to make a Anti-driveby system - Pettersen - 18.05.2013

Good for roleplay servers