.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Enhancement Workshop > Metamod and metamod plugins
Metamod and metamod plugins Plugins and improvements for the metamod server-side mod

Reply
 
Thread Tools
Getting edict from name
Old
  (#1)
two_masks
Guest
 
Status:
Posts: n/a
Default Getting edict from name - 14-04-2004

I'd like to be able to get the edict of a client when they send a radio message, but all I have access to is the name of the sending client. Is there a command in the SDK that will let me do this?
FIND_ENTITY_BY_STRING

sounds like it would do the trick, but I don't know where to find a listing of available fieldnames... can anyone fill me in?

Thanks again- this forum has been a great help!

-JB
  
Reply With Quote
Re: Getting edict from name
Old
  (#2)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Getting edict from name - 14-04-2004

There is no facility available in the SDK that will do what you want that I know of. However, you can simply find the edict_t of a particular client given his name, if you cycle through all of them and compare their netname with the supplied one.

Code:
int iClientIndex;
edict_t *pClient;
 
pClient = NULL; // initialize
 
// cycle through all clients...
for (iClientIndex = 1; iClientIndex < gpGlobals->maxClients; iClientIndex++)
{
   pClient = INDEXENT (iClientIndex);
 
   if (FNullEnt (pClient))
	  continue; // discard invalid client slots
 
   if (strcmp ("two_masks", STRING (pClient->v.netname)) == 0)
	  break; // it's this client !
}
 
// have we finally found a client ?
if (!FNullEnt (pClient))
{
   DoSomeStuffWithClient (pClient);
   DoSomeOtherStuffWithClient (pClient);
   SlapClientAroundABit (pClient);
   MakeClientJumpUpAndDown (pClient);
   ClientWriteALoveLetterToYourMomma (pClient);
   // etc...
}



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 14-04-2004 at 11:14..
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com