Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*************************************
- **************************************
- ******* Vehicle Damage Enabler *******
- *******[Alpha v2.0] by Salvator ******
- **************************************
- **************************************/
- #include <a_samp>
- public OnFilterScriptInit()
- {
- print("Vehicle Damage Enabler [Alpha v2.0] by Salvator");
- return 1;
- }
- forward DriverAvailable(vehicleid); //Not sure who originally made this function, but this is with my edits
- public DriverAvailable(vehicleid)
- {
- for(new i=0; i<= MAX_PLAYERS; i++)
- {
- if(IsPlayerInAnyVehicle(i))
- {
- if(GetPlayerVehicleID(i) == vehicleid)
- {
- if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
- {
- return 1;
- }
- }
- }
- }
- return 0;
- }
- IsAirModel(modelid) //Thanks and credits goes to AmigaBlizzard for showing me this function
- {
- switch(modelid)
- {
- case 460, 476, 511, 512, 513, 519, 520, 553, 577, 592, 593, 417, 425, 447, 469, 487, 488, 497, 548, 563:
- return 1;
- }
- return 0;
- }
- public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
- {
- new wID = weaponid;
- new Float:vHealth; GetVehicleHealth(hitid, vHealth);
- if(hittype == 2 && !DriverAvailable(hitid) && vHealth > 249)
- {
- if(IsAirModel(GetVehicleModel(hitid)) == 1)
- {
- if(wID == 28 || wID == 32) SetVehicleHealth(hitid, vHealth - 8);
- if(wID == 22 || wID == 29) SetVehicleHealth(hitid, vHealth - 10);
- if(wID == 30 || wID == 31) SetVehicleHealth(hitid, vHealth - 12);
- if(wID == 23) SetVehicleHealth(hitid, vHealth - 16);
- if(wID == 33) SetVehicleHealth(hitid, vHealth - 30);
- if(wID == 27) SetVehicleHealth(hitid, vHealth - 48);
- if(wID == 34) SetVehicleHealth(hitid, vHealth - 50);
- if(wID == 24 || wID == 38) SetVehicleHealth(hitid, vHealth - 56);
- if(wID == 25 || wID == 26) SetVehicleHealth(hitid, vHealth - 60);
- }
- else
- {
- if(wID == 28 || wID == 32) SetVehicleHealth(hitid, vHealth - 20);
- if(wID == 22 || wID == 29) SetVehicleHealth(hitid, vHealth - 25);
- if(wID == 30 || wID == 31) SetVehicleHealth(hitid, vHealth - 30);
- if(wID == 23) SetVehicleHealth(hitid, vHealth - 40);
- if(wID == 33) SetVehicleHealth(hitid, vHealth - 75);
- if(wID == 27) SetVehicleHealth(hitid, vHealth - 120);
- if(wID == 34) SetVehicleHealth(hitid, vHealth - 125);
- if(wID == 24 || wID == 38) SetVehicleHealth(hitid, vHealth - 140);
- if(wID == 25 || wID == 26) SetVehicleHealth(hitid, vHealth - 150);
- }
- new vModel = GetVehicleModel(hitid);
- new Float:hX, Float:hY, Float:hZ, Float:rX, Float:rY, Float:rZ;
- GetVehicleModelInfo(vModel, VEHICLE_MODEL_INFO_WHEELSFRONT, hX, hY, hZ);
- GetVehicleModelInfo(vModel, VEHICLE_MODEL_INFO_WHEELSREAR, rX, rY, rZ);
- new panels, doors, lights, tires;
- //Gammix's vehicleplus.inc helped me realize how to define wheels position, so I'd like to thank him.
- //Left front wheel
- if( fX >= hX - 3.0 && fX <= hX + 0.0 &&
- fY >= hY - 0.5 && fY <= hY + 0.5 &&
- fZ >= hZ - 0.5 && fZ <= hZ + 0.5 )
- {
- GetVehicleDamageStatus(hitid, panels, doors, lights, tires);
- UpdateVehicleDamageStatus(hitid, panels, doors, lights,(tires | 0b1000));
- }
- //Right front wheel
- if( fX >= hX - 0.5 && fX <= hX + 0.5 &&
- fY >= hY - 0.5 && fY <= hY + 0.5 &&
- fZ >= hZ - 0.5 && fZ <= hZ + 0.5 )
- {
- GetVehicleDamageStatus(hitid, panels, doors, lights, tires);
- UpdateVehicleDamageStatus(hitid, panels, doors, lights, (tires | 0b0010));
- }
- //Left rear wheel
- if( fX >= rX - 3.0 && fX <= rX + 0.0 &&
- fY >= rY - 0.5 && fY <= rY + 0.5 &&
- fZ >= rZ - 0.5 && fZ <= rZ + 0.5 )
- {
- GetVehicleDamageStatus(hitid, panels, doors, lights, tires);
- UpdateVehicleDamageStatus(hitid, panels, doors, lights, (tires | 0b0100));
- }
- //Right rear wheel
- if( fX >= rX - 0.5 && fX <= rX + 0.5 &&
- fY >= rY - 0.5 && fY <= rY + 0.5 &&
- fZ >= rZ - 0.5 && fZ <= rZ + 0.5 )
- {
- GetVehicleDamageStatus(hitid, panels, doors, lights, tires);
- UpdateVehicleDamageStatus(hitid, panels, doors, lights, (tires | 0b0001));
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement