16.04.2015, 04:00
Look this one isn't working too, it deletes the file without creating the new one..
Код:
CMD:setname(playerid, params[]) { new string[128], giveplayerid, name[MAX_PLAYER_NAME]; new playername[MAX_PLAYER_NAME]; if(sscanf(params, "us[24]", giveplayerid, name)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setname [playerid/partofname] [newname]"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[playerid][pAdmin] >= 4) { if(!INI_Exist(name)) { new newname[MAX_PLAYER_NAME + 10]; GetPlayerName(giveplayerid, playername, sizeof(playername)); format(newname, sizeof(newname), "Accounts/%s.ini", name); format(string, sizeof(string), "{FF1B31}[Administration]{FFFFFF} %s has renamed %s to %s.", PlayerName(playerid), playername, newname); ABroadCast(COLOR_GRAD1,string,2); format(newname, sizeof(newname), "Accounts/%s.ini", playername); fremove(newname); if(INI_Exist(playername)) // If it doesn't get removed, blank the file with write io and check its length when a player attempts to authenticate (it'll be 0) { new File: BlankTheFile = fopen(newname, io_write); SendClientMessage(playerid, COLOR_GRAD2, "The old account couldn't be removed completely (it's been blanked for future use)."); fclose(BlankTheFile); } } else { SendClientMessage(playerid, COLOR_WHITE, "This name is already registered."); } } else { SendClientMessage(playerid, COLOR_GRAD2, "You're not authorised to use this command."); } } else { SendClientMessage(playerid, COLOR_GRAD2, "No Such Player"); } return 1; }