SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/12/2018, 08:09 PM   #1
SapMan
Banned
 
Join Date: Jul 2017
Posts: 140
Reputation: 12
Default User confirmation

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); 
SapMan is offline   Reply With Quote
Old 25/12/2018, 04:14 PM   #2
Threshold
High-roller
 
Threshold's Avatar
 
Join Date: Nov 2012
Location: Australia
Posts: 3,122
Reputation: 529
Default Re: User confirmation

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.
__________________


Kar's Cops and Robbers 2020
Threshold is offline   Reply With Quote
Old 25/12/2018, 04:43 PM   #3
SapMan
Banned
 
Join Date: Jul 2017
Posts: 140
Reputation: 12
Default Re: User confirmation

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;

SapMan is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password Confirmation eikzdej Scripting Help 2 23/03/2016 09:40 AM
[Include] Confirmation Dialog Mmartin Includes 13 12/03/2015 08:35 PM
How to make a password confirmation? Xtreme Brotherz Scripting Help 7 09/05/2014 03:09 PM
Confirmation email. ZeQualX Scripting Help 1 07/02/2014 04:14 AM
Bug Confirmation - Spawn Info Proteus Help Archive 7 05/05/2010 01:57 PM


All times are GMT. The time now is 07:37 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.