02.02.2015, 14:14
This my script :
Still can use already name exists !
How to fix that ?
pawn Код:
CMD:changename(playerid,params[])
{
new newname[24];
new query[128],query1[128];
new mess[128];
if(pInfo[playerid][Login] == 0) return Kick(playerid);
if(sscanf(params,"s[24]",newname)) return SCM(playerid,-1,"**Usage : /changename [Name]");
mysql_format(mysql, query, sizeof(query),"SELECT `players` WHERE Username = '%e' LIMIT 1", GetName(playerid));
if(cache_get_row_count())
{
SCM(playerid,-1,"** The name already exists!");
}
else
{
mysql_format(mysql, query1, sizeof(query1), "UPDATE `players` SET `Username`= '%e' WHERE `ID`= '%d'",newname,pInfo[playerid][ID]);
mysql_tquery(mysql, query1, "", "");
format(mess,128,"** Your name has changed too : %s",newname);
printf("**CHANGE-NAME : %s has change name to %s",GetName(playerid),newname);
SCM(playerid,-1,mess);
pKick(playerid);
}
return 1;
}
How to fix that ?