Server crash on Register
#1

Hello.
i have problem with Register system, it makes server to crash, when I type my password.
My code:
pawn Код:
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Please Register", "Register", "Leave");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Enter you password to login", "Login", "Leave");
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_LOGIN)
    {
        if(!response)
        {
            SendClientMessage(playerid, COLOR_RED, "You need to login, to play here.");
            Kick(playerid);
        }
        else
        {
                new name[MAX_PLAYER_NAME];
            new file[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), "kasutajad/parool/%s.ini", name);
                new string[64];
        new File:password = fopen(file, io_read);
        while(fread(password, string))
        {
                 if(strcmp(string, inputtext, true) == 0)
                {
                Login(playerid);
                }
                else{
                SendClientMessage(playerid, COLOR_WHITE, "Wrong password!");
                Kick(playerid);
                }
            }
            fclose(password);
        }
        return 1;
    }
    else if(dialogid == DIALOG_REGISTER)
    {
        if(!response)
        {
            SendClientMessage(playerid, COLOR_RED, "You need to login to play here.");
            SendClientMessage(playerid, COLOR_WHITE, "You don't have account jet, so make one first!");
            Kick(playerid);
        }
        else
        {
            new name[MAX_PLAYER_NAME];
            new file[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            format(file, sizeof(file), "kasutajad/parool/%s.ini", name);
            new File:password = fopen(file, io_write);
            if(password)
            {
                fwrite(password, inputtext);
                fclose(password);
            }
            Register(playerid);
        }
        return 1;
    }
    return 0;
}
For me this code should take the dialog input and insert the text into /scriptfiles/kasutajad/parool/PlayerNameHere.ini file, but pressing the Register in dialog, crashes the server, Please help
Kasutajad/parool means users/password
Sorry for my bad English
Reply


Messages In This Thread
Server crash on Register - by RACGaming - 17.11.2012, 09:59
AW: Server crash on Register - by Skimmer - 17.11.2012, 10:23
Re: Server crash on Register - by RACGaming - 17.11.2012, 10:27
Re: Server crash on Register - by Konstantinos - 17.11.2012, 10:27
Re: Server crash on Register - by RACGaming - 17.11.2012, 10:32
Re: Server crash on Register - by Konstantinos - 17.11.2012, 10:34
Re: Server crash on Register - by RACGaming - 17.11.2012, 10:35
Re: Server crash on Register - by RACGaming - 17.11.2012, 10:37
Re: Server crash on Register - by Konstantinos - 17.11.2012, 10:43
Re: Server crash on Register - by Smally - 17.11.2012, 10:45

Forum Jump:


Users browsing this thread: 1 Guest(s)