[Ajuda] Ajuda com esse comando plz
#1

Criei o CMD /deletar que deleta a conta do player. Com o arquivo na pasta raiz, foi deboa, agora quando esta numa subpasta nao deleta nada :X

pawn Код:
if (strcmp("/deletar", cmdtext, true) == 0)
    {
        new Player_Name[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid,Player_Name,sizeof(Player_Name)),
        format(string,128,"Pasta/%s.ini",Player_Name),
        fremove(string);
        SendClientMessage(playerid,0xFF00000AA, "Sua conta foi deletada.");
        Kick(playerid);
        return 1;
    }
Reply
#2

pawn Код:
#define Contas "Pasta/%s.ini"
pawn Код:
if (strcmp("/deletar", cmdtext, true) == 0)
    {
        new Player_Name[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid,Player_Name,sizeof(Player_Name)),
        format(string,128,"Contas",Player_Name),
        fremove(string);
        SendClientMessage(playerid,0xFF00000AA, "Sua conta foi deletada.");
        Kick(playerid);
        return 1;
    }
Sei que й sem noзгo mais tenta ai.
Reply
#3

Isto deve resolver o seu problema :


Basta especificar o nome da subpasta como estando dentro da "pasta raнz", na string, como no caso abaixo :


Код:
if (strcmp("/deletar", cmdtext, true) == 0)
{
    new Player_Name[MAX_PLAYER_NAME];
    new string[128];
    GetPlayerName(playerid,Player_Name,sizeof(Player_Name)),
    format(string,128,"Pasta/SubPasta/%s.ini",Player_Name),
    fremove(string);
    SendClientMessage(playerid,0xFF00000AA, "Sua conta foi deletada.");
    Kick(playerid);
    return 1;
}

Espero ter ajudado .
Reply
#4

@Shickcard: nem deu

@rjjj

Tentei assim:

pawn Код:
if (strcmp("/deletar", cmdtext, true) == 0)
{
    new Player_Name[MAX_PLAYER_NAME];
    new string[128];
    GetPlayerName(playerid,Player_Name,sizeof(Player_Name)),
    format(string,128,"Scriptfiles/Pasta/%s.ini",Player_Name),
    fremove(string);
    SendClientMessage(playerid,0xFF00000AA, "Sua conta foi deletada.");
    Kick(playerid);
    return 1;
}
Mas nгo deu certo A pasta raiz que digo й a Scriptfiles

Entгo quando quis dizer pasta raiz, fiz isso e deu certo:

pawn Код:
format(string,128,"%s.ini",Player_Name),
    fremove(string);
Reply
#5

Quote:
Originally Posted by arakuta
Посмотреть сообщение
@Shickcard: nem deu

@rjjj

Tentei assim:

pawn Код:
if (strcmp("/deletar", cmdtext, true) == 0)
{
    new Player_Name[MAX_PLAYER_NAME];
    new string[128];
    GetPlayerName(playerid,Player_Name,sizeof(Player_Name)),
    format(string,128,"Scriptfiles/Pasta/%s.ini",Player_Name),
    fremove(string);
    SendClientMessage(playerid,0xFF00000AA, "Sua conta foi deletada.");
    Kick(playerid);
    return 1;
}
Mas nгo deu certo A pasta raiz que digo й a Scriptfiles

Entгo quando quis dizer pasta raiz, fiz isso e deu certo:

pawn Код:
format(string,128,"%s.ini",Player_Name),
    fremove(string);


Й que o comando que vocк postou estava correto , por isso pensei que a "pasta raнz" que vocк citou fosse a pasta Pasta que vocк colocou no format .


Bem, modifiquei certas coisas que, apesar de dificilmente, poderiam causar conflito em algumas partes do comando :



pawn Код:
if(!strcmp("/deletar",cmdtext,true,8))
    {
        new Player_Name[24];
        new txt_string[128];
        GetPlayerName(playerid,Player_Name,24);
        format(txt_string,128,"/Pasta/%s.ini",Player_Name);
        fremove(txt_string);
        SendClientMessage(playerid,0x33CCFFAA, "Sua conta foi deletada.");
        Kick(playerid);
        return true;
    }


Se mesmo assim nгo funcionar, talvez possa ser o fato de vocк nгo ter compilado o cуdigo apуs ter adicionado o comando, ou algo do tipo, pois como disse antes, o seu comando estava correto .



Espero ter ajudado .
Reply
#6

Nгo funcionou Rjjj.. Nгo entendo :/
Compilo sim, pois eu sempre altero o comando pra cada tentativa pra ter certeza que compilou
Reply
#7

Se vocк adicionar um

pawn Код:
fclose(txt_string);
Antes de tentar deletar o arquivo, nгo muda nada?

Att.
Reply
#8

Quote:
Originally Posted by Yakushi Icefox
Посмотреть сообщение
Se vocк adicionar um

pawn Код:
fclose(txt_string);
Antes de tentar deletar o arquivo, nгo muda nada?

Att.
Nгo, isto sу seria usado caso houvesse fopen antes, ou seja, se o arquivo tivesse sido aberto.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)