Disable account
#1

Hey guys,

Im making a 'disable account' command, but my compiler crashes when im trying to compile it.

pawn Код:
CMD:disable(playerid, params[])
{
    if( PlayerInfo[playerid][p_Admin] > 5 )
    {
        new
            pID[24],
            Reason[50];
        if( !sscanf(params, "s[24]s[50]", pID, Reason) )
        {
            new
                pFile[50];
            format( pFile, sizeof pFile, pPATH, pID );
            if( fexist( pFile ) )
            {
                if( INI_Bool(pFile, "Account_Disabled") != true )
                {
                    INI_WriteString(pFile, "Account_Dis_Reason", Reason, 50);
                    INI_WriteBool(pFile, "Account_Disabled", true);
                }
                else
                {
                    SendClientMessage( playerid, COLOR_RED, "That characters account is already disabled. " );
                    return 1;
                }
            }
            else
            {
                SendClientMessage( playerid, COLOR_RED, "That file doesnt exist! Please check if the name is correct. " );
                return 1;
            }
        }
    }
    else
        return SendClientMessage( playerid, COLOR_RED, "You have to be an admin to perform this command. " );

    return 1;
}
It doesnt give any errors, otherwise it wouldnt crash
pawn Код:
#define pPATH                   "RegisterSystem/Users/%s.ini"
~Wesley
Reply
#2

Use #endinput and see from what line don't compile, exemple: Put #endinput after fexist and see if it compiles, if it is, put after "that characters account is ...", if it compiles, is from
Код:
if( INI_Bool(pFile, "Account_Disabled") != true )
                {
                    INI_WriteString(pFile, "Account_Dis_Reason", Reason, 50);
                    INI_WriteBool(pFile, "Account_Disabled", true);
                }
( was just an example ).

Try, then come back and see from what line the compiler crashes.

EDIT: I think it's from if( INI_Bool(pFile, "Account_Disabled") != true ) ... it isn't used just on INI_ParseFile's public function ?
Reply
#3

As far as i know INI_Bool can be used like that aswell, doesnt need to be stored in a variable. It is only used when the player connects to the game.
+ i didnt get what you meant with the things you said above
Reply
#4

hm maybe try it without the pPath definition? I'm not sure if that 'causes the problem, although I would recommend you if it still crashes to comment out each line except the first line (/* start and */ end, although i guess you know that)...
So if the compiler doesn't crash, go to the next if state or line...

(comment everything within an if callback out when going to the "if" lines)
doing this you could find the crashing-part-code and we could maybe work on a solution for that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)