SA-MP Forums Archive
[Ajuda] trocar nick - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] trocar nick (/showthread.php?tid=592061)



trocar nick - CZ - 20.10.2015

Alguйm pode me ajudar com esse comando eu quero que muda o nick
dentro da pasta tb e ve se existe mais nгo sei como faz isso

PHP Code:
CMD:novonick(playeridparams[])
{
    if(
GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid0xFF0000FF"Vocк nгo tem dinheiro suficiente para trocar de nick");
    new 
nNick[20];
    if(
sscanf(params"s[20]",nNick)) return SendClientMessage(playerid0xFFFF00FF"Use: /novonick <Nick>");
    
SetPlayerName(playeridnNick);
    new 
File[37];
    
GetPlayerName(playeridFileMAX_PLAYER_NAME),
    
format(File,sizeof(File),DOF2_File(File));
    
DOF2_RenameFile("CZ/.ini"nNick);
    
format(Str,sizeof(Str), "|NovoNick|: Vocк mudou seu nick para %s",Nome(playerid));
    
SendClientMessage(playerid0x00FF00FFStr);
    
GivePlayerMoney(playerid, -10000);
    
SalvarDados(playerid);
    return 
1;




Re: trocar nick - SepZ - 20.10.2015

tente usar isso, qualquer erro me avise, estou pelo celular

PHP Code:
CMD:novonick(playeridparams[])
{
    new 
newnick[20];
    if(
GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid0xFF0000FF"ERRO: Dinheiro insuficiente");
    if(
sscanf(params"s[20]"newnick)) return SendClientMessage(playerid0xFF0000FF"ERRO: Use /novonick [nick]");
    if(
strlen(newnick) < || strlen(newnick) > 20) return SendClientMessage(playerid0xFF0000FF"ERRO: Minimo 3, maximo 20 caracteres");
    new 
arq[35], arq2[35];
    
format(arqsizeof(arq), "CZ/%s.ini"newnick);
    
format(arq2sizeof(arq2), "CZ/%s.ini"Nome(playerid));
    
    if(
DOF2_FileExists(arq)) return SendClientMessage(playerid0xFF0000FF"ERRO: Esse nick jб existe");
    
//
    
    
DOF2_RenameFile(arq2newnick);
    
SetPlayerName(playeridnewnick);
    
    
GivePlayerMoney(playerid, -10000);
    
SalvarDados(playerid); 
    
    new 
str[65];
    
format(strsizeof(str), "* Parabens voce mudou seu nick para: %s"newnick);
    
SendClientMessage(playerid0xFFFF00FFstr);
    return 
1;




Re: trocar nick - CZ - 20.10.2015

Mudo o nick de boa mais nгo salvo.


Re: trocar nick - SepZ - 20.10.2015

Quote:
Originally Posted by CZ
View Post
SalvarDados(playerid);
esse SalvarDados nгo й pra salvar?


Re: trocar nick - CZ - 20.10.2015

Sim й


Re: trocar nick - Galhardo - 20.10.2015

Passa o SalvarDados ai


Re: trocar nick - CZ - 20.10.2015

PHP Code:
stock SalvarDados(playerid)
{
    
DOF2_SetInt(PegarConta(playerid), "Score"GetPlayerScore(playerid));
    
DOF2_SetInt(PegarConta(playerid), "Dinheiro"GetPlayerMoney(playerid));
    
DOF2_SetInt(PegarConta(playerid), "NivelAdmin"PlayerDados[playerid][Admin]);
    
DOF2_SetInt(PegarConta(playerid), "Matou"Matou[playerid]);
    
DOF2_SetInt(PegarConta(playerid), "Morreu"Morreu[playerid]);
    
DOF2_SetInt(PegarConta(playerid), "Vip"PlayerDados[playerid][Vip]);
    
DOF2_SaveFile();




Re: trocar nick - Abravanel - 20.10.2015

PHP Code:
DOF2_RenameFile(arq2newnick); 
Olha isso ai... newnick nгo deveria estar ali @SepZ.

Uma dica, quando for usar apenas um parвmetro, troque o sscanf por isnull.
PHP Code:
//topo
#if !defined isnull
    #define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
if (isnull(params))
    return print(
"nгo foi digitado o parвmetro"); 



Re: trocar nick - SepZ - 20.10.2015

Quote:
Originally Posted by Abravanel
View Post
PHP Code:
DOF2_RenameFile(arq2newnick); 
Olha isso ai... newnick nгo deveria estar ali @SepZ.

Uma dica, quando for usar apenas um parвmetro, troque o sscanf por isnull.
PHP Code:
//topo
#if !defined isnull
    #define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
if (isnull(params))
    return print(
"nгo foi digitado o parвmetro"); 
Ah sim, valeu pela dica.

deveria ser feito desse modo, correto?
PHP Code:
DOF2_RenameFile(arq2arq); 



Re: trocar nick - CZ - 20.10.2015

Galera nгo salvou o nick oque devo fazer?