Код:
CMD:setname(playerid, params[])
{
ShowPlayerDialog(playerid, 26, DIALOG_STYLE_INPUT, "Change Name:", "Enter your new name:", "Ok", "Cancel");
return 1;
}
Код:
if(dialogid == 26)
{
if(response)
{
new name[MAX_PLAYERS],string[128],string1[128],query[128],q[128];
format(q,128,"SELECT * FROM 'users' WHERE NAME='%s'",inputtext);
mysql_query(q);
mysql_store_result();
if(mysql_num_rows()>0)
{
SendClientMessage(playerid, red,"That name is already taken. Please choose another name.");
}
GetPlayerName(playerid, name, sizeof(name));
format(query, sizeof(query), "UPDATE 'users' SET Name='%s' WHERE Name='%s'",inputtext,name);
mysql_query(query);
format(String, sizeof(String), "UPDATE 'ostats' SET name='%s' WHERE name='%s'",inputtext,name);
mysql_query(String);
new Stringg[128];
format(Stringg, sizeof(Stringg), "UPDATE 'vehs' SET Name='%s' WHERE Name='%s'",inputtext,name);
mysql_query(Stringg);
format(string, sizeof(string), "**%s has changed his name to %s.",name, inputtext);
SendClientMessageToAll(0xE1E4AAFF, string);
format(string1, sizeof(string1), "*You have changed your name to %s.",inputtext);
SendClientMessage(playerid, 0xE1E4AAFF, string1);
SetPlayerName(playerid, inputtext);
return 1;
}
}
?! it dotn have 2 add a new one becouse you are using UPDATE :/ let me see the code wait
"mysql_debug(1)" above your code, and then check file called "mysql_log" for any errors.