Hi, I'm using the following code to respawn players in a metamod plugin for Counter-Strike. It works wonderfully on windows but _crashes_ my linux server when I enter the command. Here's the code... any insight on why it could be doing this? -----David "BAILOPAN" Anderson
CBaseEntity *pPlayer = UTIL_PlayerByIndex(PlayerIndex); edict_t *player player = pPlayer->edict(); CBasePlayer *cbPlayer = (CBasePlayer *)pPlayer; if (!sPlayerValid(pPlayer)) return 0; if (pPlayer->pev->deadflag == ((DEAD_DYING)||(DEAD_DEAD)||(DEAD_RESPAWNABLE))) { //Note - I used this because respawn() gave me link errors even though I included client.h cbPlayer->Spawn(); pPlayer->pev->button = 0; cbPlayer->m_iRespawnFrames = 0; pPlayer->pev->nextthink = -1; }
The answer is here...
CBaseEntity *pPlayer
...and here...
CBasePlayer *cbPlayer
Since you don't have the source code to Counter-Strike, you have NO way of knowing what CS uses for CBaseEntity or CBasePlayer. You probably assumeed that they were the same as in the SDK and that's a bad assumption. Since you can't tell what the CBaseEntity or CBasePlayer classes look like in the Counter-Strike source code, you REALLY shouldn't be calling functions or setting variables inside those classes using the pointers you've created.
The most likely cause of the crashes is stuff like...
#ifdef __linux__
int some_variable;
float some_other_variable;
#else
long some_variable_only_needed_in_win32;
#endif...which will make the size of the classes different in the Win32 version and the Linux version.
-- Jeffrey "botman" Broome
_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

