object destoroy
#1

hey, can you give my example how to createobject, and if i shoot on him his destroy ?
Reply
#2

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;
}
Reply


Forum Jump:


Users browsing this thread: