//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.");
}
}
|
Cicinho, й em dof2 mesmo, irei testar aqui e jб posto o edit.
EDIT: Funcionou direitinho meu brother, +rep pra vocк, mas me tira uma duvida? Quando muda o nick, fica 2 arquivos criados, o antigo e o novo, como posso fazer para excluir o novo e deixar sу o antigo? |
format(String, sizeof(String), "Contas/%s.ini", inputtext); format(Str, sizeof(Str), "Contas/%s.ini", Nome);
|
Cicinho, й em dof2 mesmo, irei testar aqui e jб posto o edit.
EDIT: Funcionou direitinho meu brother, +rep pra vocк, mas me tira uma duvida? Quando muda o nick, fica 2 arquivos criados, o antigo e o novo, como posso fazer para excluir o novo e deixar sу o antigo? |
|
valew brown nois agradece a ajuda de vocкs equipe BPT AGRADECE DE CORAЗГO
|