02.11.2010, 00:00
(
Last edited by The_Moddler; 07/03/2011 at 06:15 PM.
)
Damage Car System V2.5
Hi,Here I bring this simple system, basicly, you can damage cars without a driver with a gun.
Usage:
Extract the files to your 'pawno/include' folder, then in your script you put: #include <Damage>, and you are ready to use it.
You can also change some configuration opening damage.inc and tweak it to your taste.
You must include those callbacks, if you don't, you will get an error message.
pawn Code:
public OnPlayerShotVehicle(playerid, vehicleid)
{
//your code here...
printf("playerid %d is shooting vehicleid %d", playerid, vehicleid);
return 1;
}
public OnPlayerUnShotVehicle(playerid, vehicleid)
{
//your code here...
printf("playerid %d stopped shooting vehicleid %d", playerid, vehicleid);
return 1;
}
pawn Code:
D_OnPlayerConnect(playerid); //Under OnPlayerConnect
D_OnPlayerDisconnect(playerid); //Under OnPlayerDisconnect
D_OnPlayerKeyStateChange(playerid, newkeys, oldkeys); //Under OnPlayerKeyStateChange
Functions:
Well, there is just one for now, if you need any other fuction that I can make just post in here.
pawn Code:
IsPlayerShootingVehicle(playerid);
pawn Code:
if(IsPlayerShooting(playerid))
{
printf("playerid %d is shooting vehicleid %d", playerid, IsPlayerShooting(playerid));
}
» It doesn't work with the rifle, shotgun, and with some other constant reloading weapons.
» You can damage cars trough walls.
» If there are too many cars together, it may not work properly.
Special thanks:
niCe for the IsPlayerAimingAt.
For the guys who made IsVehicleOccupied and GetClosestVehicle.
And to g_aSlice for some helping
Links:
Solidfiles > Errors FIXED. <
Version history:
- V2.5: Fixed a bug when the vehicle exploded, now it will respawn if health is less than 250, fixed errors, added damage to car.
- V2.0: Added callbacks and functions.
- V1.0: Just the script.