shortening damens code

This commit is contained in:
Lorenc Pekaj 2018-12-27 12:57:47 +11:00
parent 0be53aab7c
commit 1e78bb4481

View File

@ -1268,32 +1268,17 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float:
// Cops Cannot Damage Innocent Vehicles, Unless Wanted Players Occupy Alongside Them // Cops Cannot Damage Innocent Vehicles, Unless Wanted Players Occupy Alongside Them
if ( p_Class[ playerid ] == CLASS_POLICE && p_WantedLevel[ iDriver ] == 0 ) if ( p_Class[ playerid ] == CLASS_POLICE && p_WantedLevel[ iDriver ] == 0 )
{ {
new new
innocentVehicleID = GetPlayerVehicleID( iDriver ); innocentVehicleID = GetPlayerVehicleID( iDriver );
foreach ( new i : Player ) foreach ( new i : Player ) if ( i != iDriver )
{ {
if ( !IsPlayerConnected( i ) )
continue;
if ( i == iDriver )
continue;
new new
iTargetVehicle = GetPlayerVehicleID( i ); iTargetVehicle = GetPlayerVehicleID( i );
if ( iTargetVehicle == innocentVehicleID ) if ( iTargetVehicle == innocentVehicleID && GetPlayerWantedLevel( i ) > 0 ) {
{
if ( GetPlayerWantedLevel( i ) > 0 )
return 1; return 1;
} }
else
{
continue;
}
} }
return ShowPlayerHelpDialog( playerid, 2000, "You cannot damage an innocent player's vehicle unless they have wanted players alongside them!" ), 0; return ShowPlayerHelpDialog( playerid, 2000, "You cannot damage an innocent player's vehicle unless they have wanted players alongside them!" ), 0;