SERVER CONSTANTLY Getting frozed
#1

This is wiered because my frend Jayson187 (Owner of SF-GW) Is using my admin system also and his server his freezing from it. Because he use to have Good Ol LuxAdmin and it never'd frozed until i gave Him my adm system.

And samething with me its been freezing for a long time.

Like sometimes the server goes good and out of nowhere. it freezes!. It's something in OnPlayerConnect So here's my whole OnPlayerConnect:


pawn Code:
//TextDrawShowForPlayer(playerid,Sprite0);
    PlayerInfo[playerid][Deaths] = 0;
    PlayerInfo[playerid][Kills] = 0;
    PlayerInfo[playerid][Jailed] = 0;
    PlayerInfo[playerid][Frozen] = 0;
    PlayerInfo[playerid][Level] = 0;
    PlayerInfo[playerid][LoggedIn] = 0;
    PlayerInfo[playerid][Registered] = 0;
    PlayerInfo[playerid][God] = 0;
    PlayerInfo[playerid][GodCar] = 0;
    PlayerInfo[playerid][TimesSpawned] = 0;
    PlayerInfo[playerid][Muted] = 0;
    PlayerInfo[playerid][MuteWarnings] = 0;
    PlayerInfo[playerid][Warnings] = 0;
    PlayerInfo[playerid][Caps] = 0;
    PlayerInfo[playerid][DoorsLocked] = 0;
    PlayerInfo[playerid][pCar] = -1;
    for(new i; i<PING_MAX_EXCEEDS; i++) PlayerInfo[playerid][pPing][i] = 0;
    PlayerInfo[playerid][SpamCount] = 0;
    PlayerInfo[playerid][SpamTime] = 0;
    PlayerInfo[playerid][PingCount] = 0;
    PlayerInfo[playerid][PingTime] = 0;
    PlayerInfo[playerid][FailLogin] = 0;
    PlayerInfo[playerid][ConnectTime] = gettime();
    //------------------------------------------------------
    new PlayerName[MAX_PLAYER_NAME], string[128], str[128], file[256];
    GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
    new tmp3[50]; GetPlayerIp(playerid,tmp3,50);
    //-----------------------------------------------------
    if(ServerInfo[ConnectMessages] == 1)
    {
        new pAKA[256]; pAKA = dini_Get("ladmin/config/aka.txt",tmp3);
        if (strlen(pAKA) < 3) format(str,sizeof(str),"{FB8004} %s (ID:%d) {BDC9BF}has joined the server", PlayerName, playerid);
        else if (!strcmp(pAKA,PlayerName,true)) format(str,sizeof(str),"{FB8004}%s (ID:%d) {BDC9BF}has joined the server", PlayerName, playerid);
        else format(str,sizeof(str),"{FB8004}%s (Id:%d) {BDC9BF}has joined the server {FF0000}(AKA %s)", PlayerName, playerid, pAKA );

        for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && playerid != i)
        {
            if(PlayerInfo[i][Level] > 2) SendClientMessage(i,grey,str);
            else {
                format(string,sizeof(string),"*** %s (%d) has joined the server", PlayerName, playerid);
                SendClientMessage(i,grey,string);
            }
        }
    }
    //-----------------------------------------------------
    if (dUserINT(PlayerName2(playerid)).("banned") == 1)
    {
        SendClientMessage(playerid, red, "This name is banned from this server!");
        format(string,sizeof(string),"%s ID:%d was auto kicked. Reason: Name banned from server",PlayerName,playerid);
        SendClientMessageToAll(grey, string);  print(string);
        SaveToFile("KickLog",string);  Kick(playerid);
    }
    //-----------------------------------------------------
    if(ServerInfo[NameKick] == 1) {
        for(new s = 0; s < BadNameCount; s++) {
            if(!strcmp(BadNames[s],PlayerName,true)) {
                SendClientMessage(playerid,red, "Your name is on our black list, you have been kicked.");
                format(string,sizeof(string),"%s ID:%d was auto kicked. (Reason: Forbidden name)",PlayerName,playerid);
                SendClientMessageToAll(grey, string);  print(string);
                SaveToFile("KickLog",string);  Kick(playerid);
                return 1;
            }
        }
    }
    //-----------------------------------------------------
    if(ServerInfo[PartNameKick] == 1) {
        for(new s = 0; s < BadPartNameCount; s++) {
            new pos;
            while((pos = strfind(PlayerName,BadPartNames[s],true)) != -1) for(new i = pos, j = pos + strlen(BadPartNames[s]); i < j; i++)
            {
                SendClientMessage(playerid,red, "Your name is not allowed on this server, you have been kicked.");
                format(string,sizeof(string),"%s ID:%d was auto kicked. (Reason: Forbidden name)",PlayerName,playerid);
                SendClientMessageToAll(grey, string);  print(string);
                SaveToFile("KickLog",string);  Kick(playerid);
                return 1;
            }
        }
    }
    //-----------------------------------------------------
    if(ServerInfo[Locked] == 1) {
        PlayerInfo[playerid][AllowedIn] = false;
        SendClientMessage(playerid,red,"Server is Locked!  You have 20 seconds to enter the server password before you are kicked!");
        SendClientMessage(playerid,red," Type /password [password]");
        LockKickTimer[playerid] = SetTimerEx("AutoKick", 20000, 0, "i", playerid);
    }
    //-----------------------------------------------------
    if(strlen(dini_Get("ladmin/config/aka.txt", tmp3)) == 0) dini_Set("ladmin/config/aka.txt", tmp3, PlayerName);
    else
    {
        if( strfind( dini_Get("ladmin/config/aka.txt", tmp3), PlayerName, true) == -1 )
        {
            format(string,sizeof(string),"%s,%s", dini_Get("ladmin/config/aka.txt",tmp3), PlayerName);
            dini_Set("ladmin/config/aka.txt", tmp3, string);
        }
    }
    //-----------------------------------------------------
    new dialogstr[256];
    new pame[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pame, sizeof(pame));
    if(!udb_Exists(PlayerName2(playerid))) format(dialogstr,sizeof(dialogstr),"{FFFFFF}%s your nickname isn't registed please choose a password:", pame), ShowPlayerDialog(playerid, 9049, DIALOG_STYLE_INPUT, "{FF0000}Register", dialogstr, "Login", "Im Gay.");
    else
    {
        PlayerInfo[playerid][Registered] = 1;
        format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName));
        new tmp2[256]; tmp2 = dini_Get(file,"ip");
        if( (!strcmp(tmp3,tmp2,true)) && (ServerInfo[AutoLogin] == 1) )
            {
            LoginPlayer(playerid);
            if(PlayerInfo[playerid][Level] > 0)
            {
            PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            GameTextForPlayer(playerid,"~p~Logged In As Admin",4000,3);
            //SendClientMessage(playerid,yellow,"ADMIN UPDATE:T SendClientMessage(playerid,0xFBCA04C8,"-LSGWAdmin-: Please answer all questions from players. Thank you,");
            format(string,sizeof(string),"LSGW: You Have Been AutoMatically Logged In {EE11D8}| Level %d Adminstrator", PlayerInfo[playerid][Level] );
            }
            else SendClientMessage(playerid,green,"LSGW:You Have Been Logged In Succesfully. Welcome Back fool!");
                PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            SendClientMessage(playerid,green,"All your score and cash is back.Go Play! Read /updates every now and then.");
        }
        else format(dialogstr,sizeof(dialogstr),"{FFFFFF}%s This nickname is REGISTERED. Please Login:", pame), ShowPlayerDialog(playerid, 9048, DIALOG_STYLE_INPUT, "{FF0000}Login", dialogstr, "Login");
    }
    return 1;
}
Its somthing in this script..
Reply
#2

Here is an advice to you. Added print("1"); print("2"); ... after some parts of code under OnPlayerConnect. After it gets frozen (it actually crashes) check server_log.txt and see last printed number. Search code for cause under print of that number in script
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)