A quick search for GetPlayerForUserID shows that it is in the client code
and part of the IVEngineClient class. You can't use client-side code on the
server.
I use something like this:
// return player edict for a userid
edict_t *DBUtils::EdictOfUserId( int UserId )
{
int i;
edict_t *pEnt;
for (i=0; i<MAX_CLIENTS; i++)
{
pEnt = m_Engine->PEntityOfEntIndex(i);
if (pEnt && !pEnt->IsFree())
{
if (FStrEq(pEnt->GetClassName(), "player"))
{
if (m_Engine->GetPlayerUserId(pEnt)==UserId)
{
return pEnt;
}
}
}
}
return NULL;
}
On Sun, Apr 27, 2008 at 1:47 AM, Mark Chandler <[EMAIL PROTECTED]> wrote:
> Hey all,
>
> Im getting a server crash when im trying to use
> engine->GetPlayerForUserID(userId) for a tf2 server plugin. The error it
> crashes with is "NUM_FOR_EDICT: bad pointer". I think this might be a
> valve
> bug but I really need to convert userId (from events) into the edict index
> (to use with some other engine functions). Any help will be appreciated.
>
> Mark
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders