Raised This Month: $ Target: $400
 0% 

Make nick change in mySQL work


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
4ever16
Veteran Member
Join Date: Apr 2015
Old 06-08-2018 , 10:26   Make nick change in mySQL work
Reply With Quote #1

So i have a plugin and it sends data to mySQL.
But i would like the plugin to update the nickname if i change it.
If my nickname ingame is Player 1 and i change it to Player 2 then mySQL doesnt update to the new nickname.

Can someone check these parts of the code and see if it has some errors or something?


Here are parts from the plugin which i think should change the nickname in mySQL but it doesnt.
PHP Code:
new Team[33], OldName[33][32
PHP Code:
public client_infochanged(id

    new 
newname[32],oldname[32
    
get_user_info(id"name"newname,31
    
get_user_name(idoldname31
    
    if(!
equali(newnameoldname))
    {
        
OldName[id] = oldname;
        
MySQL_UpdateName(id);
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;

PHP Code:
public MySQL_UpdateName(id) {
    
replace_all(OldName[id], 32"'""\'"); 
    
replace_all(OldName[id], 32"^"", "\^""); 

    
formatexMySQL_QuerycharsmaxMySQL_Query ), "UPDATE `online_players` SET `username` = '%s' WHERE `username` = '%s'"get_user_name_ex(id), OldName[id] ) 
    
SQL_ThreadQuery(MySQL_Tuple"SQL_TrashHandler"MySQL_Query);   

PHP Code:
stock get_user_name_ex(id

    new 
szName[33]; 
    
get_user_name(idszNamecharsmax(szName)); 

    
replace_all(szNamecharsmax(szName), "'""\'"); 
    
replace_all(szNamecharsmax(szName), "^"", "\^""); 

    return 
szName


Last edited by 4ever16; 06-08-2018 at 10:28.
4ever16 is offline
 



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 04:34.


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