Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetPlayerInterior #166

Open
r4sheed opened this issue Jan 22, 2022 · 5 comments
Open

GetPlayerInterior #166

r4sheed opened this issue Jan 22, 2022 · 5 comments

Comments

@r4sheed
Copy link

r4sheed commented Jan 22, 2022

GetPlayerInterior returns 0 when a script is reloaded, even if a player is inside an interior

You can see this on the video:
https://streamable.com/8ax9gj

@Y-Less
Copy link
Member

Y-Less commented Jan 24, 2022

By "script" I assume you mean filterscript here? Their interior will be reset to 0 if the script is a gamemode.

@r4sheed
Copy link
Author

r4sheed commented Jan 25, 2022

By "script" I assume you mean filterscript here? Their interior will be reset to 0 if the script is a gamemode.

The server run with a bare game mode which is included with the SA-MP server files and I’m used this filterscript with fixes.inc on this video. So yeah, it’s a filterscript.

@Y-Less
Copy link
Member

Y-Less commented Aug 25, 2023

OK, am I right that you're running a gamemode without fixes.inc, going in to an interior, then loading the FS with it on. If so, that's quite a tricky thing to solve and will probably affect quite a few fixes. The code is written somewhat assuming that it is always running and knows the current state of the server at all times. Many things are initialised when fixes.inc is first started (it does try to account for reloads, but only if it was there earlier) because some of the bugs are that some data is not correctly initialised, so relying on that to begin with defeats the object.

Does it work correctly if you have fixes.inc in the gamemode?

@Y-Less
Copy link
Member

Y-Less commented Aug 25, 2023

As an example - take checkpoints. IsPlayerInCheckpoint is not correctly set when the server starts, so may return true before they've entered one. Thus fixes.inc sets a variable to false and monitors OnPlayerEnterCheckpoint, assuming that the initialisation is done before any player has a chance to enter a checkpoint. However, if you start a mode without fixes.inc, allow a player to enter a checkpoint, then load fixes.inc this initialisation will be wrong. Obviously we can't change fixes.inc to call IsPlayerInCheckpoint when it first starts, because that was the problem we were trying to solve in the first place.

I don't know of a solution to this, it might be impossible without loading the include earlier.

@r4sheed
Copy link
Author

r4sheed commented Aug 26, 2023

I'm using open.mp now and I did not tested this again since I've created this issue. But I've noticed fixes.inc sets the player interior variable to 0 under OnPlayerConnect which is a problem. You should use GetPlayerInterior instead and it will work perfectly.

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

No branches or pull requests

2 participants