SA-MP Forums Archive
OnPlayerWeaponShot - BULLET_HIT_TYPE_OBJECT - Object Stream - 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: OnPlayerWeaponShot - BULLET_HIT_TYPE_OBJECT - Object Stream (/showthread.php?tid=488604)



OnPlayerWeaponShot - BULLET_HIT_TYPE_OBJECT - Object Stream - Noliax8 - 18.01.2014

Hello,

I tried to do:

pawn Code:
forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_OBJECT)
    {
        if(IsValidObject(hitid))
        {
            DestroyDynamicObject(hitid);
        }
    }
   
    return 1;
}
It's impossible to destroy dynamic object ? I mean impossible to detect ?
Thanks


Re: OnPlayerWeaponShot - BULLET_HIT_TYPE_OBJECT - Object Stream - MP2 - 18.01.2014

You'll have to wait until the streamer is updated.


Re: OnPlayerWeaponShot - BULLET_HIT_TYPE_OBJECT - Object Stream - Patrick - 18.01.2014

Thanks pds2k12 and BigETI later <3, I suppose this would work.

pawn Code:
public OnShootDynamicObject(playerid, weaponid, objectid, Float:fX, Float:fY, Float:fZ)
{
    new
        Float:ObjectPos[3], string[ 90 ];
    GetDynamicObjectPos(objectid, ObjectPos[0], ObjectPos[1], ObjectPos[2]);

    CreateExplosion(ObjectPos[0], ObjectPos[1], ObjectPos[2], 10, 15.0)

    format(string, sizeof(string), "You are shooting at ObjectID: %i - X: %f - Y: %f - Z: %f", objectid, fX, fY, fZ);
    SendClientMessage(playerid, -1, string);

    DestroyDynamicObject( objectid );
    return true;
}
Updated Streamer by BigETI - Click Me!

EDIT

@BigETI: Thanks for the information, I've noticed that you've done it internally.


AW: OnPlayerWeaponShot - BULLET_HIT_TYPE_OBJECT - Object Stream - BigETI - 18.01.2014

No need for IsValidDynamicObject() inside OnShootDynamicObject() by the way.


Re : OnPlayerWeaponShot - BULLET_HIT_TYPE_OBJECT - Object Stream - Noliax8 - 18.01.2014

Perfect! Thanks you BigETI