26.07.2011, 13:30
(
Последний раз редактировалось Nanory; 22.01.2012 в 12:16.
)
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:
Moreover there are also 2 new Function which can be use
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
and insert the new Callback
Example
1)
2)
3) My Favourite :P
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
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;
}
Код:
IsPlayerLookingAtVehicle(playerid,vehicleid); GiveVehicleHealth(vehicleid,health);
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>
pawn Код:
public OnEmptyVehicleDamage(vehicleid,playerid,exems)
{
// Your Code
return 1;
}
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;
}
pawn Код:
public OnEmptyVehicleDamage(vehicleid,playerid,exems)
{
// Toggle Vehicle Alarm
return 1;
}
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