26.06.2012, 07:19
guys could somebody help me? i need to create a command that deattaches any attached object to player... but im a little noob in scripting... any help ? :S
CMD:removemyobjects(playerid, params[])
{
for(new ao; ao < 10; ao++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, ao))
{
RemovePlayerAttachedObject(playerid, ao);
}
}
return 1;
}
if(!strcmp(cmdtext,"/removemyobjects", true)) // If the command submitted.
{
for(new ao; ao < 10; ao++) // This loops through the ten slots, so all codes between the for braces will happen for the ten
{
if(IsPlayerAttachedObjectSlotUsed(playerid, ao)) // Checks if the slots are used.
{
RemovePlayerAttachedObject(playerid, ao); // If so remove the object(s).
}
}
return 1;
}
stock RemovePlayerAttachedObjects(playerid)
{
new numfound;
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, i)){
RemovePlayerAttachedObject(playerid,i)
numfound++;
}
}
return
}
//then later on use it like this(any where)
RemovePlayerAttachedObjects(playerid);
//also it can return how many objects were found example
new objects = RemovePlayerAttachedObjects(playerid);
printf("objects found: %d",objects);