[Include] OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server]
#1

What is it?
Yesterday i saw, that Kalcor released a new Server Version for SA-MP and the new Callbacks allows me to make this little include. It's my first Include which I release ... and I hope you will enjoy it.

With this Include you can recognize if a vehicle got hit by a person with a weapon...
There is a FS from somebody which was released last year and do almost the same like my include but i think this solution is a little bit better because it doesn't use the Camera Vectors. It uses the new Callback "OnUnoccupiedVehicleUpdate" to check if the vehicle was really hit and moved...

Update v0.3
This Update is a really important update, because [BEP]AcerPilot gave me a tip and now the include doesn't use the Camera Vectors. It means that the include runs more correctly and faster, but if you want to check if the Person Looks at the vehicle you could use the function "IsPlayerLookingAtVehicle".

Now I use only the Animationindex, too. This should speed up the Include.

Furthermore the Callback change:
pawn Код:
public OnEmptyVehicleDamage(vehicleid,playerid,exems)
{
    // Vehicleid = The ID of The Vehicle
        // Playerid = The ID of the Player who shot or hit the vehicle
        // exems = The Time to execute this Callback in milliseconds
    return 1;
}
Moreover there are also 2 new Function which can be use
Код:
IsPlayerLookingAtVehicle(playerid,vehicleid);
GiveVehicleHealth(vehicleid,health);
Update v0.21
1) Bugfixxes...
2) Now you can also use your fist to damage the vehicle...

Update v0.2
1) I improved the Camera Vector System... It works so great now, almost perfect :P. If you shot at the vehicle or hit it with a baseball bat, shovel etc. and the vehicle moves, the system recognize it...
2) Furthermore now you can also use the weapons from 1 to 15 to damage an empty vehicle... I made a blockade so the Callback "OnEmptyVehicleDamage" will only call as often as you hit the vehicle and not as often as "OnUnoccupiedVehicleUpdate" is called.
And the Script runs without any for loop, so it should be very fast...


Videos
Version 0.2
Version 0.1


How to install
Copy the VD.inc into the Pawno\include folder

Insert the Include
pawn Код:
#include <VB>
and insert the new Callback
pawn Код:
public OnEmptyVehicleDamage(vehicleid,playerid,exems)
{
    // Your Code
    return 1;
}
Example
1)
pawn Код:
public OnEmptyVehicleDamage(vehicleid,playerid,exems)
{
        if(IsPlayerLookingAtVehicle(playerid,vehicleid))
        {
               new Float:Health;
                   GetVehicleHealth(vehicleid,Health);
                   SetVehicleHealth(vehicleid,Health-random(100));
        }
        //You do not have to use the function "IsPlayerLookingAtVehicle" but with this function you can be 99%    
        //sure that you shot at the vehicle ;)
    return 1;
}
2)
pawn Код:
public OnEmptyVehicleDamage(vehicleid,playerid,exems)
{
    // Toggle Vehicle Alarm
    return 1;
}
3) My Favourite :P
pawn Код:
public OnEmptyVehicleDamage(vehicleid,playerid,exems)
{
    ChangeVehicleColor(vehicleid,random(126),random(126));
    return 1;
}

The Future
There are still some little problems, because not every vehicle moves if it got hit. I will try to solve this little problem...


Credits
To RyDeR (GetVehicleSize)
To unkown Person who made "Holding define"
To wups (Alternativ hook method for callbacks)


Download (All this includes doen't work with 0.3d or above)
Click me (v0.3)
Click me (v0.3 - Pastebin)


Click me (v0.21)
Click me (v0.21 - Pastebin)

Click me (v0.2)
Click me (v0.2 - Pastebin)

Click me (v0.1)
Click me (v0.1 - Pastebin)

Warning:
You need the the newest SA-MP 0.3c Server Version (R3)
Newest 0.3c Server Version
Reply


Messages In This Thread
OnEmptyVehicleDamage - Damage an empty vehicle (v0.3) [0.3c R3 Server] | >>Update<< - by Nanory - 26.07.2011, 13:30
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by FireCat - 26.07.2011, 13:33
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Amel_PAtomAXx - 26.07.2011, 13:54
AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Nanory - 26.07.2011, 13:58
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Amel_PAtomAXx - 26.07.2011, 14:04
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Jeroen52 - 26.07.2011, 14:32
AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Nanory - 26.07.2011, 14:37
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Jeroen52 - 26.07.2011, 15:01
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Skylar Paul - 26.07.2011, 15:33
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by blackwave - 26.07.2011, 15:38
AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Nanory - 26.07.2011, 16:23
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by TheArcher - 26.07.2011, 16:34
AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Nanory - 27.07.2011, 10:14
Re: AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Skylar Paul - 27.07.2011, 13:46
AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Nanory - 28.07.2011, 13:50
AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by dUDALUS - 30.07.2011, 14:45
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by whitedragon - 02.08.2011, 20:56
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Deskoft - 02.08.2011, 21:01
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Scenario - 02.08.2011, 21:17
AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Nanory - 02.08.2011, 23:41
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by whitedragon - 03.08.2011, 09:49
AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Nanory - 03.08.2011, 10:58
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by whitedragon - 03.08.2011, 14:02
Re : OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by grekon - 20.01.2012, 18:57
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by rbN. - 20.01.2012, 19:21
AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by NaS - 20.01.2012, 21:17
Re: AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by rbN. - 21.01.2012, 07:05
AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by NaS - 21.01.2012, 23:41
AW: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by Nanory - 22.01.2012, 12:14
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by aurimasko - 22.01.2012, 19:52
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by The_Coder - 30.03.2012, 07:18
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by mprofitt - 10.05.2012, 05:06
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by NoahF - 29.09.2012, 10:32
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by CaptainMactavish - 29.09.2012, 17:55
Re: OnEmptyVehicleDamage - Damage an empty vehicle (v0.1) [0.3c R3 Server] - by OKStyle - 30.08.2013, 05:49

Forum Jump:


Users browsing this thread: 2 Guest(s)