User confirmation
#1

Hello, I have a problem with the user identification when it connects, the problem is that a user registers normal, example, with the name "Samp", then the player leaves and another user enters with the name "samp", then the server recognizes it as the previous user, by this I mean that it does not detect minuscule and capital letters in the name. And then the "samp" player inherits all the data of the "Samp" player

Another example: Name: Samp (admin), "Samp" leaves the server and another user enters with the name "Samp." (It has a point at the end), The server does not ask password to that user and automatically passes the login and gives all the data of the other player (the admin)

I use SQLite.

PHP Code:
//OnPlayerConnect
new DBResult:ResultDB_Query[140];
format(DB_Querysizeof(DB_Query), "SELECT `p_pass`, `p_salt` FROM `players` WHERE `p_name` = '%q'"pInfo[playerid][NAME]);
Result db_query(b_dbDB_Query);
if(
db_num_rows(Result)) //registered user
{
    
db_get_field_assoc(Result"PASS"pInfo[playerid][PASS], 64 1);
    
db_get_field_assoc(Result"SALT"pInfo[playerid][SALT], 16);
    
pInfo[playerid][p_Registered] = true//confirms that the player is registered
    
ShowPlayerDialog(playeriddialog_loginDIALOG_STYLE_INPUT,"LOGIN","enter your password.""login""exit");
}
else 
//Unregistered user
{
    
SendClientMessage(playerid, -1"{FFFFFF}Welcome to server");
}
db_free_result(Result); 
Reply
#2

Are you sure 'pInfo[playerid][NAME]' holds the right value? Where do you get the player's name?

Perhaps it holds the name of the previous player.
Reply
#3

I already solved this problem, but now I have something similar with the command "/ admins", and in order not to create another topic, I am still here.

The error is that if an administrator is called "Samp", it appears in the list of administrators as "connected", but when the administrator "Samp" leaves the server and another player enters with the name "samp", in the list of " / administrators "connected and disconnected, will mark the administrator" Samp "as if it were connected. By this I mean that if the name of a player looks like an administrator, for example: "Samp" (it's admin) and "samp" (it's a player), and the administrator disconnects and the player connects to the server, the "/ admins" list will continue to mark it as connected because their names are similar.

Any solution? I hope I have explained well.

command:

PHP Code:
CMD:admins(playeridparams[])
{    
    
pInfo[playerid][pADMIN_LIST_DIALOG] = 0;
    new 
str[90], string[1800];
    
format(stringsizeof string"");
    
strcat(string"Name\tRank\tStatus\n");
    new 
DBResult:ResultDB_Query[128], lines;
    
format(DB_Querysizeof(DB_Query), "SELECT p_name, p_admin_level FROM players WHERE p_admin_level > '0' ORDER BY p_admin_level * 1 DESC LIMIT 19 OFFSET %d"pInfo[playerid][pADMIN_LIST_DIALOG] * 19);
    
Result db_query(basedbDB_Query);
    new 
player_name[24], connect;
    for(new 
idb_num_rows(Result); i++)
    {
        
db_get_field(Result0player_name24);
        
sscanf(player_name"u"connect);
        
        
format(strsizeof str"%s\t%s\t%s\n"player_nameAdmin_Name_Rankdb_get_field_int(Result1) ), (connect != INVALID_PLAYER_ID ? ("{00FF00}connected"):("{FF0000}disconnected")));
        
strcat(stringstr);
        
lines ++;
        
db_next_row(Result);
    }
    
db_free_result(Result);
    
strcat(string"Back");
    
pInfo[playerid][pADMIN_DIALOG_BACK] = lines;
    
ShowPlayerDialog(playeriddialogadminsDIALOG_STYLE_TABLIST_HEADERS"Admins"string"next""close");
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)