Posts: 1,495
Threads: 131
Joined: Jul 2009
Reputation:
0
Hi,
I'm wondering when "OnPlayerRequestClass" is called and when it isn't.
I'm currently facing a weird bug on one of my scripts that I can't explain.
Obviously "OnPlayerRequestClass" is called once a player connected to the server if you don't force him to spawn immediately.
What else is calling this?
What I am aware of is pressing F4 and then dieing and "ForceClassSelection".
I aint having any problems with my spawn system, although once using "ForceClassSelection" is making my player return to class selection after each "reset" (TogglePlayerSpectating or death).
Posts: 6,242
Threads: 8
Joined: Jun 2008
OnPlayerRequestClass is when you switch skins from one to another, in the skin select screen. That's when it's called. There will be other places, but you could do a SendClientMessage to show where that the callback got called.
OnPlayerRequestSpawn is called when you click spawn.
Put this under OnPlayerRequestClass, right up top.
Code:
SendClientMessage(playerid, -1, "[DEBUG] OnPlayerRequestClass called");
Posts: 1,495
Threads: 131
Joined: Jul 2009
Reputation:
0
That's not what i mean... i obviously see when im in class selection, i want to know what is calling it
Posts: 6,242
Threads: 8
Joined: Jun 2008
Quote:
Originally Posted by Sew_Sumi
OnPlayerRequestClass is when you switch skins from one to another, in the skin select screen. That's when it's called.
|
Quote:
Originally Posted by Sascha
That's not what i mean... i obviously see when im in class selection, i want to know what is calling it
|
What? When you go left and right going through the skins, that is when that callback is called...
Posts: 1,495
Threads: 131
Joined: Jul 2009
Reputation:
0
18.02.2016, 12:18
(
Last edited by Sascha; 18/02/2016 at 08:35 PM.
)
....
I do not want to know how I can know that I am in class selection, I want to know what is making a player go into class selection...
Like: ForceClassSelection and F4 are making a player go into class selection, and I do want to know what else could possible make a player go in class selection.
I do not want to detect whether a player is in class selection, I want to know what sent him into it.
Update: For whoever that might care in some time: TogglePlayerSpectating does not reset the "ForceClassSelection" - you will continue being kept into class selection once you've used TogglePlayerSpectatinv after ForceClassSelection. At least this occures on my script.
Posts: 1,831
Threads: 69
Joined: Mar 2008
Reputation:
0
@puala123: Did you register your account just to say that?
Be wary of the return value in OnPlayerRequestClass. Returning 0 can cause strange behavior.
Also, F4/ForceClassSelection will keep going into class selection until the player dies (simply spawning does not stop it from happening).
This is clearly a bug in the SA-MP server but I doubt it will ever get fixed.