SA-MP Forums Archive
Login before playing? - 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: Login before playing? (/showthread.php?tid=475303)



Login before playing? - Lynet - 12.11.2013

Hello guys, I been wondering how I can create that? I had that with my old fs Ladmin, but i'm currently creating my own GM with my own admin system.

Here's my enum

Код HTML:
enum PlayerInfo
{
   Logged,
   Level,
   Duty,
   pGD,
   pTS,
   pVip,
   pCop,
}



Re: Login before playing? - StuartD - 12.11.2013

Try something like:

OnPlayerConnect - PlayerInfo[playerid][Logged] = 0;

Login Stuff - PlayerInfo[playerid][Logged]= 1;

OnPlayerDisconnect - PlayerInfo[playerid][Logged] = 0;

Something along those lines, then you can use if(PlayerInfo[playerid][Logged]== 0) << Not logged in
then
if(PlayerInfo[playerid][Logged] == 1) << Is loggedin.

Something like that


Re: Login before playing? - Beckett - 12.11.2013

What do you exactly want? like if the player's not logged in he can't spawn? or what?


Re: Login before playing? - Lynet - 12.11.2013

Yeah exactly, no spawn before he's logged in, fix it for me and ill +1 on u.


Re: Login before playing? - dominik523 - 12.11.2013

you can add player spawning after a dialog where player has logged in, or if you are using Spawn button like this:
Код:
public OnPlayerRequestSpawn(playerid)
{
    if(!pLogged[playerid]) // your variable for logged players
    {
        SendClientMessage(playerid,COLOR_GREEN,"You are not logged.");
        return 0;
    }
    else
   {
        //SetPlayerPos... and the rest
   }
    return 1;
}



Re: Login before playing? - Lynet - 12.11.2013

Testing it out right now, if it works, ill rep you.


Re: Login before playing? - Lynet - 12.11.2013

@Dominik123,

It works, thanks!