Server keeps restarting.
#1

- So my problem is when i enter my server and enter my password then the server restarts, without giving any error in the log files.

Creating an account is possible, but login in not, can't find the problem.

- on my localhost (linux ubuntu) i don't have this problem.
- on the Hosted server (linux, ubuntu) i have this error.

between LoadCharacters and OnLoadCharacters its going wrong i think but i can't find it.

Here is the code:

pawn Code:
public OnPlayerLogin(playerid) {
    new msg[128],ip[16];
    new acctotal = numPlayersOnAcc(playerid);
    if(acctotal > 0) {
        format(msg, sizeof(msg), "* AdmWarn: %s[%s] has logged in multiple times from the same account.",GetPlayerNameEx(playerid, ENameType_CharName),GetPlayerNameEx(playerid, ENameType_AccountName));
        ABroadcast(X11_YELLOW, msg, EAdminFlags_All);
        KickEx(playerid, "Logging in multiple times from the same IP");
        DeletePVar(playerid, "LoggedIn");
        sendMsgToAccID(GetPVarInt(playerid, "AccountID"), X11_TOMATO_2, "* Warning: Someone has successfully logged into your account while you were online. Consider changing your password.");
        return 1;
    }
    new total;
    GetPlayerIpEx(playerid, ip, sizeof(ip));
    if((total = numPlayersOnIp(ip)) > 1) {
        format(msg, sizeof(msg), "* AdmWarn: %s[%d] has logged in %d times from the same IP(%s).",GetPlayerNameEx(playerid, ENameType_CharName),playerid,total,ip);
        ABroadcast(X11_YELLOW, msg, EAdminFlags_All);
    }
    SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 998);
    SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 999);
    SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, 999);
    SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, 999);
    SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
    SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 999);
    SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
    SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, 999);
    SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 999);
    SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, 999);
    SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, 999);
    SetPVarInt(playerid, "AccountLoginTime", gettime());
    LoadCharacters(playerid, true);
    format(msg, sizeof(msg), "Welcome %s!",GetPlayerNameEx(playerid, ENameType_AccountName));
    SendClientMessage(playerid, X11_ORANGE, msg);  
   
    format(query, sizeof(query), "SELECT `flags`,`adminflags`,(`host`&`mask`)=(INET_ATON(\"%s\")&`mask`) FROM `loginflags` WHERE (`host`&`mask`)=(INET_ATON(\"%s\")&`mask`) OR (`accountid` = %d) order by 3 desc",ip,ip,GetPVarInt(playerid, "AccountID"));
    mysql_function_query(g_mysql_handle, query, true, "OnLoadIPFlags", "dd", playerid,0);
    return 1;
}

LoadCharacters(playerid, bool:showdialog) {
    #pragma unused showdialog
    query[0] = 0;//[128];
    new accountid = GetPVarInt(playerid,"AccountID");
    if(accountid == 0) {
        return 0;
    }
    format(query, sizeof(query),"SELECT `username`,`id` FROM `characters` WHERE `accountid` = %d",accountid);
    mysql_function_query(g_mysql_handle, query, true, "OnLoadCharacters", "d", playerid);
    return 1;
}

public OnLoadCharacters(playerid) {
    new rows,fields;
    cache_get_data(rows,fields);
    SetPVarInt(playerid, "NumCharacters", rows);
    new pvarname[32];
    new fielddata[64];
    new charid;
    for(new i=0;i<rows;i++) {
        cache_get_row(i,0,fielddata);
        format(pvarname,sizeof(pvarname),"CharUsername%d",i);
        SetPVarString(playerid,pvarname,fielddata);
        format(pvarname,sizeof(pvarname),"CharID%d",i);
        cache_get_row(i,1,fielddata);
        charid = strval(fielddata);
        SetPVarInt(playerid,pvarname,charid);
    }
    ShowCharacterDialog(playerid);
    return 1;
}

