RemovePlayerAttachedObject doesnt work
#1

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?
Reply
#2

Try removing the object instead
Reply
#3

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

deleted.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)