SA-MP Forums Archive
Dialogs when the player connects. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialogs when the player connects. (/showthread.php?tid=475179)



Dialogs when the player connects. - Stinged - 11.11.2013

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.


Re: Dialogs when the player connects. - -Prodigy- - 11.11.2013

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.


Re: Dialogs when the player connects. - Konstantinos - 11.11.2013

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;
}



Re: Dialogs when the player connects. - Stinged - 11.11.2013

@ -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.


Re: Dialogs when the player connects. - Konstantinos - 11.11.2013

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.