Problem disconnect..
#1

I have a big enough problem..a roleplay GM (gf edit) get on the server I play when a player disconnects .. server fails. What is the problem?
Reply
#2

send us the code you have at "OnPlayerDisconnect"... it might be a mistake in it that crashes the server
Reply
#3

Quote:
Originally Posted by Sascha
Посмотреть сообщение
send us the code you have at "OnPlayerDisconnect"... it might be a mistake in it that crashes the server
pawn Код:
public OnPlayerDisconnect(playerid)
{
    if(IsPlayerNPC(playerid) != 1)
    {
        gActivePlayers[playerid]--;
        numplayers--;
        PlayerInfo[playerid][pAdjustable] = 1;
        OnPlayerUpdate(playerid);
        SaveWeaponsToFile(playerid);
        if(PlayerInfo[playerid][pMember] >= 1 || PlayerInfo[playerid][pLeader] >= 1)
        {
            PlayerInfo[playerid][pFacTime] = 1;
        }
        if(Searching[playerid] == 1)
        {
        Searching[playerid] = 0;
        }
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(TaxiAccepted[i] < 999)
                {
                    if(TaxiAccepted[i] == playerid)
                    {
                        TaxiAccepted[i] = 999;
                        GameTextForPlayer(i, "~w~Taxi Caller~n~~r~Left the game", 5000, 1);
                        TaxiCallTime[i] = 0;
                        DisablePlayerCheckpoint(i);
                    }
                }
                else if(BusAccepted[i] < 999)
                {
                    if(BusAccepted[i] == playerid)
                    {
                        BusAccepted[i] = 999;
                        GameTextForPlayer(i, "~w~Bus Caller~n~~r~Left the game", 5000, 1);
                        BusCallTime[i] = 0;
                        DisablePlayerCheckpoint(i);
                    }
                }
            }
        }
        if(GettingCK[playerid] < 999)
        {
            if(IsPlayerConnected(GettingCK[playerid]))
            {
                SendClientMessage(GettingCK[playerid], COLOR_YELLOW, "Your Character Kill has left the server, try again later.");
                OnCK[GettingCK[playerid]] = 999;
            }
        }
        if(TransportCost[playerid] > 0 && TransportDriver[playerid] < 999)
        {
            if(IsPlayerConnected(TransportDriver[playerid]))
            {
                new string[64];
                TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
                TransportTime[TransportDriver[playerid]] = 0;
                TransportCost[TransportDriver[playerid]] = 0;
                format(string, sizeof(string), "~w~Passenger left~n~~g~Earned $%d",TransportCost[playerid]);
                GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
            }
        }
        if(GotHit[playerid] > 0)
        {
            if(GetChased[playerid] < 999)
            {
                if(IsPlayerConnected(GetChased[playerid]))
                {
                    SendClientMessage(GetChased[playerid], COLOR_YELLOW, "Your Hit has left the server.");
                    GoChase[GetChased[playerid]] = 999;
                }
            }
        }
        //TextDrawDestroy(Textdraw64[playerid]);
        if(PlayerPaintballing[playerid] != 0)
        {
            PaintballPlayers --;
        }
        if(PlayerKarting[playerid] > 0 && PlayerInKart[playerid] > 0)
        {
            KartingPlayers --;
        }
        if(PlayersChannel[playerid] < 999)
        {
            IRCInfo[PlayersChannel[playerid]][iPlayers] -= 1;
        }
        if(HireCar[playerid] != 299)
        {
            gLastDriver[HireCar[playerid]] = 300;
            gCarLock[HireCar[playerid]] = 0;
            UnLockCar(HireCar[playerid]);
        }
        if (gLastCar[playerid] > 0)
        {
            gLastDriver[gLastCar[playerid]] = 300;
            if(PlayerInfo[playerid][pPhousekey] != gLastCar[playerid]-1)
            {
                gCarLock[gLastCar[playerid]] = 0;
                UnLockCar(gLastCar[playerid]);
            }
        }
        if(PlayerBoxing[playerid] > 0)
        {
            if(Boxer1 == playerid)
            {
                if(IsPlayerConnected(Boxer2))
                {
                    PlayerBoxing[Boxer2] = 0;
                    SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
                    SetPlayerInterior(Boxer2, 5);
                    GameTextForPlayer(Boxer2, "~r~Match interupted", 5000, 1);
                }
            }
            else if(Boxer2 == playerid)
            {
                if(IsPlayerConnected(Boxer1))
                {
                    PlayerBoxing[Boxer1] = 0;
                    SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
                    SetPlayerInterior(Boxer1, 5);
                    GameTextForPlayer(Boxer1, "~r~Match interupted", 5000, 1);
                }
            }
            InRing = 0;
            RoundStarted = 0;
            Boxer1 = 255;
            Boxer2 = 255;
            TBoxer = 255;
        }
        if(TransportDuty[playerid] == 1)
        {
            TaxiDrivers -= 1;
        }
        else if(TransportDuty[playerid] == 2)
        {
            BusDrivers -= 1;
        }
        if(PlayerInfo[playerid][pJob] == 11)
        {
            if(JobDuty[playerid] == 1) { Medics -= 1; }
        }
        /*else if(PlayerInfo[playerid][pJob] == 7)
        {
            if(JobDuty[playerid] == 1) { Mechanics -= 1; }
        }*/

    }
    return 1;
}
Reply
#4

Help me..please
Reply
#5

Do you know how to make BOdyguard NPC

Reply
#6

Debug your code or use Crash Detector plugin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)