10.02.2015, 16:46
(
Последний раз редактировалось ReD_HunTeR; 14.02.2015 в 12:26.
)
fixxed.
CMD:namechange(playerid,params[])
{
if(!Logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "You need to be logged in, to use this command");
if(IsSpawn[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You need to be spawned, to use this command");
if(PlayerInfo[playerid][pAdminLevel] >= 9)
{
new targetid, newname[MAX_PLAYER_NAME], query[128];
if(sscanf(params, "us[24]", targetid, newname)) return SendClientMessage(playerid,COLOR_GREY,"Syntax: /changename [playerid] [NewName]");
mysql_format(MySQLHandle, Query, sizeof(Query), "SELECT Username FROM players WHERE Username = '%s' LIMIT 1", newname);
mysql_tquery(MySQLHandle, Query, "ChangePlayerName", "iis", playerid, targetid, newname);
}
else SendClientMessage(playerid,COLOR_RED,"You do not have the right admin permissions for this command!");
return 1;
}
forward ChangePlayerName(playerid, id, newplayername[]);
public ChangePlayerName(playerid, id, newplayername[])
{
if(cache_num_rows()) return SendClientMessage(playerid, COLOR_RED, "Name is already being used!");
new Query[128], string[128];
mysql_format(MySQLHandle, Query, sizeof(Query), "UPDATE players SET Username = '%e' WHERE Username = '%s'", newplayername, PlayerName(id));
mysql_tquery(MySQLHandle, Query);
format(string, sizeof(string), "%s %s(%d) has changed %s(%d)'s name to %s!", AdminLevelName(playerid), PlayerName(playerid), playerid, PlayerName(id), id, newplayername);
SendClientMessageToAll(COLOR_RED, string);
SetPlayerName(id, newplayername);
return 1;
}