SA-MP Forums Archive
Mysql /ChangeName Help - 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: Mysql /ChangeName Help (/showthread.php?tid=612741)



Mysql /ChangeName Help - alishvasis - 21.07.2016

Hi I'v Made Change Name System For Mysql But Does Not Work ... Anyone Can Fix It Tnx

PHP код:
CMD:changename(playeridparams[]) {
    if(
isnull(params)) {
        return 
SendClientMessage(playerid, -1"/changename [newname]");
    }
    if(
strlen(params) > MAX_PLAYER_NAME) {
        return 
SendClientMessage(playerid, -1"Your name must contain a maximum of 24 characters.");
    }
    new 
current[MAX_PLAYER_NAME];
    
GetPlayerName(playeridcurrentsizeof current);
    if(!
strcmp(currentparamsfalse)) {
        return 
SendClientMessage(playerid, -1"That's already your name!");
    }
    new 
query[128];
    
mysql_format(koneksiquerysizeof query"SELECT * FROM `players` WHERE `Username` = '%s'"params);
    
mysql_tquery(koneksiquery"ChangeName""is"playeridparams);
    return 
1;
}
forward ChangeName(playeridnewname[]);
public 
ChangeName(playeridnewname[]) {
    if(
cache_get_row_count(koneksi)) {
        return 
SendClientMessage(playerid, -1"This name is already in use!");
    }
    new 
current[MAX_PLAYER_NAME];
    
GetPlayerName(playeridcurrentsizeof current);
    new 
query[128];
    
mysql_format(koneksiquerysizeof query"UPDATE `players` SET `Username` = '%s' WHERE `Username` = '%s'"newnamecurrent);
    
mysql_tquery(koneksiquery);
    
SetPlayerName(playeridnewname);
    return 
1;




Re: Mysql /ChangeName Help - DRIFT_HUNTER - 21.07.2016

I dont see anything wrong with code...Query is fine and everything else...
Check your mysql log...


Re: Mysql /ChangeName Help - alishvasis - 21.07.2016

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
I dont see anything wrong with code...Query is fine and everything else...
Check your mysql log...
Wow ! TnX + Rep And CanYou Give Me MySql Change PAssword Command?


Re: Mysql /ChangeName Help - Sjn - 21.07.2016

The error itself says Unknown column 'Username' in 'where clause'

Check your table properly for the correct column name. It's better if you use unique IDs if you have it assigned to their account.


Re: Mysql /ChangeName Help - alishvasis - 21.07.2016

TnX + Rep You Too
Can You Give Me MySql Change PAssword Command?


Re: Mysql /ChangeName Help - Sjn - 21.07.2016

The way of making changepassword command is basically the same as changing the username. You just hash the password and update it in the table.


Re: Mysql /ChangeName Help - alishvasis - 21.07.2016

Quote:
Originally Posted by Sjn
Посмотреть сообщение
The way of making changepassword command is basically the same as changing the username. You just hash the password and update it in the table.
Ok So Tnx