30.10.2014, 20:23
pawn Код:
#include <a_samp>
#define FILTERSCRIPT
new Float:WeaponDamages[53] =
{
0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
15.0, // Pistol.
0.0,
60.0, // Desert Eagle.
52.0, // Shotgun.
35.0, // Sawn-Off Shotgun.
52.0, // Combat Shotgun.
0.0,
28.0, // MP5.
30.0, // AK47.
35.0, // M4.
0.0,
38.0, // Rifle.
45.0, // Sniper Rifle.
0.0, 0.0, 0.0,
500.0, // Minigun.
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
};
public OnFilterScriptInit()
{
printf("Unoccupied Vehicle Damage Loaded");
return 1;
}
public OnFilterScriptExit()
{
printf("Unoccupied Vehicle Damage UnLoaded");
return 1;
}
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == BULLET_HIT_TYPE_VEHICLE)
{
if(!IsAnOccupiedVehicle(hitid))
{
new Float:VehHealth;
GetVehicleHealth(hitid, Float:VehHealth);
new Float:damage = WeaponDamages[weaponid];
SetVehicleHealth(hitid, VehHealth - damage);
}
}
return 1;
}
stock IsAnOccupiedVehicle(vehicleid)
{
for(new i = 0; i != MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(GetPlayerVehicleID(i) == vehicleid)return 0;
else return 1;
}
}
return 0;
}