17.05.2018, 17:16
It's a good idea but you should really hook OnPlayerDisconnect() and do your clean up work automatically.
A definite problem area is in this function.
A definite problem area is in this function.
Код:
stock DeathSequenceInitial(playerid) { DeathSeq[playerid][isdead] = true; DeathSeq[playerid][skinid] = GetPlayerSkin(playerid); GetPlayerPos(playerid, DeathSeq[playerid][deadpos][0], DeathSeq[playerid][deadpos][1], DeathSeq[playerid][deadpos][2]); GetPlayerFacingAngle(playerid, DeathSeq[playerid][deadpos][3]); // Potential problem here - How do you know this function is not called again before the player actually spawns? // Don't use this function without actually spawning the player immediately afterwards as a rule of thumb // Especially in an include SetSpawnInfo(playerid, NO_TEAM, DeathSeq[playerid][skinid], DeathSeq[playerid][deadpos][0], DeathSeq[playerid][deadpos][1], DeathSeq[playerid][deadpos][2], DeathSeq[playerid][deadpos][3], 0, 0, 0, 0, 0, 0 ); TogglePlayerSpectating(playerid, true); TogglePlayerSpectating(playerid, false); // Might cause problems with AC's / Auto health reset etc SetPlayerHealth(playerid, 9999); return 1; }