SA-MP Forums Archive
Helmet problem - 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: Helmet problem (/showthread.php?tid=319210)



Helmet problem - Dan_Barocu - 18.02.2012

im writing /helmet the helmets goes on head..but i cant make it come off if i type /helmet again..

Код:
if(strcmp(cmd, "/helmet",true) == 0) {
		SetPlayerAttachedObject(playerid,3 , 18645, 2, 0.07, 0.017, 0, 88, 75, 0);
		return 1;
		}
PS:i want to write /helmet to put helmet on if i type again helmet then the helmet goes off pleasee help Romanian!


Re: Helmet problem - Nonameman - 18.02.2012

To remove attached object, you have to use the RemovePlayerAttachedObject() function, calling again SetPlayerAttachedObject() won't work.

pawn Код:
if (strcmp(cmd, "/helmet", true) == 0) {
    if (IsPlayerAttachedObjectSlotUsed(playerid, 3))
        RemovePlayerAttachedObject(playerid, 3);
    else
        SetPlayerAttachedObject(playerid, 3, 18645, 2, 0.07, 0.017, 0, 88, 75, 0);
    return 1;
}