SA-MP Forums Archive
anti-drive by - 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: anti-drive by (/showthread.php?tid=524862)



anti-drive by - jamal1992 - 08.07.2014

i wanna make a anti-drive by system and i make this
Код:
PUBLIC: OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
     if(GetPlayerState(Shooter) == 3)
	{
	    new Float:vhealth;
		new veh = GetPlayerVehicleID(Target);
		if(GetVehicleHealth(veh, vhealth) <= 550)
		{
	 		SetVehicleHealth(veh, 550);
	   		TogglePlayerControllable(Shooter, 0);
	   		SetTimerEx("ResetFreeze", 10000, false, "i", Shooter);
			SendClientMessage(Shooter,COLOR_RED,"Drive-By: You`re freeze for 10 seconds !");
		}
	}
        return 1;
But this works only when hit player, i wanna make this works when shoot in vehicle and that vehicle health is <= 550.
What to do ?


Re: anti-drive by - Vince - 08.07.2014

OnPlayerKeyStateChange. Check if they're pressing LOOK_LEFT or LOOK_RIGHT combined with KEY_FIRE and if they're in a vehicle.


Re: anti-drive by - nmader - 08.07.2014

Quote:
Originally Posted by Vince
Посмотреть сообщение
OnPlayerKeyStateChange. Check if they're pressing LOOK_LEFT or LOOK_RIGHT combined with KEY_FIRE and if they're in a vehicle.
You can also use SetPlayerArmedWeapon to zero, meaning if they go into a vehicle as the driver it just scrolls their weapon to their fist, meaning no firing. Sometimes, in a rare occasion, accidental firing can happen. I've had cats jump on my keyboard before and I'm sure someone else has before and they'd prefer not to be punished. Lol


Re: anti-drive by - jamal1992 - 09.07.2014

guys i wanna make that in special for cops, when shot player on the vehicle with damage <= 550 freeze him and vehicle hp set to 550, for drive-by driver have other script. Is any callback who can help me ? i can make this with OnPlayerShootVehicle (damage.inc) ?


Re: anti-drive by - jamal1992 - 10.07.2014

UP UP UP


Re: anti-drive by - jamal1992 - 15.07.2014

somebody can help me with that ?