/deleteaccount
#1

pawn Код:
#define PATH "/Main Server Folder/Accounts/%s.ini"
CMD:deleteaccount(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        new name[25],str[30];
        if(sscanf(params,"s[25]",name)) return MSG(playerid,COLOR_RED,"SERVER: /deleteaccount [Firstname_Lastname]");
        format(str, sizeof(str),PATH,name);
        if(!fexist(str))
        {
            SFM(playerid,COLOR_RED,"SERVER: %s cannot be found in the database.",name);
        }
        else
        {

            SFM(playerid,WHITE,"SERVER: You have deleted the account %s.",name);
            fremove(str);
        }
    }
    return 1;
}
I believe there's something missing in the command but I can't figure what is it any help is appreciated.


Thanks.
Reply
#2

The variable "str" is too small. Even yor path "/Main Server Folder/Accounts/%s.ini" is 35 characters, so when you add the name it might be up to 60 characters(35 + MAX_PLAYER_NAME(24) + 1) .

Increase str size to 60.
Reply
#3

Dusk is right. Remember that the path will be stored in str thus 30 is not sufficient. Good luck.
Reply
#4

Ohh right, thanks, appreciated mate.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)