[Tutorial] How to make a Anti-driveby system
#1

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 ||
Reply
#2

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.
Reply
#3

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

"Drive-by Punishment System Tutorial."

In that respect, it was slightly deceiving.
Reply
#4

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
Reply
#5

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

Nice
Reply
#7

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.
Reply
#8

Good for roleplay servers
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)