Dialog before class selection
#1

This has been driving me crazy ever since I started work on my Cops 'n' Robbers script.

If you show a dialog or toggle the player spectating when they connect, they will go to class selection only when they close the dialog or if spectating is toggled off. That's all fine and dandy and I need it that way so I can show the login/register dialogs and the team dialog following that, because I use Y_Classes to show different sets of skins for Cops and Crooks.

Now, when you spectate or show a dialog before class selection, it messes up the F4 button. If you don't spectate or show a dialog and just let the player straight to class selection, F4 works fine. If you do show a dialog or spectate beforehand, when the player spawns after class selection pressing F4 doesn't show the "Returning to class selection..." message until you die and it sends you to class selection twice.

The only way around this is to kill the player on their first spawn, which is easy enough to do, but I notice a lot of servers have it working fine without killing the player and they use dialogs and spectate before class selection and they use the standard class selection and dialogs; nothing custom.

I would really like this feature to work without having to kill the player on the first spawn. Right now to hide the death, I simply move the camera away so you cant hear the death sound and if you move the player after they die, they respawn instantly, so it looks pretty much like a normal spawn but then there are extra deaths in the logs and you have to do some annoying stuff with timers and a bunch of code to get everything to work and sometimes the timers are off a bit and cause glitches during the spawn.

I was thinking it may be caused by an include I was using, possibly Y_Classes or Y_Groups, but if you take the blank script and compile it with a dialog when the player connects, it causes the glitch, so it's a SAMP issue. There are servers with it fixed and I can't find a single useful thread on fixing it. I've spent days searching for a fix and trying to fix it myself.

PLEASE help. I don't want to use custom textdraw dialogs or anything like that.
Reply
#2

TL;DR so I'll just go with the title.

Under OnPlayerRequestClass, TogglePlayerSpectating on. This will hide class selection. You can then set a dialog. When they respond to the dialog, you can toggle spectating off and they will return to class selection.

If you don't want them to return to class selection, call SpawnPlayer when OnPlayerRequestClass is called again. You may need to use SetSpawnInfo if the player didn't select a class.
Reply
#3

As respected of a developer as you are, you really aren't helpful in the least.

It's long because it includes details so that I don't get stupid answers like that. I know how to show a dialog before class selection... If you actually read even the bottom half you could've figured out that I need help with bug that is caused by dialogs before class selection that many server owners have fixed.
Reply
#4

No need to be an asshole to someone who wants to try and help you. The 'bug' isn't explained very well, but judging from most of the threads that are posted to this section, it's probably just because of bad scripting techniques.

So I don't see the issue with enabling TogglePlayerSpectate when a player connects, go through all the dialogs that you need to, then disable TogglePlayerSpectate and CALL OnPlayerRequestClass remotely. Is it really that hard to figure out yourself, if you surely know what advice is good and what isn't?

(If you're trying to bypass Class selection, then call OnPlayerSpawn rather than OnPlayerRequestClass after handling the dialogs...)
Reply
#5

Quote:

Now, when you spectate or show a dialog before class selection, it messes up the F4 button. If you don't spectate or show a dialog and just let the player straight to class selection, F4 works fine. If you do show a dialog or spectate beforehand, when the player spawns after class selection pressing F4 doesn't show the "Returning to class selection..." message until you die and it sends you to class selection twice.

the purpose of the f4 button is to send you to class selection After your next death.

as for your issue, your problem is explained very poorly explained.all i can explain to you with the current info is the order of events after the person connects.

person connects ---> OnPlayerConnect is called --> OnPlayerRequestClass is called (at this stage toogling spectating on and off toggles the class selection on and off)--> if a class is selected the player's pos and skin is set to the pos and skin you have defined in the AddPlayerClass Function.
if a class is not selected then you can manually set his info using SetSpawnInfo

AFAIK i have never heard of a bug involving dialog before class selection. so i assume that your problem is that you have poor understanding of the order in which the callbacks are called.
Reply
#6

~Sent to the wrong person :P~
Reply
#7

my reply was directed to the person who made the post not to you. and in no way im attacking those that try.

1)i never told you about your problem i told the person who started the thread, obviously he has a problem or else he wouldn't even post a topic in scripting help

2) just because you have been doing this longer than i have, that doesn't mean you know everything you may be surprised about stuff you dont know(I am not in any way trying to prove im better than you at scripting).This again was originally directed toward the person who made this thread

3) Just because i haven't heard this bug doesn't mean i suck at scripting.

4) there is no pre requisite that i have to display my login dialog in on player connect

5)i mentioned that if a person wanted to toggle the class selection on or off he would have to toggle spectating

6)and if you did read the post properly i was telling the person who posted the topic to explain his problem more clearly.
Reply
#8

Quote:
Originally Posted by admiralspeedy
Посмотреть сообщение
As respected of a developer as you are, you really aren't helpful in the least.

It's long because it includes details so that I don't get stupid answers like that. I know how to show a dialog before class selection... If you actually read even the bottom half you could've figured out that I need help with bug that is caused by dialogs before class selection that many server owners have fixed.
I didn't have time to read your entire message, and for that I am sorry. I figured the title gave enough information and assumed the post would just be you saying what you have tried etc. so I went with that. I could have said 'TL;DR' and not replied, but I thought I had a chance to help so I did. Sorry if this free community-based support forum doesn't conform to your standards.

As for the problem if it hasn't been solved already: can you not just SpawnPlayer again when they first return to class selection?
Reply
#9

Quote:
Originally Posted by AceFlyer
Посмотреть сообщение
my reply was directed to the person who made the post not to you. and in no way im attacking those that try.

1)i never told you about your problem i told the person who started the thread, obviously he has a problem or else he wouldn't even post a topic in scripting help

2) just because you have been doing this longer than i have, that doesn't mean you know everything you may be surprised about stuff you dont know(I am not in any way trying to prove im better than you at scripting).This again was originally directed toward the person who made this thread

3) Just because i haven't heard this bug doesn't mean i suck at scripting.

4) there is no pre requisite that i have to display my login dialog in on player connect

5)i mentioned that if a person wanted to toggle the class selection on or off he would have to toggle spectating

6)and if you did read the post properly i was telling the person who posted the topic to explain his problem more clearly.
LOOOOL. Your names looked the same, and I thought you were talking to me. :/
That's awkward. I was wondering what 'problem' you were talking about :l
Oh well, my bad.
Reply
#10

Figured it out myself.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)