openmultiplayer / openmultiplayer/open.mp

IsPlayerConnected return 'true' before OnPlayerConnect (in OnIncomingConnection)

Open
#944 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
641
Forks
208
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
Compat with original SA:MP problem.
native IsPlayerConnected return 'true' before OnPlayerConnect (in OnIncomingConnection state).
In original SA:MP IsPlayerConnected return true on OnPlayerConnect stage, not OnIncomingConnection.

To Reproduce
Steps to reproduce the behavior:
Put to OnIncomingConnection callback:

printf("IsPlayerConnected(%d): %s", playerid, IsPlayerConnected(playerid) ? "Yes" : "No");

Expected behavior
IsPlayerConnected return true on OnPlayerConnect stage.

Screenshots and/or logs
Original SA:MP:
[28/07/2024 05:03:24] IsPlayerConnected(1): No

OPEN.MP:
[28/07/2024 04:53:43] [Info] IsPlayerConnected(0): Yes

Release version
Starting open.mp server (1.2.0.2670) from commit 41ebf182bf73dc9cb11841bfe6b0179ba31f9dd5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the connection lifecycle around the OnIncomingConnection and OnPlayerConnect callbacks, then inspect the implementation of IsPlayerConnected. Reproduce the logged behavior and confirm that the native reports the expected state at each callback stage.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.