Problem with /deleteacc
#1

Keeps saying that name cannot be found.


pawn Код:
CMD:deleteacc(playerid, params[])
{
    new targetname[24], filestring[79];
    if(PlayerInfo[playerid][pAdminLevel] >= 7)
    {
        if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, -1, "Correct usage: /deleteacc [Player's name]");
        format(filestring, sizeof(filestring), "Users/%.ini", targetname);
        if(!fexist(filestring)) return SendClientMessage(playerid, -1, "Error: Account was not found!");
        else
        {
            fremove(filestring);
            new done[128];
            format(done, sizeof(done), "You have delete account %s", targetname);
            SendClientMessage(playerid, -1, done);
        }
    }
    return 1;
}
Reply
#2

hmmmm, it doesn't seem bugged for me.
make sure you have the correct path written and the correct name
Reply
#3

Quote:
Originally Posted by Vanter
Посмотреть сообщение
hmmmm, it doesn't seem bugged for me.
make sure you have the correct path written and the correct name
Uhm writting it normaly and the file path is also okay since I am using same method for /unbanacc and it works.

Here is the example of my unban. (UNBAN WORKS)

pawn Код:
CMD:unban(playerid, params[])
{
    new targetname[24], filestring[79];
    if(PlayerInfo[playerid][pAdminLevel] >= 7)
    {
        if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, -1, "Correct Usage: /unban [Player's Name]");
        format(filestring, sizeof(filestring), "Users/%s.ini", targetname);
        if(!fexist(filestring)) return SendClientMessage(playerid, -1, "Error: The player name you have chosen was not found in our system.");
        else
        {
            new INI:file = INI_Open(filestring);
            INI_SetTag(file, "Player's Data");
            INI_WriteInt(file, "Banned", 0);
            INI_Close(file);
            new done[128];
            new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
            GetPlayerName(playerid, name, sizeof(name));
            format(done, sizeof(done), "You have unbanned %s", targetname);
            format(string, sizeof(string), "Administrator %s have just unbanned %s", name, targetname);
            AdminLog(string);
            SendClientMessage(playerid,-1 , done);
        }
    }
    return 1;
}
Reply
#4

Here's the problem

if(sscanf(params, "s[24]", targetname))

A target player ( Either name Either ID ) must always be defined as "u"

so that should be replaced with
if(sscanf(params, "u", targetname))
Reply
#5

Quote:
Originally Posted by Alexis1999
Посмотреть сообщение
Here's the problem

if(sscanf(params, "s[24]", targetname))

A target player ( Either name Either ID ) must always be defined as "u"

so that should be replaced with
if(sscanf(params, "u", targetname))
But /unban works with the s[24].

Let me try now with the /delete.

EDIT: Wont work.
Reply
#6

Quote:
Originally Posted by Alexis1999
Посмотреть сообщение
Here's the problem

if(sscanf(params, "s[24]", targetname))

A target player ( Either name Either ID ) must always be defined as "u"

so that should be replaced with
if(sscanf(params, "u", targetname))
How is he supposed to unban a user that is not even online?

format(filestring, sizeof(filestring), "Users/%.ini", targetname);

format(filestring, sizeof(filestring), "Users/%s.ini", targetname);

Missing your specifier
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)