Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <YSI\y_iterate>
- #include <YSI\y_hooks>
- hook: OnVehicleSpawn(vehicleid)
- {
- SetVehicleHealth(vehicleid, 1000.0);
- return 1;
- }
- new Timer[MAX_VEHICLES];
- new bool:TimerUsed[MAX_VEHICLES];
- public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
- {
- if(hittype == BULLET_HIT_TYPE_VEHICLE)
- {
- if(!VehicleUnoccupied(hitid))
- {
- new Float:Health;
- GetVehicleHealth(hitid, Health);
- if(Health > 249.0)
- {
- switch(weaponid)
- {
- case 1 .. 4: SetVehicleHealth(hitid, (Health = Health-25.0));
- case 5 .. 8: SetVehicleHealth(hitid, (Health = Health-50.0));
- case 9: SetVehicleHealth(hitid, (Health = Health-50.0));
- case 10 .. 15: SetVehicleHealth(hitid, (Health = Health-75.0));
- case 22, 23: SetVehicleHealth(hitid, (Health = Health-75.0));
- case 24: SetVehicleHealth(hitid, (Health = Health-100.0));
- case 25: SetVehicleHealth(hitid, (Health = Health-120.0));
- case 26, 27: SetVehicleHealth(hitid, (Health = Health-125.0));
- case 28, 32: SetVehicleHealth(hitid, (Health = Health-35.0));
- case 29: SetVehicleHealth(hitid, (Health = Health-100.0));
- case 30, 31: SetVehicleHealth(hitid, (Health = Health-75.0));
- case 33: SetVehicleHealth(hitid, (Health = Health-150.0));
- case 34: SetVehicleHealth(hitid, (Health = Health-200.0));
- case 38: SetVehicleHealth(hitid, (Health = Health-50.0));
- }
- CallLocalFunction("PlayerDamageUnoccupiedVehicle", "ddi", playerid, hitid, weaponid);
- }
- else if(Health < 250.0)
- {
- if(TimerUsed[hitid] == false)
- {
- Timer[hitid] = SetTimerEx("OnVehicleExplode", 5000, false, "d", hitid);
- TimerUsed[hitid] = true;
- }
- }
- }
- }
- return 1;
- }
- // native VehicleUnoccupied(vehicleid);
- stock VehicleUnoccupied(vehicleid)
- {
- foreach(new i: Player)
- {
- if(GetPlayerVehicleID(i) == vehicleid && GetPlayerVehicleSeat(i) == 0) return 1;
- }
- return 0;
- }
- forward PlayerDamageUnoccupiedVehicle(playerid, vehicleid, weaponid);
- forward OnVehicleExplode(vehicleid);
- // END.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement