SA-MP Forums Archive
Server Freezes When Someone Connects [+REP]. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Server Freezes When Someone Connects [+REP]. (/showthread.php?tid=513312)



Server Freezes When Someone Connects [+REP]. - Youssef214 - 15.05.2014

Hello There,So There Is A Problem In My Server That When Someone Joins My Server,Server Totally Gets Freeze,I Cannot Perform Any Command Or Any Text And All Other Players Seems Like They Are Pausing.

Here Codes From PPC_House:
pawn Код:
public OnPlayerConnect(playerid)
{
    // Setup local variables
    new HouseID, HouseSlot, Name[24];

    // Get the player's name
    GetPlayerName(playerid, Name, sizeof(Name));

    // Loop through all houses to find the ones which belong to this player
    for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
    {
        // Check if the house exists
        if (IsValidDynamicPickup(AHouseData[HouseID][PickupID]))
        {
            // Check if the house is owned
            if (AHouseData[HouseID][Owned] == true)
            {
                // Check if the player is the owner of the house
                if (strcmp(AHouseData[HouseID][Owner], Name, false) == 0)
                {
                    // Add the HouseID to the player's account for faster reference later on
                    APlayerData[playerid][Houses][HouseSlot] = HouseID;

                    // Load housecars if they weren't loaded at FilterscriptInit
                    if (LoadCarsDuringFSInit == false)
                        HouseFile_LoadCars(HouseID);

                    // Select the next HouseSlot
                    HouseSlot++;
                }
            }
        }
    }

    return 1;
}
Codes From My GM:
pawn Код:
#define DIALOG_RULES2 12
#define savefolder "/Accounts/%s.ini" // This defines the file name and folder
public OnPlayerConnect(playerid)
{
    new string[64], pName2[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName2,MAX_PLAYER_NAME);
    format(string,sizeof string,"%s (%d) Has Joined The Server.",pName2,playerid);
    GameTextForPlayer(playerid, "Welcome To The Los Santos Gang War Server", 5000, 4);
    ShowPlayerDialog(playerid, DIALOG_RULES2, DIALOG_STYLE_MSGBOX, "Server Rules", "1- No Cheating\n2- No Spamming\n3- Slide Bug Is Not Allowed But C Bug Is Allowed\n4- No Rule Breaking\n5- No G Abuse\n6- No Advertising\n7- Teleport Abuse Is Not Allowed\n8- Weapon Mods Are Allowed Only\n9- Respect Player Especially Admins\n10- Scamming Is Not Allowed\n11- Aimbot Is Not Allowed\n12- Don't Try To Climb Up Over The Freeroam Walls If You Are(not) In Freeroam Mod\n\nDo You Agree The Server Rules?", "Yes", "No");
    SendClientMessageToAll(0xAFAFAFAA,string);
    SendClientMessage(playerid,-1,"Welcome To The {FFEA00}LOS SANTOS GANG WARS{FFFFFF} Version 2.2! Please Enjoy Your Stay.");
    SendClientMessage(playerid,-1,"You Can Listen,Save,Stop,Check Your Favourite Song Or Unsave Your Song By Some Commands For It In /cmds");
    SendClientMessage(playerid, 0x00EEFFFF, "Please Visit Our Forums: lsgangwars.createaforum.com");
    SendClientMessage(playerid, 0x00FF22FF, "When You Spawn A Skin Type /help To See The Help Menu.");
    new pname[128];  // This get's the length of the player name
    new file[128];        // This get's the lenght of the file
    GetPlayerName(playerid, pname, sizeof(pname)); // This get's the player name with the lenght of the player name
    format(file, sizeof(file), savefolder,pname); // This describe's where to save and how to save it
    if(dini_Exists(file)) { // If the file exist
        SetPlayerScore(playerid, dini_Int(file, "Score"));
        SetPlayerMoney(playerid, dini_Int(file, "Money"));
        LPinfo[playerid][Drugs] = dini_Int(file,"Drugs");
        LPinfo[playerid][Adre] = dini_Int(file,"Adrenaline Pills");
        BankMoney[playerid] = dini_Int(file,"BankMoney");
        Favouritesong[playerid] = dini_Int(file,"SongID");
    }
    else {
        dini_Create(file); // Create the file
        dini_IntSet(file, "Score", 0); // Set's "Score"
        dini_IntSet(file, "Money", 0); // Set's "Money"
        dini_IntSet(file, "Drugs", LPinfo[playerid][Drugs]); // Set's "Kills"
        dini_IntSet(file, "Adrenaline Pills", LPinfo[playerid][Adre]); // Set's "Kills"
        dini_IntSet(file, "BankMoney", BankMoney[playerid]); // Set's "Kills"
        dini_IntSet(file, "SongID", Favouritesong[playerid]); // Set's "Kills"
        SetPlayerScore(playerid, dini_Int(file, "Score")); // This describes where to load the score
        SetPlayerMoney(playerid, dini_Int(file, "Money")); // This describes where to load the money
        // the same thing
    } // This get's the length of the player name
    pInfo[playerid][Last] = -1;
    pInfo[playerid][NoPM] = 0;
    PlayerCar[playerid] = -1;
    AntiKillRowSpam[playerid] = 0;
    PlayAudioStreamForPlayer(playerid, "http://s3.argim.net/files/r/gta_san_andreas_theme_song_wmm.mp3");
    return 1;
}
Codes From LuxAdmin:
pawn Код:
public OnFilterScriptInit()
{

    if (!fexist("LuxAdmin/Config/TempBans.ban")){
    new File:open = fopen("LuxAdmin/Config/TempBans.ban",io_write);
    if (open) fclose(open);
    }

    print("\n ___________________________________________________");
    print(" ");
    printf("                   L.A.S %s                         ",LVersion);
    print("                 -------------");
    print("             LuX Administration System               ");
    print(" ___________________________________________________\n");
    print(" -> Loading...");

    CheckFolders();
    UpdateConfig();
    ReadTextDraws();
    LoadCreatedTeles();

    for(new i = 0; i < MAX_PLAYERS; i++)
    if(IsPlayerConnected(i))
    OnPlayerConnect(i);

    for(new i = 1; i < MAX_CHAT_LINES; i++)
    Chat[i] = "[NONE]";

    for(new i = 1; i < MAX_REPORTS; i++)
    Reports[i] = "[NONE]";

    PingTimer = SetTimer("PingKick",5000,1);
    GodTimer = SetTimer("GodModUp",2000,1);
    SetTimer("WeaponCheck",800,true);
    SetTimer("SaveTeleport",CTELE_TIMER,1);
    SetTimer("LuxGpsSys",500,true);

    ShowConfigInConsole();

    new year,month,day;
    getdate(year, month, day);
    new hour,minute,second;
    gettime(hour,minute,second);


    for(new i = 0; i < sizeof(RegisterCommands) ; i++ )
    RegisterCommands[i][CommandLen]=strlen(RegisterCommands[i][sCommand]);


    print(" -> Loaded Successfully!\n");
    printf(" Date: %d/%d/%d - Time: %d:%d:%d",day,month,year,hour, minute, second);
    print(" ___________________________________________________\n");
    return 1;
}
Please Help Me In This Problem. And You Will Get +REP..


Re: Server Freezes When Someone Connects [+REP]. - RenSoprano - 15.05.2014

Show us OnPlayerSpawn


Re: Server Freezes When Someone Connects [+REP]. - Youssef214 - 15.05.2014

on my GM?


Re: Server Freezes When Someone Connects [+REP]. - Youssef214 - 15.05.2014

here if on my GM:
pawn Код:
#define DIALOG_WEAPONS 14
public OnPlayerSpawn(playerid)
{
    switch(pClass[playerid])
    {
        case 0..3:
        {
            SetPlayerColor(playerid, 0x00FF0069);
            if(Invaded[Grove] == 0)
            {
            tCP[Grove] = gTeam[playerid];
            }
        }
        case 4..6:
        {
            SetPlayerColor(playerid, 0xFF00FF96);
            if(Invaded[Ballas] == 0)
            {
            tCP[Ballas] = gTeam[playerid];
            }
        }
        case 7..9:
        {
            SetPlayerColor(playerid, 0xFFFF0096);
            if(Invaded[Vagos] == 0)
            {
            tCP[Vagos] = gTeam[playerid];
            }
        }
        case 10..12:
        {
            SetPlayerColor(playerid, 0x0000FF96);
            if(Invaded[Police] == 0)
            {
            tCP[Police] = gTeam[playerid];
            }
        }
        case 13..16:
        {
            SetPlayerColor(playerid, 0x00FFFF96);
            if(Invaded[Aztecas] == 0)
            {
            tCP[Aztecas] = gTeam[playerid];
            }
        }
    }
    SendClientMessage(playerid,0xFF66FFAA,"Type /help /cmds /rules");
    StopAudioStreamForPlayer(playerid); // Stop the audio stream
    SetPlayerZoneColor(playerid);
    Freemod[playerid] = 0;
    gangwarmod[playerid] = 1;
    drylakemod[playerid] = 0;
    AntiHealthSpam[playerid] = 0;
    IsSongPlaying[playerid] = 0;
    return 1;
}



Re: Server Freezes When Someone Connects [+REP]. - AroseKhanNiazi - 15.05.2014

Youssef you should now make your own admin system lux admin system is outdated
pawn Код:
if(dini_Exists(file)) { // If the file exist
        SetPlayerScore(playerid, dini_Int(file, "Score"));
        SetPlayerMoney(playerid, dini_Int(file, "Money"));
        LPinfo[playerid][Drugs] = dini_Int(file,"Drugs");
        LPinfo[playerid][Adre] = dini_Int(file,"Adrenaline Pills");
        BankMoney[playerid] = dini_Int(file,"BankMoney");
        Favouritesong[playerid] = dini_Int(file,"SongID");
    }
    else {
        dini_Create(file); // Create the file
        dini_IntSet(file, "Score", 0); // Set's "Score"
        dini_IntSet(file, "Money", 0); // Set's "Money"
        dini_IntSet(file, "Drugs", LPinfo[playerid][Drugs]); // Set's "Kills"
        dini_IntSet(file, "Adrenaline Pills", LPinfo[playerid][Adre]); // Set's "Kills"
        dini_IntSet(file, "BankMoney", BankMoney[playerid]); // Set's "Kills"
        dini_IntSet(file, "SongID", Favouritesong[playerid]); // Set's "Kills"
        SetPlayerScore(playerid, dini_Int(file, "Score")); // This describes where to load the score
        SetPlayerMoney(playerid, dini_Int(file, "Money")); // This describes where to load the money
        // the same thing
    } // This get's the length of the player name
why not make it on player register ??
dam i don't know how dini works
try making this all one gamemode or change return 1; to return 0;


Re: Server Freezes When Someone Connects [+REP]. - Youssef214 - 15.05.2014

Wrong codes from LUXADMIN,the correct one is:
pawn Код:
public OnPlayerConnect(playerid)
{
    AccInfo[playerid][Deaths]       = 0;
    AccInfo[playerid][Kills]        = 0;
    AccInfo[playerid][Jailed]       = 0;
    AccInfo[playerid][Frozen]       = 0;
    AccInfo[playerid][Level]        = 0;
    AccInfo[playerid][pVip]         = 0;
    AccInfo[playerid][LoggedIn]     = 0;
    AccInfo[playerid][Registered]   = 0;
    AccInfo[playerid][God]          = 0;
    AccInfo[playerid][GodCar]       = 0;
    AccInfo[playerid][TimesSpawned] = 0;
    AccInfo[playerid][Muted]        = 0;
    AccInfo[playerid][MuteWarnings] = 0;
    AccInfo[playerid][Warnings]     = 0;
    AccInfo[playerid][Caps]         = 0;
    AccInfo[playerid][DoorsLocked]  = 0;
    AccInfo[playerid][pCar]         = -1;
    AccInfo[playerid][SpamCount]    = 0;
    AccInfo[playerid][MaxAdv]       = 0;
    AccInfo[playerid][SpamTime]     = 0;
    AccInfo[playerid][PingCount]    = 0;
    AccInfo[playerid][PingTime]     = 0;
    AccInfo[playerid][FailLogin]    = 0;
    AccInfo[playerid][Hide]         = 0;
    AccInfo[playerid][pInvis]       = 0;
    AccInfo[playerid][pGps]         = -1;

    #if EnableTwoRcon == true
    AccInfo[playerid][MaxRcon] = 0;
    #endif

    AccInfo[playerid][ConnectTime] = gettime();
    for(new i; i<PING_MAX_EXCEEDS; i++)
    AccInfo[playerid][pPing][i] = 0;
    //------------------------------------------------------
    new string[128];
    new str[128];
    new file[256];
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
    new tmp3[50]; GetPlayerIp(playerid,tmp3,50);

    ResetForbiddenWeaponsForPlayer(playerid);
    TempBanCheck(playerid);
//==============================================================================
// Connect Messages
//==============================================================================
    if(ServerInfo[ConnectMessages] == 1)
    {
        new pAKA[256];
        pAKA = dini_Get("LuxAdmin/Config/aka.txt",tmp3);
        if (strlen(pAKA) < 3)
        format(str,sizeof(str),"* Player %s (Id:%d) has joined the server", PlayerName,playerid);
        else if (!strcmp(pAKA,PlayerName,true))
        format(str,sizeof(str),"* Player %s (Id:%d) has joined the server", PlayerName,playerid);
        else format(str,sizeof(str),"Player %s (Id:%d) has joined the server (Aka: %s)",PlayerName,playerid,pAKA);

        for(new i = 0; i < MAX_PLAYERS; i++)
        if(IsPlayerConnected(i) && playerid != i)
        {
        if(AccInfo[i][Level] > 2)
        SendClientMessage(i,grey,str);
        else
        {
        format(string,sizeof(string),"* Player %s (Id:%d) has joined the server", PlayerName, playerid);
        SendClientMessage(i,grey,string);
        }
        }
    }
//==============================================================================
// If PlayerName is Banned
//==============================================================================
    if (dUserINT(PlayerName2(playerid)).("Banned") == 1)
    {
        SendClientMessage(playerid, red, "ATTENTION: This name is banned from this server!");
        format(string,sizeof(string),"|- Player %s (Id:%d) has been Automatically  Kicked. | Reason: Name Banned! -|",PlayerName,playerid);
        SendClientMessageToAll(red, string);  print(string);
        SaveIn("KickLog",string);  Kick(playerid);
    }
//==============================================================================
// Kick Forbidden Name
//==============================================================================
    if(ServerInfo[NameKick] == 1)
    {
        for(new s = 0; s < BlockedNamesCount; s++)
        {
            if(!strcmp(BlockedNames[s],PlayerName,true))
            {
            SendClientMessage(playerid,red, "ATTENTION: Your name is on our Black List, you have been Kicked.");
            format(string,sizeof(string),"|- Player %s (Id:%d) has been Automatically Kicked. | Reason: Forbidden Name -|",PlayerName,playerid);
            SendClientMessageToAll(red, string);
            print(string);
            SaveIn("KickLog",string);
            Kick(playerid);
            return 1;
            }
        }
    }
//==============================================================================
// Kick Forbidden Part of Name
//==============================================================================
    if(ServerInfo[PartNameKick] == 1)
    {
        for(new s = 0; s < BlockedPartNameCount; s++)
        {
            new pos;
            while((pos = strfind(PlayerName,BlockedPartName[s],true)) != -1)
            for(new i = pos, j = pos + strlen(BlockedPartName[s]); i < j; i++)
            {
            SendClientMessage(playerid,red, "ATTENTION: Your name is not Allowed on this server, you have been Kicked!.");
            format(string,sizeof(string),"|- Player %s (Id:%d) has been Automatically Kicked. | Reason: Forbidden Name -|",PlayerName,playerid);
            SendClientMessageToAll(red, string);  print(string);
            SaveIn("KickLog",string);  Kick(playerid);
            return 1;
            }
        }
    }
//==============================================================================
// Server Locked
//==============================================================================
    if(ServerInfo[Locked] == 1)
    {
        AccInfo[playerid][AllowedIn] = false;
        SendClientMessage(playerid,red,"|- Server is Locked! -|");
        SendClientMessage(playerid,red,"|- You have 40 seconds to enter the server Password! -|");
        LockKickTimer[playerid] = SetTimerEx("AutoKick", 40000, 0, "i", playerid);
    }
    if (ServerInfo[Locked] == 1 && AccInfo[playerid][AllowedIn] == false)
    {
        ShowPlayerDialog(playerid, DIALOG_TYPE_SERVPASS, DIALOG_STYLE_INPUT,
        "Server Locked!.", "Enter the password to Access it:", "Access", "Exit");
    }
//==============================================================================
// Register & Login
//==============================================================================
    if(strlen(dini_Get("LuxAdmin/Config/aka.txt", tmp3)) == 0)
    dini_Set("LuxAdmin/Config/aka.txt", tmp3, PlayerName);
    else
    {
        if( strfind( dini_Get("LuxAdmin/Config/aka.txt", tmp3), PlayerName, true) == -1 )
        {
        format(string,sizeof(string),"%s,%s", dini_Get("LuxAdmin/Config/aka.txt",tmp3), PlayerName);
        dini_Set("LuxAdmin/Config/aka.txt", tmp3, string);
        }
    }
    if(!udb_Exists(PlayerName2(playerid)))
    SendClientMessage(playerid,orange, "SERVER: Your account isn't registered. Please register (/"#RegisterCommand" [Password])");
    else
    {
    AccInfo[playerid][Registered] = 1;
    format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(PlayerName));
    new tmp2[256]; tmp2 = dini_Get(file,"Ip");

    if( (!strcmp(tmp3,tmp2,true)) && (ServerInfo[AutoLogin] == 1))
    {
        LoginPlayer(playerid);
        if(AccInfo[playerid][Level] > 0)
        {
            switch(AccInfo[playerid][Level])
            {
                case 1: AdmRank = "Basic Moderator";
                case 2: AdmRank = "Moderator";
                case 3: AdmRank = "Master Moderator";
                case 4: AdmRank = "Administrator";
                case 5: AdmRank = "Master Administrator";
                case 6: AdmRank = "Professional Admin";
                case 7: AdmRank = "Trusted Admin";
                case 8: AdmRank = "Perfect Admin";
                case 9: AdmRank = "Co-Owner";
                case 10: AdmRank = "Owner";
            }

//==============================================================================
// VIP System
//==============================================================================
            if(AccInfo[playerid][pVip] > 0)
            {
                switch(AccInfo[playerid][pVip])
                {
                    case 1: AccType = "Silver";
                    case 2: AccType = "Gold";
                    case 3: AccType = "Premium";
                }
                format(string,sizeof(string),"|- You have been Automatically Logged in | Account: %s | Level %d - %s -|", AccType, AccInfo[playerid][Level],AdmRank);
                SendClientMessage(playerid,0x00C378AA,string);
            }
            else
            {
                format(string,sizeof(string),"|- You have been Automatically Logged in | Level %d - %s -|", AccInfo[playerid][Level],AdmRank);
                SendClientMessage(playerid,green,string);
            }
//==============================================================================
        }
        else
        {
            if(AccInfo[playerid][pVip] > 0)
            {
                switch(AccInfo[playerid][pVip])
                {
                    case 1: AccType = "Silver";
                    case 2: AccType = "Gold";
                    case 3: AccType = "Premium";
                }
                format(string,sizeof(string),"|- You have been Automatically Logged in - Account Type: %s", AccType);
                SendClientMessage(playerid,0x00C896AA,string);
            }
            else
            {
                format(string,sizeof(string),"|- You have been Automatically Logged in");
                SendClientMessage(playerid,green,string);
            }
        }
    }
    else SendClientMessage(playerid, white, "That account is registered!") &&
    SendClientMessage(playerid, orange, "Please login to access your Account (/"#LoginCommand" [Password])");
    }
    return 1;
}



Re: Server Freezes When Someone Connects [+REP]. - Youssef214 - 15.05.2014

BUMP


Re: Server Freezes When Someone Connects [+REP]. - Youssef214 - 15.05.2014

BUMP


Re: Server Freezes When Someone Connects [+REP]. - rymax99 - 15.05.2014

Stop bumping your topic every hour.

Read the rules here: http://forum.sa-mp.com/announcement.php?f=12


Re: Server Freezes When Someone Connects [+REP]. - Sasino97 - 15.05.2014

Probably you're missing "return 1;" in "OnPlayerUpdate()"