PDA

View Full Version : attachedobject wont remove from player


omidi
21/03/2013, 08:43 AM
bagmoney = SetPlayerAttachedObject( i, 1, 1550, 1, 0.117696, -0.298594, -0.012395, 353.867675, 112.472045, 156.506286, 1.000000, 1.000000, 1.000000 ); // CJ_MONEY_BAG -
new bagmoney;
public OnPlayerSpawn(playerid)
{

if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid, bagmoney);

the problem is when i relog using sobit it wont remove object
i also puted in onplayerconnect and or player requestclass and even a command /remove but it the command remove randomly sometimes works and not
dcmd_remove(playerid,params[])
{
#pragma unused params
RemovePlayerAttachedObject(bagmoney,playerid);
when i put this code in on spawn player or connect or request it wont wrok too
RemovePlayerAttachedObject(bagmoney,playerid)

what is the problem ?

Xabi
21/03/2013, 08:58 AM
You should remove it OnPlayerDisconnect(playerid) and also change the attach for

bagmoney[playerid] = SetPlayerAttachedObject( i, 1, 1550, 1, 0.117696, -0.298594, -0.012395, 353.867675, 112.472045, 156.506286, 1.000000, 1.000000, 1.000000 ); // CJ_MONEY_BAG -