Quote:
Originally Posted by KWo
I cannot remove the Illumination entity (that one based on mechgibs.mdl) because there might be still other bots on the server (like CZERO bots other podbot clone and so on) and their light_level still would be 0.
Or maybe there is a way to run Your function for all users/bots from my dll?
|
Of course you can do it!
Way 1, inaccurate:
Code:
///........................
// Record some Stats of all Players on the Server
g_iNum_players = 0;
g_iNum_humans = 0;
g_iNum_hum_tm = 0; // KWo - 08.03.2010
bAliveHumans = false;
g_iAliveCTs = 0; // KWo - 19.01.2008
g_iAliveTs = 0; // KWo - 19.01.2008
for (player_index = 0; player_index < gpGlobals->maxClients; player_index++)
{
pPlayer = INDEXENT (player_index + 1);
if (!FNullEnt (pPlayer) && (pPlayer->v.flags & FL_CLIENT))
{
g_iNum_players++;
clients[player_index].pEdict = pPlayer;
clients[player_index].iFlags |= CLIENT_USED;
IsAlive (pPlayer) ? clients[player_index].iFlags |= CLIENT_ALIVE : clients[player_index].iFlags &= ~CLIENT_ALIVE;
//////////// BEGINNING OF NEW CODE \\\\\\\\\\\\\\\\\\\\\\\\
if ((pPlayer->v.flags & FL_FAKECLIENT) && (clients[player_index].iFlags & CLIENT_ALIVE))
pPlayer->v.light_level = Light::R_LightPoint (pPlayer->v.origin);
//////////// END OF NEW CODE \\\\\\\\\\\\\\\\\\\\\\\\
if ((clients[player_index].iTeam == TEAM_CS_TERRORIST) && (clients[player_index].iFlags & CLIENT_ALIVE)) // KWo - 19.01.2008
g_iAliveTs++;
if ((clients[player_index].iTeam == TEAM_CS_COUNTER) && (clients[player_index].iFlags & CLIENT_ALIVE)) // KWo - 19.01.2008
g_iAliveCTs++;
/// ...................................
Or a way 2, more correct:
Code:
static void RunPlayerMove_Post (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec)
{
if (IsAlive (fakeclient))
fakeclient->v.light_level = Light::R_LightPoint (fakeclient->v.origin);
RETURN_META (MRES_IGNORED);
}
C_DLLEXPORT int GetEngineFunctions_Post (enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion)
{
// ....
meta_engfuncs_post.pfnRunPlayerMove = RunPlayerMove_Post;
// ....
}
But of course for both methods you need to remove code, which you have added earlier from my previous post.
BTW.
Taken from Source SDK interface.cpp:
Code:
#ifdef _LINUX
// Linux doesn't have this function so this emulates its functionality
void *GetModuleHandle(const char *name)
{
void *handle;
if( name == NULL )
{
// hmm, how can this be handled under linux....
// is it even needed?
return NULL;
}
if( (handle=dlopen(name, RTLD_NOW))==NULL)
{
// couldn't open this file
return NULL;
}
// read "man dlopen" for details
// in short dlopen() inc a ref count
// so dec the ref count by performing the close
dlclose(handle);
return handle;
}
#endif