26.06.2013, 17:04
How about this instead:
Just something I wrote real quick through a quick reply here on SA-MP forums, so there might be errors. However, hopefully you'll get an idea of how to do it.
pawn Код:
YCMD:changename(playerid, params[], help){
if(pInfo[playerid][pLogged] == 1 && pInfo[playerid][pAdminLevel] >= 5){
new name[MAX_PLAYER_NAME];
new PlayerID;
if(sscanf(params, "is[MAX_PLAYER_NAME]", name, PlayerID)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /changename [id] [name]")
new oldname[MAX_PLAYER_NAME];
GetPlayerName(playerid, oldname);
new filestring[128];
format(filestring, sizeof(filestring), "/Users/%s.ini", oldname);
new filestring2[128];
format(filestring, sizeof(filestring), "/Users/%s.ini", name);
frename(filestring, filestring2);
SetPlayerName(PlayerID, name);
}
else{
SendClientMessage(playerid, 0xFFFFFFFF, "Not logged in or whatever.");
}
return 1;
}