Raised This Month: $ Target: $400
 0% 

Change Case Sensitivity on Register System


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tepegoz
Senior Member
Join Date: Apr 2019
Old 01-07-2020 , 09:00   Change Case Sensitivity on Register System
Reply With Quote #1

In sma, there is register system but the system using case sensitivity. I want to remove case sensitivity.
Example if registered player's name is Player1 , system allows player1, PlaYeR1 etc.
PHP Code:
public client_putinserver(id) {

    if(
is_kickball
    {
    
//    Pro_Active[id] = 0        // version 5.06
        
        
VerificarUser(id)
    
        
soy_spec[id] = false
        IsConnected
[id] = true;
            
        new 
MapName[64]
        
set_task(20.0,"soccerjamHelp",id)
        
        if(
get_pcvar_num(CVAR_RESEXP))
            
set_task(10.0,"VerificarExist",id)
        else
            
set_task(10.0,"LateJoinExp",id)
        
    
        
get_mapname(MapName,63)
        if(
equali(MapName,"sj_indoorx_small"))             
            
set_task(2.0,"areas_indoorx",id)
            
        if(
equali(MapName,"sj_pro"))             
            
set_task(2.0,"areas_pro",id)
            
        if(
equali(MapName,"sj_pro_small"))             
            
set_task(2.0,"areas_pro_small",id)
            
        if(
equali(MapName,"soccerjam")) 
            
set_task(2.0,"areas_soccerjam",id)
            
        new 
flags get_user_flags(id)         
        if(
flags&ADMIN_KICK)
            
client_cmd(id"bind / amx_sjmenu")
            
    }
}

VerificarAccess(idname[], password[])
{
    new 
playername[MAX_PLAYER 1];

    if(
name[0])
    {
        
copy(playername31name)
    }
    else
    {
        
get_user_name(idplayername31)
    }

    new 
result 0
    
    rankVault 
nvault_open(VAULTNAMERANK);
    
topVault nvault_open(VAULTNAMETOP);
    
    new 
vaultkey[64], vaultdata[64], timestamp;

    new 
rank_pw[MAX_PLAYER 1],rank_points[MAX_PLAYER 1], rank_goles[MAX_PLAYER 1], rank_robos[MAX_PLAYER 1], rank_asis[MAX_PLAYER 1], rank_encontra[MAX_PLAYER 1], rank_disarm[MAX_PLAYER 1], rank_kill[MAX_PLAYER 1], rank_tekill[MAX_PLAYER 1], rank_terobos[MAX_PLAYER 1], rank_tedisarm[MAX_PLAYER 1], rank_rank[MAX_PLAYER 1];
    
format(vaultkey63"^"%s^""playername);
    if(
nvault_lookup(rankVaultvaultkeyvaultdata1500timestamp))
    {
        
parse(vaultdatarank_pwMAX_PLAYERrank_pointsMAX_PLAYERrank_golesMAX_PLAYERrank_robosMAX_PLAYERrank_asisMAX_PLAYERrank_encontraMAX_PLAYERrank_disarmMAX_PLAYERrank_killMAX_PLAYERrank_tekillMAX_PLAYERrank_terobosMAX_PLAYERrank_tedisarmMAX_PLAYERrank_rankMAX_PLAYER);
        if(
equali(rank_pwpassword))
        {    
            
Pro_Point[id] = str_to_num(rank_points);
            
Pro_Goal[id] = str_to_num(rank_goles);
            
Pro_Steal[id] = str_to_num(rank_robos);
            
Pro_Asis[id] = str_to_num(rank_asis);    
            
Pro_Contra[id] = str_to_num(rank_encontra);
            
Pro_Disarm[id] = str_to_num(rank_disarm);
            
Pro_Kill[id] = str_to_num(rank_kill);
            
Pro_teKill[id] = str_to_num(rank_tekill);
            
Pro_teSteal[id] = str_to_num(rank_terobos);
            
Pro_teDisarm[id] = str_to_num(rank_tedisarm);    
            
Pro_Rank[id] = str_to_num(rank_rank);
            
            
result 1
        
}
        else
            
result 2
    
}
    else
        
result 3

    
    nvault_close
(rankVault);
    
nvault_close(topVault);
    
    return 
result
}
    

VerificarUser(idname[] = "")
{
    new 
password[32], passfield[32], username[32]
    
    if (
name[0])
    {
        
copy(username31name)
    }
    else
    {
        
get_user_name(idusername31)
    }
    
    
get_pcvar_string(sj_password_fieldpassfield31)
    
get_user_info(idpassfieldpassword31)
    new 
result VerificarAccess(idusernamepassword)
    
    if (
result == 1)
    {
        
UserPassword[id] = true;
        
client_cmd(id"echo ^"You have been logged correctly^"")
    }
    
    if (
result == 2)
    {
        
UserPassword[id] = true;
        
ClearTask(id)
        
client_cmd(id"echo ^"Incorrect password^"")
    }
    
    if (
result == 3)
    {
        
UserPassword[id] = false;
        
ClearTask(id)
        
client_cmd(id"echo ^"You must create an account to be in the ranktype /help for more info^"")
    }
    
    return 
PLUGIN_CONTINUE    

Attached Files
File Type: sma Get Plugin or Get Source (se.sma - 218 views - 247.9 KB)

Last edited by tepegoz; 01-08-2020 at 06:41.
tepegoz is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-07-2020 , 14:33   Re: Change Case Sensitivity on Register System
Reply With Quote #2

You want to remove case sensitivity or INsensitivity? What you explained in line 2 is insensitivity and I didn't see such a thing in the code via a quick search for the "strtolower" function.
__________________

Last edited by OciXCrom; 01-07-2020 at 14:33.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
tepegoz
Senior Member
Join Date: Apr 2019
Old 01-07-2020 , 14:42   Re: Change Case Sensitivity on Register System
Reply With Quote #3

I don't know case sensitivity or insensitivity.
In this sma, if registered player's name is Player1: system not allows player1, PlaYeR1, PLAYERS1 ... etc. (these names are not registered.)
I just want if registered player's name is Player1 , system allows player1, PlaYeR1, PLAYERS1 ... etc.

Last edited by tepegoz; 01-07-2020 at 14:42.
tepegoz is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-07-2020 , 14:50   Re: Change Case Sensitivity on Register System
Reply With Quote #4

That's not what you said in the first post. Simply add strtolower(x) after each get_user_name(id, x, 31).
__________________

Last edited by OciXCrom; 01-07-2020 at 14:50.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
tepegoz
Senior Member
Join Date: Apr 2019
Old 01-07-2020 , 16:10   Re: Change Case Sensitivity on Register System
Reply With Quote #5

thanks solved
tepegoz is offline
tepegoz
Senior Member
Join Date: Apr 2019
Old 01-08-2020 , 06:54   Re: Change Case Sensitivity on Register System
Reply With Quote #6

Not solved. If system saves player's name to PLAYER1 , when player connect as with player1 nick, it is not registered.
I want: system shouldn't save player's name with low case because my old players saved own nick with case sensitivity(Ex: PLaYeR1)
I want system should save nicks same type(current system) but when player connected another nick sensitivity, player is to be registered.

Last edited by tepegoz; 01-08-2020 at 07:06.
tepegoz is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-08-2020 , 07:40   Re: Change Case Sensitivity on Register System
Reply With Quote #7

I don't think that the behavior can be modified for entries that are already stored in the database as nVault doesn't have an option for case-insensitive lookup. The easiest solution is to clear the database and let users register again.
__________________

Last edited by OciXCrom; 01-08-2020 at 07:41.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-08-2020 , 18:03   Re: Change Case Sensitivity on Register System
Reply With Quote #8

You would need to force-lowercase existing records using nVault Utility, and then going forward, do what OciXCrom suggested for all new records.

But why are you not saving by steam id, this way they can freely change their name.
__________________

Last edited by Bugsy; 01-08-2020 at 20:37.
Bugsy is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-08-2020 , 18:12   Re: Change Case Sensitivity on Register System
Reply With Quote #9

Quote:
Originally Posted by Bugsy View Post
You would need to clean existing records using nVault Utility
Or simply delete the nVault file.
__________________

Last edited by OciXCrom; 01-08-2020 at 18:13.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-08-2020 , 18:58   Re: Change Case Sensitivity on Register System
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
Or simply delete the nVault file.
Of course ... if he does not care about losing the existing data.
__________________
Bugsy is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 07:06.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode