SA-MP Forums Archive
asking about remove object - 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: asking about remove object (/showthread.php?tid=502242)



asking about remove object - iThePunisher - 22.03.2014

im using AttachObjectToPlayer , but i dont know what is the function to remove the object
do anyone know?


Re: asking about remove object - Abagail - 22.03.2014

You'd wanna store the object ID in a variable or pVar. For instance when creating/attaching said object...

Object = CreateObject... your code is here...
SetPVarInt(playerid, "AttachedObject", Object);

And then to remove it you'd do:
new objectid = GetPVarInt(playerid, "AttachedObject");
DestroyObject(objectid);


Re: asking about remove object - iThePunisher - 22.03.2014

im not working with pvar!
i want to know how can i remove the attached object to a player without pvar


Re: asking about remove object - TLN - 23.03.2014

https://sampwiki.blast.hk/wiki/RemovePlayerAttachedObject


Re: asking about remove object - iThePunisher - 23.03.2014

without command?
Example on player death remove attachmedobject


Re: asking about remove object - TLN - 23.03.2014

I'm not sure if this will work.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
    {
        if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
    }
    return 1;
}