[Tutorial] Make Your Login System More Secure
#1

Removed
Reply
#2

You are not ready to write any sort of documentation yet.
Reply
#3

If they haven't logged in, why not just prevent spawning instead of kicking them?
pawn Code:
public OnPlayerRequestSpawn(playerid)
{
    if(AccInfo[playerid][PassType] == 0)
    {
        return 0;
    }
    return 1;
}
As for changing the password without logging in, why not just deny the command from being used instead of kicking them.
pawn Code:
CMD:changepass(playerid,params[])
{
    if(AccInfo[playerid][Logged] == 0)
    {
        SendClientMessage(playerid, Red, "Login First Bruh ");
        return 1;
    }
    else
    {
        new pass[128];
        if(sscanf(params, "s[128]", pass))
        {
            SendClientMessage(playerid,Red,"USAGE: /changepass <new pass>");
            return 1;
        }
        if(strlen(pass) < 3 || strlen(pass) > 32)
        {
            SendClientMessage(playerid,Red,"SERVER: Incorrect password length.");
            return 1;
        }
        new string[128];
        UpdatePlayerPass(playerid, pass);
        PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
        format(string, sizeof(string),"SERVER: You have successfully changed your password to \"%s\"",pass);
        SendClientMessage(playerid,Yellow,string);
    }
    return 1;
}
As for a bot that connects:
pawn Code:
public OnPlayerConnect(playerid)
{
    new ipaddr[16];
    GetPlayerIp(playerid, ipaddr, 16);
   
    if(IsPlayerNPC(playerid) && strcmp(ipaddr, "127.0.0.1",true)){
   
        Kick(playerid);
        return 0;
    }
   
    return 1;
}
People hate being kicked from servers. lol
Reply
#4

Quote:
Originally Posted by Banana_Ghost
View Post
If they haven't logged in, why not just prevent spawning instead of kicking them?
pawn Code:
public OnPlayerRequestSpawn(playerid)
{
    if(AccInfo[playerid][PassType] == 0)
    {
        return 0;
    }
    return 1;
}
As for changing the password without logging in, why not just deny the command from being used instead of kicking them.
pawn Code:
CMD:changepass(playerid,params[])
{
    if(AccInfo[playerid][Logged] == 0)
    {
        SendClientMessage(playerid, Red, "Login First Bruh ");
        return 1;
    }
    else
    {
        new pass[128];
        if(sscanf(params, "s[128]", pass))
        {
            SendClientMessage(playerid,Red,"USAGE: /changepass <new pass>");
            return 1;
        }
        if(strlen(pass) < 3 || strlen(pass) > 32)
        {
            SendClientMessage(playerid,Red,"SERVER: Incorrect password length.");
            return 1;
        }
        new string[128];
        UpdatePlayerPass(playerid, pass);
        PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
        format(string, sizeof(string),"SERVER: You have successfully changed your password to \"%s\"",pass);
        SendClientMessage(playerid,Yellow,string);
    }
    return 1;
}
As for a bot that connects:
pawn Code:
public OnPlayerConnect(playerid)
{
    new ipaddr[16];
    GetPlayerIp(playerid, ipaddr, 16);
   
    if(IsPlayerNPC(playerid) && strcmp(ipaddr, "127.0.0.1",true)){
   
        Kick(playerid);
        return 0;
    }
   
    return 1;
}
People hate being kicked from servers. lol
lol did you know raksamp?
Reply
#5

deleted
Reply
#6

deleted
Reply
#7

Quote:
Originally Posted by dh240473
View Post
lol did you know raksamp?
I thought checking the client version kept that from occuring?
Reply
#8

Quote:
Originally Posted by Banana_Ghost
View Post
I thought checking the client version kept that from occuring?
Raksamp spoofs it as a client.
An 20 second timer to login is very bad and will piss off whoever is being kicked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)