> Ok i have coded some code in player.cpp where there is a piece of code > that displays your team member name health and armor i have tried to > make it so that it also shows monster name health and so on i got it to > work as far as displaying health and armor but the name remains still > in the not working section > > newSBarState[ SBAR_ID_TARGETNAME ] = ENTINDEX( pEntity->edict() ); > > that piece of code doesent seem to work when it comes to monsters i > tried changing it to > > newSBarState[ SBAR_ID_TARGETNAME ] = pEntity->pev->targetname; > > but all it does is crash when looking at monster > > any ideas???
Wow. Okay, first, what does the 'newSBarState' array represent? It obviously is an array of integers, but why do you want to store the entity index in this array (i.e. what do you do with it later)? Second, pev->targetname is a string_t type which is an index into the engine's string table. I'm not sure why you'd want to store the string index of an entity (unless you used that later to print that string out). Third, targetname is (usually) the target of a trigger. The targetname is used to find the entity that will be triggered when a trigger is fired. I don't think any of that answered your question, but have a hard time seeing how the code you posted was supposed to be used to print the name of a player or monster. FYI, the entity name is stored in pev->classname (for things like "monster_snark", "item_healthkit", "player", etc.). The player's name is stored in pev->netname (for something like "[XYZ]MadHatter"). Both of these edict_s variables are string_t types which are indexes into the engine's string table. To return a character string from the string table index, use the STRING() macro like so... char output[256]; sprintf(output, "player's name is: %s", STRING(pPlayer->pev->netname)); Does that help? Jeffrey "botman" Broome _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

