object destoroy - 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: object destoroy (
/showthread.php?tid=580268)
object destoroy -
Karolukas123 - 03.07.2015
hey, can you give my example how to createobject, and if i shoot on him his destroy ?
Re: object destoroy -
Lynn - 03.07.2015
This is one example of how it's done.
If you have multiple objects you want to destroy it's done a bit different.
But for a quick reference this is how it's done.
I believe BULLET_HIT_TYPE_PLAYER_OBJECT is the one used for custom objects.
If not use BULLET_HIT_TYPE_OBJECT
pawn Код:
new CreatedObject; // Place this as a Global variable.
CreatedObject = CreateObject(MODELID, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 100.00); // Place this where you're creating the object.
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT && hitid == CreatedObject) // BULLET_HIT_TYPE_PLAYER_OBJECT = Hittype 4
{
DestroyObject(CreatedObject); // Destroys the object you created upon impact.
}
return true;
}