Class selection buttons
#1

I am making a new login screen for my server and I'm encountering a strange issue, when I connect everything appears just fine as on the screenshot (SS #1) and the class selection buttons are hidden, but if, for example an incorrect password is entered and the dialog gets shown to the player again, the spawn buttons appear (SS #2), why's that happening and how can I prevent it? Thanks in advance.

SS #1: http://i.imgur.com/xT6gzuZ.jpg

SS #2: http://i.imgur.com/IavRPW9.jpg
Reply
#2

Can you show us your OnPlayerConnect Code?
Reply
#3

Nothing that could refer to class selection there, only bunch of RemoveBuilding codes and account existence check, couldn't be that.
Reply
#4

You might be returning 1 after dealing with the incorrect password part of the code. Try returning the Error Dialog instead.
Reply
#5

Generally that happens when dialogs are shown in OnPlayerConnect, then the user types the password and while it's processing you get into OnPlayerRequestClass and those buttons appear.

In order to avoid them you should do:
PHP код:
public OnPlayerConnect(playerid)
{
    
/* Whatever */
    
return 1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
TogglePlayerSpectating(playeridtrue);
    
/* Show dialogs here. */
    
return 1;

Then, when someone types the correct password you must use SetSpawnInfo and TogglePlayerSpectating again to let him spawn.
Reply
#6

Tried returning the error dialog instead and what RIDE2DAY said, none of them worked, the buttons still appear once I input wrong password.
Reply
#7

Not coded for samp in a long time i might be wrong, but if IIRC you need to put the player into spectate when they connect, and return 0 in OnPlayerRequestClass if they are not logged.

Код:
public OnPlayerConnect(playerid)
{
    TogglePlayerSpectating(playerid, true);	

    //show dialog	
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    if( !PlayerIsLoggedVarGoesHere )//set this var to true when they enter correct password (OnDialogResponse)
    {
        //show dialog again
	return 0;
    }
    //player is logged
    TogglePlayerSpectating(playerid, false);
    return 1;
}
Reply
#8

I used SetSpawnInfo under OnPlayerConnect, then spawned the player, set their position up in the air and froze them while on the login screen, the issue is now solved, thank you all.

UPDATE: Added you some reputation points, @DarkSkull, I'll give you one tomorrow as I gave out too much today.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)