Page 1 of 1

X,Y,Z in /items (please CVS)

Posted: Wed Nov 05, 2003 10:49 am
by HanzO
Hi guys, just my little contribution... Really helps out when ground spawns are inside trees, so that /items * kicks back x,y,z so you don't go hunt down that item again.

On that note, I'll post a req for development regarding /itemtarget as well in another post...

PCHAR GetFriendlyNameForGroundItem(PGROUNDITEM pItem)
{
CHAR szName[MAX_STRING] = {0};
PITEMDB ItemDB=gItemDB;
DWORD Item = atoi(pItem->Name + 2);
while ((ItemDB) && (pItem->ID != ItemDB->ID)) {
ItemDB = ItemDB->pNext;
}
if (ItemDB) {
strcpy(szName,ItemDB->szName);
} else if ((Item>=400) && (Item<=MAX_ITEM4xx) && (szItemName4xx[Item-400])) {
sprintf(szName,"%s%d (%3.2f, %3.2f, %3.2f)",szItemName4xx[Item-400],pItem->ID,pItem->Y,pItem->X,pItem->Z);
// Regular
} else if ((Item<=255) && (szItemName[Item])) {
strcpy(szName,szItemName[Item]);
// Unknown
} else {
sprintf(szName,"Drop%04d/%d",Item,pItem->ID);
}
return strdup(szName);
}

Posted: Wed Nov 05, 2003 12:20 pm
by MacroFiend
Possibly a better way to do this so all ground spawn items get the loc attached.

Code: Select all

    CHAR szName[MAX_STRING] = {0};[color=red]
    CHAR szLoc[MAX_STRING] = {0};[/color]
    PITEMDB ItemDB=gItemDB;

Code: Select all

    }[color=red]
   sprintf(szLoc," (%3.2f, %3.2f, %3.2f)",pItem->Y,pItem->X,pItem->Z);
   strcat(szName,szLoc);[/color]
   return strdup(szName);
}