21.10.2016, 22:26
Hi,
I'm trying to get the near objects for my inventory scripts.
This is the command to get the near objects
I need a funtion that returns the amount of objects that are near the player. ( Dropped[MAX_OBJECTS] )
I'm trying to get the near objects for my inventory scripts.
This is the command to get the near objects
PHP код:
CMD:pick(playerid, params[])
{
new nearobj[216];
printf("get object %i", GetLastInvID());
for(new i; i < GetLastInvID(); i++)
{
new Float:x, Float:y, Float:z;
GetObjectPos(Dropped[i], x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
{
for(new j; j < GetLastInvID(); j++)
{
if(GetNearObjects(playerid, GetObjectIDFromInvID(i)))
{
format(nearobj, sizeof(nearobj), "%s\n%s", nearobj, GetObjectNameFromInvID(i));
}
}
}
}
Dialog_Show(playerid, pickitem, DIALOG_STYLE_LIST, "Near objects", nearobj, "Select", "Cancel");
return 1;
}
PHP код:
stock GetNearObjects(playerid,id)
{
new amountofnearobjects;
return amountofnearobjects;
// I need a funtion that returns the amount of objets nearby
}