Login bug
#1

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.
Reply
#2

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;
}
Reply
#3

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)