PDA

View Full Version : How Avoid From Attaching 2 Same Player Objects...


danish007
11/01/2015, 02:18 PM
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.

MD5
11/01/2015, 02:47 PM
You're probably referring towards the RemovePlayerAttachedObject (http://wiki.sa-mp.com/wiki/RemovePlayerAttachedObject) function.

danish007
11/01/2015, 02:57 PM
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...

danish007
11/01/2015, 03:02 PM
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.

danish007
11/01/2015, 03:39 PM
can't we make like tis?

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

MD5
11/01/2015, 09:26 PM
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.