20.05.2017, 19:44
PHP код:
CMD:changename(playerid, params[])
{
new nick[50], query[128], str[150];
if(sscanf(params,"s[50]",nick)) return SendClientMessage(playerid, COLOR_YELLOW,"USAGE: /changename [New nick]");
format(query, sizeof(query), "SELECT Username FROM players WHERE Username ='%s'", nick);
if(cache_get_row_count(mysql))
{
new oldname[24];
GetPlayerName(playerid, oldname, sizeof(oldname));
format(query, sizeof(query), "UPDATE players SET Username='%s' WHERE ID=%d", nick, pData[playerid][ID]);
mysql_query(mysql, query);
format(str,sizeof(str),"* You have changed your name to %s Don't forget to login with that name when you relog", nick);
SendClientMessage(playerid,COLOR_YELLOW,str);
SetPlayerName(playerid, nick);
}
else
{
format(str, sizeof(str), "Name %s is already in the database/used, please use onther name!", nick);
SendClientMessage(playerid, COLOR_RED, str);
}
return 1;
}
Код:
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(4735) : warning 213: tag mismatch