SA-MP Forums Archive
Login bug - 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 bug (/showthread.php?tid=292035)



Login bug - SantarioLeone - 22.10.2011

Ok i think this can be an easy fix, but just not sure how to go about it, how do i make it so you have to login before clicking the "spawn" button? and if you click the spawn button it'll kick you saying you need to login before spawning? Cause right now a player can enter another players account by simply entering a wrong password to get the spawn menu, then clicking spawn. Which is a major exploit.


Re: Login bug - RoboN1X - 22.10.2011

Use OnPlayerRequestSpawn
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(login[playerid]/*change this to ur own variable*/ == 0) // 0 = not logged in and 1 = logged in
    {
        SendClientMessage(playerid,colors,message); // u must change the colors and the message
        Kick(playerid);
    }
    return 1;
}



Re: Login bug - Norn - 23.10.2011

You don't need to kick them, you can just prevent them spawning.


Re: Login bug - SantarioLeone - 23.10.2011

I know i can just remove the
pawn Код:
Kick(playerid);
But the code he gave me i dont exactly have a code that gets if the player is logged in or not
I recently added the enum pConnected but not exactly sure how to use it. cause right now my code looks like
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(login[playerid]/*change this to ur own variable*/ == 0) // 0 = not logged in and 1 = logged in
    {
        SendClientMessage(playerid,colors,message); // u must change the colors and the message
        Kick(playerid);
    }
    return 1;
}
I was thinking maybe using OnPlayerDisconnect to write something like
pawn Код:
INI_WriteInt(File,"Logged",PlayerInfo[playerid][pConnected]= 0);
And OnPlayerLogin
INI_WriteInt(File,"Logged",PlayerInfo[playerid][pConnected]= 1);

But im not sure if any of that is correct or not