Quantcast
Channel: SA-MP Forums - Filterscripts
Viewing all articles
Browse latest Browse all 595

[FilterScript] Shoot in car

$
0
0
I want to present you with a script that allows you to shoot in the car, which is not occupied and it starts to break down and catch fire.

photo: https://imgur.com/a/KP44mJa

download: https://www.mediafire.com/file/v2fod.../shot.rar/file

open code:
PHP Code:

#define FILTERSCRIPT

#include <a_samp>

new TimerRespawnVehicle;

IsVehicleOccupied(vehicleid)
{
    for(new 
iGetMaxPlayers(); i++)
    {
        if(!
IsPlayerConnected(i)) continue;
        if(
IsPlayerInVehicle(i,vehicleid)) return true;
    }
    return 
false;
}


public 
OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
hittype == BULLET_HIT_TYPE_VEHICLE){
        if(!
IsVehicleOccupied(hitid)){
            new 
panelsdoorslightstiresFloat:health;
            
GetVehicleDamageStatus(hitidpanelsdoorslightstires);
            switch(
random(3)){
            case 
0panels encode_panels(1111333);
            case 
1doors encode_doors(4444);
            case 
2lights encode_lights(1111);
            }
            
GetVehicleHealth(hitidhealth);
            
SetVehicleHealth(hitid, (health -(weaponid 4)));
            
UpdateVehicleDamageStatus(hitidpanelsdoorslightstires);
        }
    }
    return 
true;
}

public 
OnFilterScriptInit()
{
    
TimerRespawnVehicle SetTimer("RespawnVehicle",60000*5true); // one respawn all vehicle in 5 min
    
return true;
}

public 
OnFilterScriptExit()
{
    
KillTimer(TimerRespawnVehicle);
    return 
true;
}


forward RespawnVehicle();
public 
RespawnVehicle(){
    for(new 
NULL<= MAX_VEHICLESi++){
        if(
== INVALID_VEHICLE_ID) continue;
        if(!
IsVehicleOccupied(i))  SetVehicleToRespawn(i);
    }
    return 
true;
}

encode_lights(light1light2light3light4) return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
encode_doors(bonnetbootdriver_doorpassenger_door) return bonnet | (boot << 8) | (driver_door << 16) | (passenger_door << 24);
encode_panels(flpfrprlprrpwindshieldfront_bumperrear_bumper) return flp | (frp << 4) | (rlp << 8) | (rrp << 12) | (windshield << 16) | (front_bumper << 20) | (rear_bumper << 24); 


Viewing all articles
Browse latest Browse all 595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>