Anti-Driveby Fuction. Can be usefull!
#1

Hey, I was looking for a anti-driveby but all the scripts that i saw were sucks. So I made a fuction for OnPlayerKeyStateChange.
This will remove you wrong the vehicle if you try to shoot uit the windows with a mp5. Only a mp5. Because my server only got a mp5. So change that by yourself
Might this fuction is already somewere. But I swear i made this by myself. You don't have to put credits or something.

Код:
	if(newkeys & KEY_FIRE) // for bikes!
	{
		if(IsPlayerInAnyVehicle(playerid) && GetPlayerWeapon(playerid) == 29)
		{
		  new vid = GetPlayerVehicleID(playerid);
			switch(GetVehicleModel(vid))
			{
  				case 522: RemovePlayerFromVehicle(playerid);
  				case 462: RemovePlayerFromVehicle(playerid);
  				case 521: RemovePlayerFromVehicle(playerid);
  				case 461: RemovePlayerFromVehicle(playerid);
  				case 463: RemovePlayerFromVehicle(playerid);
  				case 581: RemovePlayerFromVehicle(playerid);
  				case 448: RemovePlayerFromVehicle(playerid);
  				case 586: RemovePlayerFromVehicle(playerid);
  				case 523: RemovePlayerFromVehicle(playerid);
  				case 468: RemovePlayerFromVehicle(playerid);
  				case 471: RemovePlayerFromVehicle(playerid);
  				case 509: RemovePlayerFromVehicle(playerid);
  				case 481: RemovePlayerFromVehicle(playerid);
  				case 510: RemovePlayerFromVehicle(playerid);
			}
		}
	}
	if((newkeys & KEY_FIRE && newkeys & KEY_LOOK_RIGHT) || (newkeys & KEY_FIRE && newkeys & KEY_LOOK_LEFT))
	{
 		if(IsPlayerInAnyVehicle(playerid))
		{
		  if(GetPlayerWeapon(playerid) == 29 || GetPlayerWeapon(playerid) == 28 || GetPlayerWeapon(playerid) == 32)
			{
				new string[128];
				RemovePlayerFromVehicle(playerid);
				SendClientMessage(playerid, RED,"DriveBy is not allowed on this server!");
			}
	  }
	}
I removed the bike part. Because its bugged. So people still can shoot with alt or LMB in a bike. But not with E or Q
Reply
#2

unuseful script.. where tec, where uzi..
Reply
#3

Well, Just add them its not that hard.. I got only a mp5 in my server. I will add them for the lazy people.
Oh and yea its bugged. When a player enter the car while he is shooting he can keep shooting. But also people can fix that. I gonna do it now so it gets on in a few mins.

(edit) Oh and I didn't post this because the removeplayerfromvehicle...
But I think this on is better because it detect shooting when a player start shooting, And not when he killed a person or something. Because I only found that kind of anti driveby systems. But might i didn't saw all of them.
Reply
#4

Quote:
Originally Posted by ^Psycho^
unuseful script.. where tec, where uzi..
I added them you lazy shithead.
Reply
#5

pawn Код:
case 522: RemovePlayerFromVehicle(playerid);
                case 462: RemovePlayerFromVehicle(playerid);
                case 521: RemovePlayerFromVehicle(playerid);
                case 461: RemovePlayerFromVehicle(playerid);
                case 463: RemovePlayerFromVehicle(playerid);
                case 581: RemovePlayerFromVehicle(playerid);
                case 448: RemovePlayerFromVehicle(playerid);
                case 586: RemovePlayerFromVehicle(playerid);
                case 523: RemovePlayerFromVehicle(playerid);
                case 468: RemovePlayerFromVehicle(playerid);
                case 471: RemovePlayerFromVehicle(playerid);
                case 509: RemovePlayerFromVehicle(playerid);
                case 481: RemovePlayerFromVehicle(playerid);
                case 510: RemovePlayerFromVehicle(playerid);
==

pawn Код:
case 462,521,461,/*other models*/,510: RemovePlayerFromVehicle(playerid);
Reply
#6

Ow lol
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)