ShowCharacterDialog(playerid) {
    dialogstr[0] = 0;
    tempstr[0] = 0;
    new charname[MAX_PLAYER_NAME];
    new pvarname[32];
    new numchars = GetPVarInt(playerid,"NumCharacters");
    for(new i=0;i<numchars;i++) {
        format(pvarname,sizeof(pvarname),"CharUsername%d",i);
        GetPVarString(playerid,pvarname,charname,sizeof(charname));
        format(tempstr,sizeof(tempstr),"%s\n",charname);
        strcat(dialogstr,tempstr,sizeof(dialogstr));
    }
    if(numchars <= 5) {
        strcat(dialogstr,"Create Character",sizeof(dialogstr));
    }
    ShowPlayerDialog(playerid, _:EAccountDialog_ChooseCharacter, DIALOG_STYLE_LIST, "Choose your character",dialogstr,"Select", "Quit");
    return 0;
}
Reply
#2

Check your server log.
Reply
#3

Theare are no erors in the log just that i connect the server and that ir restarts thats all.
Reply
#4

Now i get this from the logs with crashdetect plugin:


Code:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3z-R3, ©2005-2014 SA-MP Team

[22:24:32] filterscripts = ""  (string)
[22:24:32] 
[22:24:32] Server Plugins
[22:24:32] --------------
[22:24:32]  Loading plugin: crashdetect.so
[22:24:32]   CrashDetect v4.15.1 is OK.
[22:24:32]   Loaded.
[22:24:32]  Loading plugin: streamer.so
[22:24:32] 

*** Streamer Plugin v2.7.5 by Incognito loaded ***

[22:24:32]   Loaded.
[22:24:32]  Loading plugin: sscanf.so
[22:24:32] 

[22:24:32]  ===============================

[22:24:32]       sscanf plugin loaded.     

[22:24:32]          Version:  2.8.1        

[22:24:32]    © 2012 Alex "Y_Less" Cole  

[22:24:32]  ===============================

[22:24:32]   Loaded.
[22:24:32]  Loading plugin: mysql_static.so
[22:24:32] plugin.mysql: R20 successfully loaded.
[22:24:32]   Loaded.
[22:24:32]  Loading plugin: dns.so
[22:24:32] 

*** DNS Plugin v2.4 by Incognito loaded ***

[22:24:32]   Loaded.
[22:24:32]  Loading plugin: Whirlpool.so
[22:24:32]  
[22:24:32]  ==================
[22:24:32]  
[22:24:32]   Whirlpool loaded
[22:24:32]  
[22:24:32]  ==================
[22:24:32]  
[22:24:32]   Loaded.
[22:24:32]  Loading plugin: nativechecker.so
[22:24:32]   Loaded.
[22:24:32]  Loaded 7 plugins.

[22:24:32] 
[22:24:32] Filterscripts
[22:24:32] ---------------
[22:24:32]   Loaded 0 filterscripts.

[22:24:32]  
[22:24:32]  
[22:24:32]  
[22:24:32]  ======================================= 
[22:24:32]  |                                     | 
[22:24:32]  |        YSI version 3.09.0684        | 
[22:24:32]  |        By Alex "Y_Less" Cole        | 
[22:24:32]  |                                     | 
[22:24:32]  ======================================= 
[22:24:32]  
[22:24:32]  
[22:24:32]  
[22:24:33] Number of vehicle models: 0
[22:24:33] HTTP[0:version.ysi.tl/index.php?c=2&v=3.09.0684:1] normal termination.
[22:24:33] Number of businesses: 0

[22:24:33] Businesses loaded.

[22:25:25] Incoming connection: 84.192.251.90:50291
[22:25:26] [join] Thomas has joined the server (0:84.192.251.90)
[22:26:30] [debug] Server crashed while executing LS-RP.amx
[22:26:30] [debug] AMX backtrace:
[22:26:30] [debug] #0 00000004 in public OnLoginAttempt (playerid=0) at <unknown file>:0
[22:26:30] [debug] Native backtrace:
[22:26:30] [debug] #0 f7454e8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[22:26:30] [debug] #1 f744dbcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[22:26:30] [debug] #2 f744edbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[22:26:30] [debug] #3 f744f226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[22:26:30] [debug] #4 f7454adc in ?? () from plugins/crashdetect.so
[22:26:30] [debug] #5 f7785410 in ?? ()
This is the OnLoginAttempt:
pawn Code:
public OnLoginAttempt(playerid) {
   
print("onLoginAttempt");
    new rows,fields;
    cache_get_data(rows,fields);
    new loginattempts = GetPVarInt(playerid,"LoginAttempts");
    new msg[128];
    if(rows < 1) {
        loginattempts++;
        if((MAX_LOGIN_ATTEMPTS-loginattempts) <= 0) {
            SendClientMessage(playerid, X11_RED,"You have been kicked for entering the incorrect password.");
            Kick(playerid);
        }
        SetPVarInt(playerid,"LoginAttempts",loginattempts);
        format(msg,sizeof(msg),"[ERROR]: Incorrect password. You have %d more attempts before you will be kicked.",MAX_LOGIN_ATTEMPTS-loginattempts);
        SendClientMessage(playerid, X11_WHITE, msg);
        ShowLoginDialog(playerid);
        return 1;
    }
    SendClientMessage(playerid, X11_ORANGE,"Successful login!");
    new alevel, id_string[32];
    cache_get_row(0,0,id_string);
    //`adminlevel`,`newbrank`,`connecttime`,`admintitle`
    alevel = strval(id_string);
    cache_get_row(0,1,id_string);
    SetPVarInt(playerid, "NewbieRank", strval(id_string));
    cache_get_row(0,2,id_string);
    SetPVarInt(playerid, "ConnectTime", strval(id_string));
    cache_get_row(0,3,id_string);
    SetPVarString(playerid, "AdminTitle", id_string);
    if(alevel != 0) {
        format(msg,sizeof(msg),"You are logged in as a %s!",id_string);
        SendClientMessage(playerid, X11_WHITE, msg);
        SetPVarInt(playerid,"AdminFlags",alevel);
    }
    cache_get_row(0,1,id_string);
    alevel = strval(id_string);
    if(alevel != 0) {
        SetPVarInt(playerid,"NewbieRank",alevel);
        format(msg,sizeof(msg),"You are logged in as a %s",GetNewbieName(playerid));
        SendClientMessage(playerid, X11_WHITE, msg);
    }
    if(GetPVarInt(playerid, "AdminFlags") != 0 || GetPVarInt(playerid, "NewbieRank") != 0) {
        adminOnPlayerLogin(playerid);
    }
    cache_get_row(0,4,id_string);
    alevel = strval(id_string);
    SetPVarInt(playerid, "DonatePoints", alevel);
   
    cache_get_row(0,5,id_string);
    alevel = strval(id_string);
    SetPVarInt(playerid, "DonateRank", alevel);
   
    cache_get_row(0,6,id_string);
    alevel = strval(id_string);
    SetPVarInt(playerid, "Cookies", alevel);
   
    cache_get_row(0,7,id_string);
    alevel = strval(id_string);
    if(alevel > 0) {
        SetTimerEx("AJail",1000, false, "dds", playerid, alevel, "AJailed");
    }
   
    cache_get_row(0,8,id_string);
    SetPVarInt(playerid, "NMuteTime", strval(id_string)+gettime());
   
    cache_get_row(0,9,id_string);
    SetPVarInt(playerid, "MuteTime", strval(id_string)+gettime());
   
    cache_get_row(0,10,id_string);
    SetPVarInt(playerid, "ReportBanned", strval(id_string));
   
    cache_get_row(0,11,id_string);
    SetPVarInt(playerid, "AccountFlags", strval(id_string));

    cache_get_row(0,12,id_string);
    SetPVarInt(playerid, "NumAJails", strval(id_string));
   
    cache_get_row(0,13,id_string);
    SetPVarInt(playerid, "NumKicks", strval(id_string));
   
    cache_get_row(0,14,id_string);
    SetPVarInt(playerid, "NumBans", strval(id_string));
   
    cache_get_row(0,15,id_string);
    new hideval = strval(id_string);

    if(hideval != 0)
        SetPVarInt(playerid, "AdminHidden", hideval);
   
    OnPlayerLogin(playerid);
    return 1;
}
Reply
#5

This is a streamer problem. Try to change your streamer.so or streamer.dll ... I thought so you are using MAC OS becuz this issue mostly occur in CENTOS
Reply
#6

I swear your using a null string everywhere

new alevel, id_string[32];
cache_get_row(0,0,id_string);

??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)