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
Streamer_Update and Streamer_UpdateEx not working correctly in the class selection #75
Comments
It is possible that CreatePlayerObject do not work in class selection. |
@Patrik356b Yes, it does work. CreatePlayerObject and CreateObject will both work fine without streamer. The streamer just can't get the right player position (to stream the dynamic objects to) in class selection so you need to tell it where the player is (Streamer_UpdateEx). It works perfectly fine for me though, so I'm guessing it's something to do with your script. |
But the problem is I can't imagine what could cause this. I'm just creating the objects normally and I don't do anything with them after it. |
An alternative attempt such as checking if the player is in class selection and repeatedly updating in |
It works for me as well. Something must be conflicting in your script. |
Well, probably. But I can't think of anything which could make the function don't work correctly. |
You are using, specifically, |
Yeah I am using Streamer_UpdateEx under OnPlayerRequestClass. I'll try what you said now |
So it was working with a blank script. Even with the same plugins I'm using so it has to be the my gamemode as I haven't got any filterscripts. |
Print to the server log every time your script uses one of those natives so you can see where the offending code is. |
Well like I said, I got the same result when I only got it under OnPlayerRequestClass. It also only prints when I change my class |
Your script must be calling it somewhere else as well, perhaps in an include. The only other thing I can think of is that |
Couldn't find anthing like that in my gamemode or in any include. Not sure how else I could debug my script. Maybe I could hook EVERY streamer function and print it to the console when it gets called. Could you maybe hook SetPlayerPos inside the plugin and then automatically update the player's position in the class selection to his actual position (as GetPlayerPos doesn't when changing class) so that Streamer_UpdateEx isn't needed in this case anymore ? |
I bet that you are actually using Streamer_Update somewhere in a timer, or something like that. Streamer_UpdateEx always worked for me at class request. The idea of internally using Streamer_UpdateEx at class isn't possible, unless there would be a function like "Streamer_SetClassPos( playerid, X, Y, Z );", because GetPlayerPos isn't working, so the streamer can't automatically get class's position. It is also a really bad idea, because, at least for me, Streamer_UpdateEx at OnPlayerRequestClass is lagging the client for a few milliseconds/seconds (this may be an issue ? I don't think this behaviour is normal, because streamer plugin is based on zones and shouldn't lag). So I only use Streamer_UpdateEx when the player enters first time in request class, and with a timer of ~100-200milliseconds, so it wouldn't hang the rendering (if I use without timer CJ skin will be shown instead of the normal one). You have to check your script (includes, filterscripts), we can't help you at all. The Streamer Plugin is working fine, the objects are shown normally with that function. |
I've already checked ALL of my filterscripts, includes and my gamemode. So there has to be an other problem in my script not related to one of the streamer's natives. And I don't think you get what I mean. It would also help other players which don't have the same problem like me. Cause much players which haven't used the streamer before probably don't know that they have to use Streamer_UpdateEx to get the objects appearing in the class selection. |
Aw, my bad. It is possible, yes, but I don't think it should be implemented in streamer, it should stay at our decision what we want to do, maybe someone wants the request class to be somewhere, but without showing the objects which are there, there can be many ideas only with that thing. Yes, many owners don't know that they should use Streamer_UpdateEx (personally I told a few owners to use it, because they didn't understand why the objects aren't there) at request class, it should be documented somewhere (still, many don't read the documentation, but they should, so this is no longer our problem). It is alright how it is now, there is a problem with your code and you have to find it. But still, the remaining issue is that it lags a bit when used. I have over 100.000 objects, but the checking is made for that zone and the ones next to it, so it shouldn't lag. |
it could be implemented in streamer, while it might not know where player is, the streamer could check if it's class selection and use the player's camera position as streaming point. |
@JernejL if that was the case, there is a function that toggles between player position and camera position already. I don't think it works in class selection. |
Crayder: It should work with that switch then. Camera vector + position updates are sent in a totally separate updates from car / foot movement updates and iirc they are sent in class selection aswell. |
Related to discussion in #75.
@JernejL I just tried it and getting the camera pos gives the same result as getting the player's pos in the class selection. It just gives the last position of the player's camera before he went into the class selection. |
That has been a known bug for years. If the camera position functions and class selection callbacks were hooked it could be done with less precision. Like I said, "I don't think it works in class selection." |
Streamer_UpdateEx seems like a better option than hooking that just for class selection tho.. |
@JernejL Yeah, that has always worked for me. But apparently that doesn't work for him. |
Yep. I've searched the whole script for every streamer native. The only ones I am using are: |
I've had this problem for a week and have been doing some investigating. Do you happen to hide class selection at all (using TogglePlayerSpectating)? And then showing it again using ForceClassSelection? For me, this seems to be what breaks it. ForceClassSelection. |
|
But it does matter. I made a test gamemode, and when I run it normally (not disabling class selection), the objects stream fine, but when I TogglePlayerSpectating true then ForceClassSelection then TogglePlayerSpectating false, the objects do not stream, even with Streamer_UpdateEx. They stream for one 'cycle', then disappear again. |
That could be the problem as I'm hiding the class selection once when the player connects so that the login screen doesn't get messed up by the class selection. edit It really works when I'm not using ForceClassSelection but now I gotta find another way to put the player into the class selection without getting this bug again. Thanks mate! edit2 Killing the player seems to do the job but dying after the the login would probably confuse players and isn't a good solution. |
Found a solution! Simply disable normal object updates when class selection starts (OnPlayerRequestClass) with: Streamer_ToggleItemUpdate(playerid, STREAMER_TYPE_OBJECT, false); Then force updates yourself using Streamer_UpdateEx (NOTE: YOU MUST SPECIFY .type = STREAMER_TYPE_OBJECT.). You also cannot use GetPlayerPos or GetPlayerCameraPos. You must specify the coordinates yourself. Then re-enable object updates under OnPlayerSpawn with: Streamer_ToggleItemUpdate(playerid, STREAMER_TYPE_OBJECT, true); EDIT: Another thing I have discovered. If you leave class selection alone to run normally, GetPlayerState returns 0 (PLAYER_STATE_NONE), but if you TogglePlayerSpectating true to hide csel, then force them back and toggle spectating on, GetPlayerState returns 9 (PLAYER_STATE_SPECTATING). I assume the streamer starts using the camera position in this state or something? It should be easy to keep track of whether a player is in csel or not using OnPlayerRequestClass and OnPlayerSpawn, right? I know this is a SA-MP bug but it should be able to be worked around. |
Thank you so much, it worked! |
I see. |
I've got this problem for over a year now. I can do what ever I want but my objects (CreateDynamicObject) won't show up in the class selection except when I enter the class selection when the objects are already streamed in. Normal objects (CreateObject) are fine.
The objects will only show up for like half a second and then they will dissappear again.
I'm not doing anything special, just creating the objects. I also didn't modify the streamer in any way.
The text was updated successfully, but these errors were encountered: