Server Closed Connection [REP +]
#8

Quote:
Originally Posted by DaniceMcHarley
View Post
When you register it doesn't say "Server closed the connection" only when you try to spawn?
I can't login ingame,i got dialog box to register acc when i do and i need to spawn server close connection after password.

I changed Publics,OnPlayerConnection OnPlayerRegister and OnPlayerUpdateEx

EXAMPES:
From
pawn Code:
public OnPlayerRegister(playerid, password[])
{
    if(IsPlayerConnected(playerid))
    {
        new string3[64];
        new string[128];
        new playersip[24];
        new playername3[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername3, sizeof(playername3));
        GetPlayerIp(playerid, playersip, sizeof(playersip));

        format(string3, sizeof(string3), "LARP/Users/%s.ini", playername3);

        dini_Create(string3);
        new password2 = num_hash(password);
        PlayerInfo[playerid][pKey] = password2;
        dini_IntSet(string3, "Password",password2);
        dini_IntSet(string3, "Level",PlayerInfo[playerid][pLevel]);
        dini_IntSet(string3, "Spawn",PlayerInfo[playerid][pSpawn]);
        ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,"Welcome, Please Log-In","Account Successfuly Registred into the database!\nType your password below to log-in","Log-in","Quit");
        new y,m,d;
        new h,mi,s;
        getdate(y,m,d);
        gettime(h,mi,s);
        format(string,sizeof(string), "(%d/%d/%d) [%d:%d:%d] %s Has registred in under IP %s.",d,m,y,h,mi,s,playername3,playersip);
        PlayerInfo[playerid][pReg] = 0;
        LoginLog(string);
    }
    return 1;
}
To
pawn Code:
public OnPlayerRegister(playerid, password[])
{
    if(IsPlayerConnected(playerid))
    {
            new string3[64];
            new string[128];
            new playername3[MAX_PLAYER_NAME];
            new playersip[24];
            GetPlayerName(playerid, playername3, sizeof(playername3));
            GetPlayerIp(playerid, playersip, sizeof(playersip));
            format(string3, sizeof(string3), "LARP/Users/%s.ini", playername3);
            new File: hFile = fopen(string3, io_write);
            if (hFile)
            {
                strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
                new var[176];
                format(var, 128, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
                format(var, 128, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
                format(var, 128, "Spawn=%d\n",PlayerInfo[playerid][pSpawn]);fwrite(hFile, var);
                fclose(hFile);
                ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_PASSWORD,"Welcome, Please Log-In","Account Successfuly Registered into the database!\nType your password below to log-in","Log-in","Quit");
                new y, m, d;
                new h,mi,s;
                getdate(y,m,d);
                gettime(h,mi,s);
                format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has registered under IP %s.",d,m,y,h,mi,s,playername3,playersip);
                LoginLog(string);
            }
    }
    return 1;
}
From,
pawn Code:
public OnPlayerLogin(playerid,password[])
{
    new tmp2[256]
    new string2[64];
    new string[128];
    new playername2[MAX_PLAYER_NAME];
    new playersip[24];

    SetRealName(playerid);
    GetPlayerName(playerid, playername2, sizeof(playername2));
    GetPlayerIp(playerid, playersip, sizeof(playersip));

    format(string2, sizeof(string2), "LARP/Users/%s.ini", playername2);

    if (dini_Exists(string2))
    {
        new password2 = num_hash(password);
        if(dini_Int(string2,"Password") == password2)
        {
            PlayerInfo[playerid][pKey] = dini_Int(string2,"Password");
            PlayerInfo[playerid][pLevel] = dini_Int(string2,"Level");
            PlayerInfo[playerid][pSpawn] = dini_Int(string2,"Spawn");
etc,etc
Its long code
pawn Code:
public OnPlayerLogin(playerid,password[])
{
    new tmp2[256];
    new string2[64];
    new string[128];
    new playersip[24];
    new playername2[MAX_PLAYER_NAME];
    new playernamesplit[3][MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    GetPlayerIp(playerid, playersip, sizeof(playersip));
    split(playername2, playernamesplit, '_');
    format(string2, sizeof(string2), "LARP/Users/%s.ini", playername2);
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {
        new PassData[256];
        new keytmp[256], valtmp[256];
        fread( UserFile , PassData , sizeof( PassData ) );
        keytmp = ini_GetKey( PassData );
        if( strcmp( keytmp , "Key" , true ) == 0 )
        {
            valtmp = ini_GetValue( PassData );
            strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
        }
        if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
        {
                new key[ 256 ] , val[ 256 ];
                new Data[ 256 ];
                while ( fread( UserFile , Data , sizeof( Data ) ) )
                {
                    key = ini_GetKey( Data );
                    if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
                    if( strcmp( key , "Spawn" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSpawn] = strval( val ); }
So i canged from "dini set" to "format var" maybe i did something wrong,I'm not experienced with this never changed from older to some newer system,if someone is experienced and this is easy for him maybe he can check my code and tell me what i did wrong i changed only OnplayerUpdateEx OnPlayerLogin and OnPlayerRegister
Reply


Messages In This Thread
Server Closed Connection [REP +] - by ***Niko*** - 13.11.2013, 18:10
Re: Server Closed Connection [REP +] - by thomaswilliams - 13.11.2013, 18:42
Re: Server Closed Connection [REP +] - by ***Niko*** - 13.11.2013, 18:45
Re : Server Closed Connection [REP +] - by samp_boy - 13.11.2013, 19:00
Re: Server Closed Connection [REP +] - by ***Niko*** - 13.11.2013, 19:30
Re: Server Closed Connection [REP +] - by DaniceMcHarley - 13.11.2013, 20:52
Re : Server Closed Connection [REP +] - by samp_boy - 13.11.2013, 21:27
Re: Server Closed Connection [REP +] - by ***Niko*** - 13.11.2013, 21:45
Re: Server Closed Connection [REP +] - by Mattakil - 13.11.2013, 23:31
Re: Server Closed Connection [REP +] - by KimGuan - 13.11.2013, 23:37
Re: Server Closed Connection [REP +] - by ***Niko*** - 14.11.2013, 00:57
Re: Server Closed Connection [REP +] - by 420Scripter - 14.11.2013, 01:31
Re: Server Closed Connection [REP +] - by WopsS - 14.11.2013, 04:17
Re: Server Closed Connection [REP +] - by ***Niko*** - 14.11.2013, 06:14
Re: Server Closed Connection [REP +] - by DaniceMcHarley - 14.11.2013, 10:17
Re: Server Closed Connection [REP +] - by ***Niko*** - 14.11.2013, 15:30
Re: Server Closed Connection [REP +] - by ***Niko*** - 14.11.2013, 23:25
Re: Server Closed Connection [REP +] - by DavidLuango - 15.11.2013, 00:53
Re: Server Closed Connection [REP +] - by ***Niko*** - 15.11.2013, 00:56
Re: Server Closed Connection [REP +] - by Deduction - 15.11.2013, 01:52
Re: Server Closed Connection [REP +] - by ***Niko*** - 15.11.2013, 12:47

Forum Jump:


Users browsing this thread: 12 Guest(s)