[HELP] Gives crash on linux server?
#1

pawn Code:
dcmd_register(playerid, params[])
{
    new PlayerFile[50], plrIP[50];
    new string[256];
    format(PlayerFile, sizeof(PlayerFile), "/users/%s.ini", pName(playerid));
    GetPlayerIp(playerid, plrIP, sizeof(plrIP));

    if(PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid, mbrightred, "You have already registered and logged in!");
    else if(dini_Exists(PlayerFile)) return SendClientMessage(playerid, mbrightred, "You have already registered! Please use /login to login or choose another nickname.");

    if(!dini_Exists(PlayerFile))
    {
        if (!strlen(params)) return SendClientMessage(playerid, mwhite, "Usage: /register [password]");

        dini_Create(PlayerFile);
        dini_Set(PlayerFile, "Password", MD5_Hash(params));
        dini_Set(PlayerFile, "PlayerIP", plrIP);
        dini_IntSet(PlayerFile, "PasswordChangings", 0);
        dini_IntSet(PlayerFile, "AdminLevel", 0);
        dini_IntSet(PlayerFile, "Deaths", 0);
        dini_IntSet(PlayerFile, "Kills", 0);
        dini_IntSet(PlayerFile, "Skin", 300);
        dini_IntSet(PlayerFile, "Madnesswin", 0);
        dini_IntSet(PlayerFile, "Racewin", 0);
        dini_IntSet(PlayerFile, "DuelKills", 0);
        dini_IntSet(PlayerFile, "DuelDeaths", 0);
        dini_IntSet(PlayerFile, "VIP", 0);
       
        SendClientMessage(playerid, mgreen, "* You have succesfully registered, you have been automatically logged in.");
        PlayerInfo[playerid][LoggedIn] = 1;
        OnRequestClass[playerid] = 0;
        SpawnPlayer(playerid);
    }
    format(string,sizeof(string), "Mod Message: %s (ID: %d) has registered.", pName(playerid), playerid);
    SendModMsg(mwhite, string);

return 1;
}

//==============================================================================
//==============================================================================

dcmd_login(playerid, params[])
{
    new PlayerFile[50], Pass[256], plrIP[50] /*pKills*/;
    format(PlayerFile, sizeof(PlayerFile), "/users/%s.ini", pName(playerid));

    if(PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid, mbrightred, "You are already logged in!");
    if(PlayerInfo[playerid][Registered] == 0) return SendClientMessage(playerid, mbrightred, "You are not registered! Use /register to register.");
    if(sscanf(params, "s", Pass)) return SendClientMessage(playerid, mwhite, "Usage: /login [password]");

    Pass = dini_Get(PlayerFile, "Password");

    if(!strcmp(MD5_Hash(params), Pass, true))
    {
        new str[256];
        GetPlayerIp(playerid, plrIP, sizeof(plrIP));
        dini_Set(PlayerFile, "PlayerIP", plrIP);
        SendClientMessage(playerid, mgreen, "* You have been succesfully logged in!");
        PlayerInfo[playerid][LoggedIn] = 1;
        PlayerInfo[playerid][PasswordChangings] = dini_Int(PlayerFile, "PasswordChangings");
        PlayerInfo[playerid][AdminLevel] = dini_Int(PlayerFile, "AdminLevel");
        PlayerInfo[playerid][Kills] = dini_Int(PlayerFile, "Kills");
        PlayerInfo[playerid][Deaths] = dini_Int(PlayerFile, "Deaths");
        PlayerInfo[playerid][Skin] = dini_Int(PlayerFile, "Skin");
        PlayerInfo[playerid][Madnesswin] = dini_Int(PlayerFile, "Madnesswin");
        PlayerInfo[playerid][Racewin] = dini_Int(PlayerFile, "Racewin");
        PlayerInfo[playerid][DuelKills] = dini_Int(PlayerFile, "DuelKills");
        PlayerInfo[playerid][DuelDeaths] = dini_Int(PlayerFile, "DuelDeaths");
        PlayerInfo[playerid][VIP] = dini_Int(PlayerFile, "VIP");
        SetPlayerScore(playerid,PlayerInfo[playerid][Kills]);
        if(PlayerInfo[playerid][Skin] != 300) SetPlayerSkin(playerid,PlayerInfo[playerid][Skin]);
        OnRequestClass[playerid] = 0;
        SpawnPlayer(playerid);
        format(str,sizeof(str), "Mod Message: %s (ID: %d) has logged in.", pName(playerid), playerid);
        SendModMsg(mwhite, str);
    }
    else
    {
        new str[256];
        WrongPassword[playerid]++;

        if(WrongPassword[playerid] >= 3)
        {
            new year, month, day; getdate(year, month, day);
            new hour, minute, second; gettime(hour, minute, second);
            new str2[256], string[256];
            format(str2, sizeof(str2), "* %s has been kicked: Failed to login.", pName(playerid));
            SendClientMessageToAll(COLOR_ORANGE, str2);
            Kick(playerid);
            new File:KickFile = fopen("KickLog.txt", io_append);
            format(string, sizeof string, "[%d/%d/%d]-[%d:%d:%d]: %s has been kicked by the server. [Reason: Entered an invalid password 3 times]\r\n", year, month, day, hour, minute, second, pName(playerid));
            fwrite(KickFile, string);
            fclose(KickFile);
        }

        format(str, sizeof(str), "Invalid password. %d/3 tries left.", WrongPassword[playerid]);
        SendClientMessage(playerid, mbrightred, str);
    }
    return 1;
}
This commands are working on windows loaded pc, but doesn't on linux one. It gives crash. How to fix?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)