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


Messages In This Thread
Change name mysql - by Bogdan1992 - 18.01.2012, 21:47
Re: Change name mysql - by 2KY - 18.01.2012, 21:52
Re: Change name mysql - by Bogdan1992 - 18.01.2012, 21:55
Re: Change name mysql - by Jefff - 18.01.2012, 22:03
Re: Change name mysql - by Bogdan1992 - 18.01.2012, 22:07
Re: Change name mysql - by Jefff - 18.01.2012, 22:12
Re: Change name mysql - by Bogdan1992 - 18.01.2012, 22:14

Forum Jump:


Users browsing this thread: 1 Guest(s)