Change name mysql
#1

Well, when i try to change my name it doesn't work properly. In database the name it change to this character я.
And it doesn't set the players name.
PHP код:
CMD:changename(playeridparams[])
{
    new 
newname[24];
    if(
sscanf(params"u[24]",newname))return SendClientMessage(playerid,COLOR_LIGHTBLUE,"USAGE: {FFFFFF}/changename [New Name]");
    
GetPlayerName(playerid,pname,24);
    new 
query1[256],escapename[24];
    
mysql_real_escape_string(newnameescapename);
    
format(query1sizeof(query1), "SELECT `user` FROM `playerdata` WHERE `user` = '%s'"escapename);
    
mysql_query(query1);
    
mysql_store_result();
    new 
rows mysql_num_rows();
    if(!
rows)
    {
        new 
query[256];
        
format(querysizeof(query), "UPDATE `playerdata` SET `user`= '%s' WHERE `user` ='%s'",escapename,pname);
        
mysql_query(query);
        
SetPlayerName(playerid ,params);
        
format(mystringsizeof(mystring),"%s has changed hes name into %s"pnameparams);
        
SendClientMessageToAll(COLOR_WHITEmystring);
    }
    else if(
rows == 1)
    {
        
SendClientMessage(playerid0xFF0000FF"This name already exists!");
    }
    
mysql_free_result();
    return 
1;

Reply
#2

pawn Код:
SetPlayerName(playerid ,params);
That's your problem, find everywhere "params" is used, and replace it with "newname".
Reply
#3

Anyway i really don't care about that , the real problem is that it changes the name into this "я" in database.
Reply
#4

field user must be a text in database
Reply
#5

Type | Collation
varchar(24) | utf8_unicode_ci
I have this on database.
Reply
#6

eh replace u[24] to s[24]
Reply
#7

Auuuu, yeh, I'm such an idiot xD, Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)