Skip to content

Conversation

@NexiusTailer
Copy link
Contributor

@NexiusTailer NexiusTailer commented Nov 21, 2025

This should finally fix the issue #1008 with pretty critical behavior difference, when omp server as a workaround sets the player state to PLAYER_STATE_NONE when he leaves the spectating. As the comment says the reasons:

// When client exits spectate mode it will attempt to request a class or to spawn
// but the server still thinks the it is in it's previous state.
// This can lead to those requests being rejected.
// This state update will fix that.

it is supposed to update the player state to pass further checks inside RequestClass or RequestSpawn events, one of which will be called by player when he exits spectating.

But what we see in those places are only such checks:

PlayerState state = peer.getState();
if (state == PlayerState_Spawned || (state >= PlayerState_OnFoot && state < PlayerState_Wasted))
{
return false;
}

^ in PlayerRequestClassHandler, and:
PlayerState state = peer.getState();
if (state == PlayerState_Spawned || (state >= PlayerState_OnFoot && state < PlayerState_Wasted))
{
return false;
}

^ in PlayerRequestSpawnRPCHandler

So, if player still has PLAYER_STATE_SPECTATING, it will pass both of those checks, since spectating state is not in the range of forbidden states which are blocked to call all the mentioned events.

Meanwhile having manually update player states to random ones leads to behavior differences, and in this case it's pretty critical one since it break many protections against state change spoofing and thus falsely triggers on fair players (#325 as example). Not to say that such actions are also undocumented and doesn't match SA-MP behavior for any other scripts which aren't designed to consider similar server behavior surprises.

which is undocumented and doesn't match SA-MP behavior
@NexiusTailer
Copy link
Contributor Author

NexiusTailer commented Nov 21, 2025

Made as draft for now to test the generated build and ensure that there are no problems after these changes in practice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant