OnPlayerRequestClass
#1

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).
Reply
#2

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");
Reply
#3

That's not what i mean... i obviously see when im in class selection, i want to know what is calling it
Reply
#4

Quote:
Originally Posted by Sew_Sumi
View Post
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
View Post
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...
Reply
#5

....
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.
Reply
#6

Man, i don't know what'ha fu**ck do you mean...but maybe if you want this for a command or something.. or... really don't know..

Quote:

ForceClassSelection(playerid);

Reply
#7

Quote:
Originally Posted by puala123
View Post
Man, i don't know what'ha fu**ck do you mean...but maybe if you want this for a command or something.. or... really don't know..
If you don't know what'ha fu**ck I mean, then why do you reply with such an idiot content?

Anyway, as I mentioned above:
If you use "TogglePlayerSpectating" after "ForceClassSelection" and before dieing, the player will be set to class selection each time he dies or leaves spectating mode, at least this is happening on my script.
Only way to prevent that is not to set player into spectation mode but killing him after using ForceClassSelection

... just sharing that incase anyone will face a similar issue later.
Reply
#8

@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.
Reply
#9

Still not understand..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)