26.02.2017, 09:45
I've heard that mine IsPlayerSpawned isn't accurate at some situations.
I've rewritten it, does it good? If anybody has better, please post it. Thanks.
I've rewritten it, does it good? If anybody has better, please post it. Thanks.
pawn Код:
// native IsPlayerSpawned(playerid);
AMX_DECLARE_NATIVE(Natives::IsPlayerSpawned)
{
CHECK_PARAMS(1, "IsPlayerSpawned", LOADED);
const int playerid = CScriptParams::Get()->ReadInt();
if(!IsPlayerConnected(playerid)) return 0;
BYTE state = pNetGame->pPlayerPool->pPlayer[playerid]->byteState;
switch (state)
{
case PLAYER_STATE_ONFOOT:
case PLAYER_STATE_DRIVER:
case PLAYER_STATE_PASSENGER:
case PLAYER_STATE_SPAWNED:
{
return true;
}
}
return false;
}