28.11.2015, 20:31
@jefrens, fiz em DOF2, cуdigo:
Код:
//Definiзхes #define DIALOG_MUDARNOME 200 //Comando CMD:mudarnome(playerid) { ShowPlayerDialog(playerid, DIALOG_MUDARNOME, DIALOG_STYLE_INPUT, "Alterar nome", "\nDigite seu novo nome para continuar:", "Continuar", "Cancelar"); return true; } //Callback OnDialogResponse public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_MUDARNOME) { new String[60],Str[60],Nome[MAX_PLAYER_NAME]; if(response) { if(strlen(inputtext) < 3 || strlen(inputtext) > 20) { SendClientMessage(playerid, 0xFF000000, "ERRO: Nome invбlido."); }else{ GetPlayerName(playerid, Nome, sizeof Nome); format(String, sizeof(String), "Contas/%s.ini", inputtext); if(!DOF2_FileExists(String)) { format(Str, sizeof(Str), "Contas/%s.ini", Nome); DOF2_RenameFile(Str, String); DOF2_SaveFile(); format(String, sizeof(String), "Parabйns! Seu novo nick й: %s! Entre novamente no servidor com seu novo nome.", inputtext); SendClientMessage(playerid, -1, String); Kick(playerid); } else SendClientMessage(playerid, 0xFF000000, "ERRO: Ja existe uma conta com esse nick!"); } } else SendClientMessage(playerid, -1, "INFO: Vocк cancelou a mudanзa de nick."); } }