22.11.2016, 16:08
galera, criei um sistema de mudar o nick do jogador porem estб com problema quando mudo o nick do jogador ele sai e o nick nгo muda
codigo
codigo
PHP код:
CMD:changename(playerid, params[])
{
new targetid,name[128], query[256];
if(pInfo[playerid][pAdminLevel] >= 5)
{
if(sscanf(params, "us", targetid, name)) return SendClientMessage(playerid,-1,""chat" /changename [playerid] [new name]");
else if(!IsPlayerConnected(targetid))SendClientMessage(playerid,COLOR_RED,"Error: Player is not connected!");else
{
// new string[128],
new n[MAX_PLAYER_NAME];
GetPlayerName(targetid,n,sizeof(n));
SetPlayerName(targetid,name);
format(query, sizeof(query), "UPDATE `users` SET `name` = '%s' WHERE `name` = %s", name, n);
SetPlayerName(targetid, name);
SendClientMessage(targetid, COLOR_RED,"You name has been changed. please re-loggin now.");
new DBResult:dbrResult = db_query(g_dbKeptAlive, query);
db_free_result(dbrResult);
}
}
return 1;
}