28.02.2010, 16:02
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.
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
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!"); } } }