SA-MP Forums Archive
Drive-by Restriction [HELP] - 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)
+--- Thread: Drive-by Restriction [HELP] (/showthread.php?tid=393505)



Drive-by Restriction [HELP] - Sting. - 18.11.2012

I wanted to disable drive by because of all the gun abuse. People can kill other people faster. Well I did not want to totally disable the Uzi/MP5/Tech9 and M4/AK47. So this is what I did.
Код:
if( newstate == PLAYER_STATE_DRIVER )
{
      SetPlayerArmedWeapon( playerid, 0 );
}
It doesn't allow the driver to have a weapon.

Next,
Код:
if( newstate == PLAYER_STATE_PASSENGER )
{
      SetPlayerArmedWeapon( playerid, 31 );
}
It allows M4 or AK47 even if I used the M4 weapon id. See now I tried adding the ID of the Uzi and it didn't work.
I tried it many ways. Here is one way.

Код:
if( newstate == PLAYER_STATE_PASSENGER )
{
      SetPlayerArmedWeapon( playerid, 31 ) && SetPlayerArmedWeapon( playerid, 28 );
}
I really don't know. How can I make it allow the M4 and Uzi?


Re: Drive-by Restriction [HELP] - Riddick94 - 18.11.2012

Am.. is that looks like if statement?
pawn Код:
SetPlayerArmedWeapon( playerid, 31 ) && SetPlayerArmedWeapon( playerid, 28 );



Re: Drive-by Restriction [HELP] - EliteApple - 18.11.2012

What I would do, is under OnPlayerEnterVehicle - disable their weapons as the driver - and if they enter the vehicle as a passenger, check to see if they even have an M4 or UZI(since I'm assuming you're only wanting these two weapons to perform the drive-by), if they have one of the weapons, set their armed status to that - otherwise disable it.


Re: Drive-by Restriction [HELP] - Sting. - 19.11.2012

Alright. But how do I check for the weapon they have?


Re: Drive-by Restriction [HELP] - iggy1 - 19.11.2012

You should take a look at the script in my sig (iweapons). With it you can disable drivebys globally or per player. You can also disable individual weapons from being used in a driveby. Also a few other features i can't really remember now. You can take a look at the code there to see how i did it.

Use these to get weapon info on a player.
https://sampwiki.blast.hk/wiki/GetPlayerWeapon
https://sampwiki.blast.hk/wiki/GetPlayerWeaponData


Re: Drive-by Restriction [HELP] - Sting. - 19.11.2012

Really didn't know there was GetPlayerWeaponData function. Lol.