SA-MP Forums Archive
RemovePlayerAttachedObject doesnt work - 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: RemovePlayerAttachedObject doesnt work (/showthread.php?tid=454824)



RemovePlayerAttachedObject doesnt work - qkac1234 - 30.07.2013

Hi!

/hat command is working, but /removehat doesnt work. Can u explain me the problem?
Код:
new = hat;
COMMAND:hat(playerid, params[])
{
	hat = CreateObject(19352, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
	AttachObjectToPlayer(hat, playerid, 0, 0, 0.95, 0.0, 0, 90);
 	SendClientMessage(playerid,  0xFFFFFFFF,"Hat mode: on");
 	return 1;
}
COMMAND:removehat(playerid, params[])
{
 	RemovePlayerAttachedObject(playerid, hat);
 	SendClientMessage(playerid,  0xFFFFFFFF,"Hat mode: off");
 	return 1;
}
And can u help me, how to destroey the object when player is dead?


Re: RemovePlayerAttachedObject doesnt work - thimo - 30.07.2013

Try removing the object instead


Re: RemovePlayerAttachedObject doesnt work - ToiletDuck - 30.07.2013

LOL You dont need to create object and attach just use SetPlayerAttachedObject and to remove RemovePlayerAttachedObject...

pawn Код:
COMMAND:hat(playerid, params[])
{
    SetPlayerAttachedObject(playerid, 1, 19352, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0);
    SendClientMessage(playerid,  0xFFFFFFFF,"Hat mode: on");
    return 1;
}
COMMAND:removehat(playerid, params[])
{
    if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
    SendClientMessage(playerid,  0xFFFFFFFF,"Hat mode: off");
    return 1;
}



Re: RemovePlayerAttachedObject doesnt work - rouzbeh - 30.07.2013

deleted.