SA-MP Forums Archive
[Tutorial] Anti driver drive-by ( simple + very explaind ) - 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 driver drive-by ( simple + very explaind ) (/showthread.php?tid=450266)



Anti driver drive-by ( simple + very explaind ) - Chrisis - 12.07.2013

1) Discription :

it is very simple and not complicated at all ! just follow me and i will explain what we put and why we put it


2) Requitements :

PAWN compiler


3) steps :

go to OnPlayerStateChange ( if you didn't find it use CTRL + F )

add :
pawn Code:
if(newstate == PLAYER_STATE_DRIVER)
{
    SetPlayerArmedWeapon(playerid,0);
}
first line :
pawn Code:
if(newstate == PLAYER_STATE_DRIVER)
with it we know wish state is the player's state , all states can be found in the wiki

third line :
pawn Code:
SetPlayerArmedWeapon(playerid,0);
with set wish weapon the player will have in his hand , 0 means unarmed


now players CAN'T look left and right to kill people with a TEC9 - SMG or MICRO UZI


Re : Anti driver drive-by ( simple + very explaind ) - Garwan50 - 31.07.2013

Easy but not useless


Re: Anti driver drive-by ( simple + very explaind ) - qazwsx - 01.08.2013

Hmm, easy simple but it is work

Nice one mane


Re: Anti driver drive-by ( simple + very explaind ) - Chrisis - 01.08.2013

@qazwsx : thanks

@Garwan50 : actually it is important if you have a TDM and people kill with drive-by , easy kills . this is like an anti-rule break


Re: Anti driver drive-by ( simple + very explaind ) - Sinner - 01.08.2013

(1) This will not work when you are a passenger
(2) This will not work when a player is put in a vehicle script-wise


Re: Anti driver drive-by ( simple + very explaind ) - Chrisis - 01.08.2013

Quote:
Originally Posted by qazwsx
View Post
Hmm, easy simple but it is work

Nice one mane
Quote:
Originally Posted by Garwan50
View Post
Easy but not useless
Quote:
Originally Posted by Sinner
View Post
(1) This will not work when you are a passenger
(2) This will not work when a player is put in a vehicle script-wise
(1) of course not for a passenger , in the title there is Anti Driver drive-by


Re: Anti driver drive-by ( simple + very explaind ) - NinjahZ - 08.08.2013

pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        SetPlayerArmedWeapon(playerid,0);
        return 1;
}
How about that?


Re: Anti driver drive-by ( simple + very explaind ) - Chrisis - 08.08.2013

Quote:
Originally Posted by NinjahZ
View Post
pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        SetPlayerArmedWeapon(playerid,0);
        return 1;
}
How about that?
that will remove his weapon the time he press ENTER , not the time he enter the vehicle . if he is fast enough he can equip his weapon another time before he gets in the car . in simple words ,,, no


Re: Anti driver drive-by ( simple + very explaind ) - Sinner - 08.08.2013

Quote:
Originally Posted by Chrisis
View Post
that will remove his weapon the time he press ENTER , not the time he enter the vehicle . if he is fast enough he can equip his weapon another time before he gets in the car . in simple words ,,, no
So just use this?
This is a tutorial, you should know about PLAYER_STATE_PASSENGER before presenting people with half-assed solutions.

pawn Code:
public OnPlayerStateChanged(playerid, newstate, oldstate) {
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) {
        // code
    }
}