SA-MP Forums Archive
How Avoid From Attaching 2 Same Player Objects... - 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: How Avoid From Attaching 2 Same Player Objects... (/showthread.php?tid=556748)



How Avoid From Attaching 2 Same Player Objects... - danish007 - 11.01.2015

Hello, How can i make that if player has attached one Object and im going to attachment menu and selecting that same playerobject again it should not be attached with old one. old one should be deleted or there should be message you are already wearing this item/Object/Cloth/Attahment....

Help Please.


Re: How Avoid From Attaching 2 Same Player Objects... - MD5 - 11.01.2015

You're probably referring towards the RemovePlayerAttachedObject function.


Re: How Avoid From Attaching 2 Same Player Objects... - danish007 - 11.01.2015

no it removes objects according to bones.. i want to make if id 1 is used in anyother slot you can not use id 1 again...


Re: How Avoid From Attaching 2 Same Player Objects... - danish007 - 11.01.2015

can you help me to make function to save object ids....
like isvalidplayerobject...
we make our function
isplayerobjectattached
and when we wear object it saves object id for player and when he wear it again it says you are already wearing object.


Re: How Avoid From Attaching 2 Same Player Objects... - danish007 - 11.01.2015

can't we make like tis?

Quote:

stock IsGroupTaken(grpname[])
{
for(new x; x < MAX_GROUPS; x++)
{
if(Groupinfo[x][active] == 1)
{
if(!strcmp(grpname, Groupinfo[x][grname], true) && strlen(Groupinfo[x][grname]) != 0) return 1;
}
}
return 0;
}

help please


Re: How Avoid From Attaching 2 Same Player Objects... - MD5 - 11.01.2015

This is an example that checks if (ID: 3) is on the player and allows them to remove it if so.

Код:
if(IsPlayerAttachedObjectSlotUsed(playerid, 3)) 
        {
            RemovePlayerAttachedObject(playerid, 3);
            SendClientMessage(playerid, -1, "The object has been removed.");
        }
Also, if you want it to save. You must make it an enum.