SA-MP Forums Archive
Change name mysql - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Change name mysql (/showthread.php?tid=311926)



Change name mysql - Bogdan1992 - 18.01.2012

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;




Re: Change name mysql - 2KY - 18.01.2012

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


Re: Change name mysql - Bogdan1992 - 18.01.2012

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


Re: Change name mysql - Jefff - 18.01.2012

field user must be a text in database


Re: Change name mysql - Bogdan1992 - 18.01.2012

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


Re: Change name mysql - Jefff - 18.01.2012

eh replace u[24] to s[24]


Re: Change name mysql - Bogdan1992 - 18.01.2012

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