Topic: [Modding] Segfault on Team change
So far I've only changed the mod.h and mod.cpp files and I have a problem with the following code:
int CGameControllerMOD::OnCharacterDeath(class CCharacter *pVictim, class CPlayer *pKiller, int Weapon)
{
pVictim->GetPlayer()->SetTeam(TEAM_SPECTATORS, true);
IGameController::OnCharacterDeath(pVictim,pKiller,Weapon);
return 0;
}
Now, when someone dies the client gives a "too weak connection (out of buffer)" error message and the server repeats
[56eb3b0b][server]: client dropped. cid=0 addr=unknown type 0 reason='Error sending data'
[56eb3b0b][chat]: *** 'Ace' joined the spectators
[56eb3b0b][server]: client dropped. cid=0 addr=unknown type 0 reason='Error sending data'
[56eb3b0b][chat]: *** 'Ace' joined the spectators
Over and over until there is a segmentation fault.
It's the first line of the function, without it it runs fine.
The same error occurs when I put the line after
IGameController::OnCharacterDeath(pVictim,pKiller,Weapon);
so I don't think I change the address of the character in SetTeam(), do I?