Dialogs when the player connects.
#1

Hello everyone,

I'm having a small problem... I made my own register system. Everything works fine, until I saw this.

If I write the wrong password, it WILL show me the dialog again, but... I can use the "Spawn" and ">> <<" buttons...
How can I fix this?

Thanks.
Reply
#2

Make a variable that checks if the player logged in, then OnPlayerRequestClass return 0 if he's not logged in.

pawn Код:
// at the top
new bool: gLogged[MAX_PLAYERS] = {false, ...};

// on connect near the top
gLogged[playerid] = false;

// on disconnect
gLogged[playerid] = false;

// when they enter wrong password
gLogged[playerid] = false;

// when they successfully log in
gLogged[playerid] = true;

//On Player Request Class
if(gLogged[playerid] == false)
    return SendClientMessage(playerid, -1, "Please login first!");
or you can TogglePlayerSpectating, but not sure if that will hide the buttons.
Reply
#3

Keep in mind that returning 0 prevents the player from spawning in OnPlayerRequestSpawn.

pawn Код:
// global variable:
new
    bool: Logged_In[ MAX_PLAYERS char ]
;

// OnPlayerConnect:
Logged_In{ playerid } = false;

// When a player logins:
Logged_In{ playerid } = true;

// OnPlayerRequestSpawn
if( !Logged_In{ playerid} )
{
    SendClientMessage(playerid, -1, "Please login first!");
    return 0;
}
Reply
#4

@ -Prodigy-
It didn't work. But thank you for trying.

@ Konstantinos
This fixed half of the problem. I can't spawn if I'm not logged in anymore.
But, I can still see the skins and the buttons. And for some reason I see CJ's skin when I am not logged in, but when I am, I don't.
Reply
#5

Quote:
Originally Posted by Stinged
Посмотреть сообщение
@ Konstantinos
This fixed half of the problem. I can't spawn if I'm not logged in anymore.
But, I can still see the skins and the buttons. And for some reason I see CJ's skin when I am not logged in, but when I am, I don't.
You mentioned only the spawn problem while you're not logged in.

If you want to hide the buttons, then toggle the spectating mode on.
If you don't want to see the skins, then spawn the player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)