Server stucks at Joining the game ...
#1

Hello,
I have a new problem that when some players come in server server stucks.
I searched for the problem and I found the problem at OnPlayerSpawn.
pawn Код:
public OnPlayerSpawn(playerid)
{


    IfPlayerInDuelStadium[playerid] = 0;
    IsPlayerInEvent[playerid] = 0;
    dueling[playerid] = 0;
    CapSpree[playerid]=0;
    GasMask[playerid] = 0;
    Streak[playerid] = 0;
    Spawnedw[playerid]=true;

    TextDrawShowForPlayer(playerid, Rank1[playerid]);
    new str[200];
    format(str, sizeof(str),"~W~Emtiaz: ~y~%d~n~~b~K: ~y~%d ~r~M: ~y~%d", GetPlayerScore(playerid),PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths]);
    TextDrawSetString(Rank1[playerid], str);

    PlayerPlaySound(playerid, 1184, 2127.2194,2368.6323,10.8203);
    setskin(playerid);
    UpdateStars(playerid);
    SetPlayerTeam(playerid, PlayerInfo[playerid][pTeam]);
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerInterior(playerid, 0);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapons(playerid);
    TextDrawShowForPlayer(playerid, Web);
    TextDrawShowForPlayer(playerid, TeamText[playerid]);
    UpdateLabelText(playerid);
    UpdateTextdraw(playerid);

    if(firstspawn[playerid] == 0)
    {
        firstspawn[playerid] = 1;
    }

    if(Synching[playerid] == true)
    {
        Synching[playerid] = false;
        SetPlayerHealth(playerid,sHP[playerid]);
        SetPlayerArmour(playerid,sAP[playerid]);
        SetPlayerPos(playerid,sPos[playerid][0],sPos[playerid][1],sPos[playerid][2]);
        setskin(playerid);
        SendClientMessage(playerid,green,"*HamgamSazi Ba Server Anjam Shod.");
        ResetPlayerWeapons(playerid);
        for(new slot; slot < 13; slot ++)
        {
            GivePlayerWeaponEx(playerid,sWeap[playerid][slot],sAmmo[playerid][slot]);
        }
        return 1;
    }

    if(fclass[playerid] == 0 && PlayerInfo[playerid][OnDuty] == 0)
    {
        SetPlayerHealth(playerid, 99999.0);
        SetTimerEx("SpawnProtection", 10000, false, "i", playerid);
        SendClientMessage(playerid, red, "*Hefazat Az Shoma Baraye 10 Sanie Shoro Shod!");
        AntiSK[playerid] = 1;
    }
    if(fclass[playerid] == 0 && PlayerInfo[playerid][OnDuty] == 0){
        TogglePlayerControllable(playerid, 0);
        SetTimerEx("HackCheck", 4000, 0, "i", playerid);
        SendClientMessage(playerid, -1, "Dar Hale Pardazesh... Lotfan Sabr Konid...");
    }





    for (new i=1;i<MAX_TEAMS;i++)
    {
        TextDrawHideForPlayer(playerid,gTeam[i][tClassText]);
    }


    if(PlayerInfo[playerid][pTeam] != TEAM_SHOORESH && fclass[playerid] == 1)
    {
        SendClientMessage(playerid, -1,"Class "COL_CYAN"Khod"COL_WHITE" Ra "COL_RED"Entekhab"COL_WHITE" Konid.");
        fclass[playerid] = 0;
        AntiSK[playerid] = 0;
        ShowClassDialog(playerid);
    }

    if(!IsPlayerAnimsPreloaded[playerid])
    {
        AnimPreloadForPlayer(playerid,
           "BOMBER");
        AnimPreloadForPlayer(playerid,
           "RAPPING");
        AnimPreloadForPlayer(playerid,
            "SHOP");
        AnimPreloadForPlayer(playerid,
           "BEACH");
        AnimPreloadForPlayer(playerid,
           "SMOKING");
        AnimPreloadForPlayer(playerid,
            "FOOD");
        AnimPreloadForPlayer(playerid,
            "ON_LOOKERS");
        AnimPreloadForPlayer(playerid,
            "DEALER");
        AnimPreloadForPlayer(playerid,
            "CRACK");
        AnimPreloadForPlayer(playerid,
            "CARRY");
        AnimPreloadForPlayer(playerid,
            "COP_AMBIENT");
        AnimPreloadForPlayer(playerid,
            "PARK");
        AnimPreloadForPlayer(playerid,
            "INT_HOUSE");
        AnimPreloadForPlayer(playerid,
            "FOOD");
        AnimPreloadForPlayer(playerid,
            "ped");
        AnimPreloadForPlayer(playerid,
            "SWEET");
        AnimPreloadForPlayer(playerid,
            "BAR");
        AnimPreloadForPlayer(playerid,
            "PAULNMAC");
        AnimPreloadForPlayer(playerid,
            "KISSING");
        AnimPreloadForPlayer(playerid,
            "BLOWJOBZ");
        AnimPreloadForPlayer(playerid,
            "STRIP");
        AnimPreloadForPlayer(playerid,
            "SWORD");
        AnimPreloadForPlayer(playerid,
            "POLICE");
        IsPlayerAnimsPreloaded[playerid] = 1;

    }

    if(PlayerInfo[playerid][Frozen] == 1) {
        TogglePlayerControllable(playerid,false); return SendClientMessage(playerid,red,"Shoma Az Mojazat Khod Nemitavanid Farar Konid. Shoma Hanooz Freeze Hastid.");
    }

    if(GetPVarInt(playerid, "Jailed") == 1) {
        TogglePlayerControllable(playerid,true);
        SetPlayerPos(playerid,197.6661,173.8179,1003.0234);
        SetPlayerInterior(playerid,3);
    }

    if(PlayerInfo[playerid][OnDuty] == 1)
    {
        SetPlayerHealth(playerid, 99999);
        SetPlayerColor(playerid,0xF600F6FF);
        GivePlayerWeaponEx(playerid, 38, 999999);
        SetPlayerSkin(playerid, 217);
        AntiSK[playerid] = 0;
    }
   
    new spawnid;
    do spawnid=random(gSpawns);
    while (gSpawn[spawnid][spTeam]!=PlayerInfo[playerid][pTeam]);
    SetPlayerPos(playerid,gSpawn[spawnid][spX],gSpawn[spawnid][spY],gSpawn[spawnid][spZ]);
    SetPlayerFacingAngle(playerid,gSpawn[spawnid][spA]);
    SetPlayerColor(playerid,gTeam[PlayerInfo[playerid][pTeam]][tColor]);

    return 1;
}
I commented all the codes of OnPlayerSpawn and I tried to check them One-By-One and separate.
The problem was at
pawn Код:
new spawnid;
    do spawnid=random(gSpawns);
    while (gSpawn[spawnid][spTeam]!=PlayerInfo[playerid][pTeam]);
    SetPlayerPos(playerid,gSpawn[spawnid][spX],gSpawn[spawnid][spY],gSpawn[spawnid][spZ]);
    SetPlayerFacingAngle(playerid,gSpawn[spawnid][spA]);
    SetPlayerColor(playerid,gTeam[PlayerInfo[playerid][pTeam]][tColor]);
that when I add it, it tries to crash server.
I need help about it

Regards.
Reply


Messages In This Thread
Server stucks at Joining the game ... - by MehranGta - 18.07.2014, 06:24
Re: Server stucks at Joining the game ... - by linuxthefish - 18.07.2014, 06:27
Re: Server stucks at Joining the game ... - by MehranGta - 18.07.2014, 06:34
Re: Server stucks at Joining the game ... - by KubiPL - 18.07.2014, 07:18
Re: Server stucks at Joining the game ... - by MehranGta - 18.07.2014, 08:04

Forum Jump:


Users browsing this thread: 1 Guest(s)