Destroy vehicle without a player in it - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Destroy vehicle without a player in it (
/showthread.php?tid=535070)
Destroy vehicle without a player in it -
Eatos - 01.09.2014
It is possible to destroy a vehicle with a player driving it, but it's impossible to do so when nobody is in it.
How can I make it possible? Which file do I need to edit?
Thanks in advance!
Re: Destroy vehicle without a player in it -
PMH - 01.09.2014
nothing is impossible if u're a good scripter, or have some abilites like Kar
well, there's a callback "publie OnPlayerWeaponShot" u can use it
Re: Destroy vehicle without a player in it -
Eatos - 01.09.2014
Quote:
Originally Posted by PMH
nothing is impossible if u're a good scripter, or have some abilites like Kar
well, there's a callback "publie OnPlayerWeaponShot" u can use it
|
The problem is that I'm a noob, so I don't know which file to edit. I'm using 0.3z.
Re: Destroy vehicle without a player in it -
Stinged - 01.09.2014
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if (hittype == BULLET_HIT_TYPE_VEHICLE) // Checking if the player shot a vehicle
// Now hitid is the vehicleid
{
new Float:vhp;
GetVehicleHealth(hitid, vhp);
switch (weaponid)
{
case WEAPON_DEAGLE: SetVehicleHealth(hitid, vhp - 75);// Checking if the weapon is a desert eagle, then removing from the vehicle health 75 hp. You can modify it of course.
// Add your own, just giving and example.
}
return 0; // Preventing the default damage if someone was in a vehicle. All vehicle damage (Driver and no driver) is now like this.
}
return 1;
}
Re: Destroy vehicle without a player in it -
Eatos - 01.09.2014
Quote:
Originally Posted by Stinged
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { if (hittype == BULLET_HIT_TYPE_VEHICLE) // Checking if the player shot a vehicle // Now hitid is the vehicleid { new Float:vhp; GetVehicleHealth(hitid, vhp); switch (weaponid) { case WEAPON_DEAGLE: SetVehicleHealth(hitid, vhp - 75);// Checking if the weapon is a desert eagle, then removing from the vehicle health 75 hp. You can modify it of course. // Add your own, just giving and example. } return 0; // Preventing the default damage if someone was in a vehicle. All vehicle damage (Driver and no driver) is now like this. } return 1; }
|
Thanks!
Re: Destroy vehicle without a player in it -
cessil - 02.09.2014
https://sampwiki.blast.hk/wiki/DestroyVehicle
Re: Destroy vehicle without a player in it -
amirab - 02.09.2014
Quote:
Originally Posted by cessil
|
Ummm.
I don't think he actually need this for his idea