[Include] Car damage system - Damage a car without a driver!
#1

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;
}
You will have to add this under their respective callbacks:

pawn Code:
D_OnPlayerConnect(playerid); //Under OnPlayerConnect
D_OnPlayerDisconnect(playerid); //Under OnPlayerDisconnect
D_OnPlayerKeyStateChange(playerid, newkeys, oldkeys); //Under OnPlayerKeyStateChange
That's all, if you don't put it, it won't work and it will give you some warnings.

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);
It will return the vehicle id if he is shooting, 0 if not.

pawn Code:
if(IsPlayerShooting(playerid))
{
    printf("playerid %d is shooting vehicleid %d", playerid, IsPlayerShooting(playerid));
}
Bugs:

» 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.
Peace.
Reply


Messages In This Thread
Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 00:00
Re: Car damage system - Damage a car without a driver! - by willsuckformoney - 02.11.2010, 00:07
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 00:08
Re: Car damage system - Damage a car without a driver! - by willsuckformoney - 02.11.2010, 00:09
Re: Car damage system - Damage a car without a driver! - by GaGlets(R) - 02.11.2010, 00:11
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 00:13
Re: Car damage system - Damage a car without a driver! - by Camacorn - 02.11.2010, 00:21
Re: Car damage system - Damage a car without a driver! - by willsuckformoney - 02.11.2010, 00:32
Re: Car damage system - Damage a car without a driver! - by ViruZZzZ_ChiLLL - 02.11.2010, 00:55
Re: Car damage system - Damage a car without a driver! - by Slice - 02.11.2010, 07:08
Re: Car damage system - Damage a car without a driver! - by iJumbo - 02.11.2010, 14:52
Re: Car damage system - Damage a car without a driver! - by Brian_Furious - 02.11.2010, 15:03
Re: Car damage system - Damage a car without a driver! - by juuleman - 02.11.2010, 15:11
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 16:41
Re: Car damage system - Damage a car without a driver! - by WillyP - 02.11.2010, 16:44
Re: Car damage system - Damage a car without a driver! - by Hiddos - 02.11.2010, 16:46
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 17:08
Re: Car damage system - Damage a car without a driver! - by Slice - 02.11.2010, 17:22
AW: Car damage system - Damage a car without a driver! - by Trooper[Y] - 02.11.2010, 17:24
Re: AW: Car damage system - Damage a car without a driver! - by Slice - 02.11.2010, 17:27
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 17:29
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 18:10
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 20:54
Re: Car damage system - Damage a car without a driver! - by Retardedwolf - 03.11.2010, 05:48
Re: Car damage system - Damage a car without a driver! - by titanak - 03.11.2010, 15:46
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 03.11.2010, 18:34
Re: Car damage system - Damage a car without a driver! - by jasonnw666 - 03.11.2010, 20:00
Re: Car damage system - Damage a car without a driver! - by jasonnw666 - 04.11.2010, 18:34
Re: Car damage system - Damage a car without a driver! - by cmg4life - 05.11.2010, 16:56
Re: Car damage system - Damage a car without a driver! - by Georgelopez1 - 11.01.2011, 20:13
Re: Car damage system - Damage a car without a driver! - by LZLo - 04.02.2011, 20:34
Re: Car damage system - Damage a car without a driver! - by Tama - 20.03.2011, 07:50
Re: Car damage system - Damage a car without a driver! - by Venice - 23.03.2011, 06:54
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 31.03.2011, 23:42
Re: Car damage system - Damage a car without a driver! - by okami13 - 18.06.2011, 13:06
AW: Car damage system - Damage a car without a driver! - by ULLLIIK - 18.06.2011, 14:16
Re: Car damage system - Damage a car without a driver! - by itachipirate - 31.01.2012, 23:10
Re: Car damage system - Damage a car without a driver! - by oscar7610 - 30.03.2012, 00:00
Re: Car damage system - Damage a car without a driver! - by Skribblez - 30.03.2012, 01:38

Forum Jump:


Users browsing this thread: 1 Guest(s)