[Ajuda] Salvar administrador ~
#4

verdade ... nгo tinha pensado nisso ainda e a ъnica coisa no onPlayerDisconnect sobre admin й a msg quando sai .

code abaixo
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    RemovePlayerAttachedObject(playerid,3);
    RemovePlayerAttachedObject(playerid, 3);
    DisablePlayerCheckpoint(playerid);
    TextDrawDestroy(Text:FilaAtendimentoText[playerid]);
    TextDrawDestroy(Text:TempoAtendimento2Text[playerid]);
    KillTimer(timer[playerid]);
    FilaAtendimento[playerid] = 999;
    TempoAtendimento2[playerid] = 0;
    OnPlayerSave(playerid);
    KillTimer(tempotd[playerid]);
    new caller = Mobile[playerid];
    OnPlayerSave(playerid);
    if(usandolavacarro == playerid)
    {
        SetVehicleToRespawn(GetPlayerVehicleID(playerid));
        usandolavacarro = -1;
        Update3DTextLabelText(textoentrada, COR_AZULZAO, "Ninguйm estб usando o Lava Rбpido agora, o preзo й de R$ 20,00\n(/lavarcarro)");
    }
    if(caller != 255)
    {
        if(caller < 255)
        {
            SendClientMessage(caller,  COLOR_GRAD2, "A ligaзгo caiu...");
            CellTime[caller] = 0;
            CellTime[playerid] = 0;
            Mobile[caller] = 255;
        }
        Mobile[playerid] = 255;
        CellTime[playerid] = 0;
    }
    if(HireCar[playerid] > 0)
    {
        VTrancado[HireCar[playerid]] = 0;
        UnLockCar(HireCar[playerid]);
        SetVehicleToRespawn(HireCar[playerid]);
        HireCar[playerid] = 0;
    }
    if (PlayerInfo[playerid][pBarraca] != 0)
    {
        RemoveBarraca(playerid);
    }
    if (PlayerInfo[playerid][pParedao] != 0)
    {
        RemoveParedao(playerid);
    }
    if(pRoadblock[playerid] != 0)
    {
        RemoveRoadblock(playerid);
    }
    if(SpikeInfo[playerid][sCreated] != 0)
    {
        RemoveRoadPregos(playerid);
    }
    if(pRoadCones[playerid] != 0)
    {
        RemoveRoadCones(playerid);
    }
    switch(reason)
    {
        case 0: format(gstring, sizeof(gstring), "%s saiu do Servidor por erro de conexгo ou crash.", PlayerName(playerid));
        case 1: format(gstring, sizeof(gstring), "%s saiu por vontade propria.", PlayerName(playerid));
        case 2: format(gstring, sizeof(gstring), "%s Saiu do servidor kickado ou banido.", PlayerName(playerid));
    }
    ProxDetector(100.0, playerid, gstring,COLOR_LIGHTBLUE,COLOR_LIGHTBLUE,COLOR_LIGHTBLUE,COLOR_LIGHTBLUE,COLOR_LIGHTBLUE);
    gActivePlayers[playerid]--;
    numplayers--;
    if(MudarSenhaAceito[playerid] == 1)
    {
        MudarSenhaAceito[playerid] = 0;
    }
    if(MudarNickAceito[playerid] == 1)
    {
        MudarNickAceito[playerid] = 0;
    }
    if(ProvocoCasarao[playerid] == 1)
    {
        GangZoneStopFlashForAll(GZCasarao);
        GangZoneShowForAll(GZCasarao, 0xFFFFFF96);
        GuerranoCasarao = 0;
        ProvocoCasarao[playerid] = 0;
        donocasarao = 0;
        Dominando[playerid] = 0;
        KillTimer(TempoGuerraCasarao);
    }
    if(ProvocoEstacao[playerid] == 1)
    {
        GangZoneStopFlashForAll(GZEstacao);
        GangZoneShowForAll(GZEstacao, 0xFFFFFF96);
        GuerranaEstacao = 0;
        ProvocoEstacao[playerid] = 0;
        donoestacao = 0;
        Dominando[playerid] = 0;
        KillTimer(TempoGuerraEstacao);
    }
    if(ProvocoFavela[playerid] == 1)
    {
        GangZoneStopFlashForAll(GZFavela);
        GangZoneShowForAll(GZFavela, 0xFFFFFF96);
        GuerranaFavela = 0;
        ProvocoFavela[playerid] = 0;
        donoFavela = 0;
        Dominando[playerid] = 0;
        KillTimer(TempoGuerraFavela);
    }
    if(ProvocoSkate[playerid] == 1)
    {
        GangZoneStopFlashForAll(GZSkate);
        GangZoneShowForAll(GZSkate, 0xFFFFFF96);
        GuerranoSkate = 0;
        ProvocoSkate[playerid] = 0;
        donoskate = 0;
        Dominando[playerid] = 0;
        KillTimer(TempoGuerraSkate);
    }
    if(ProvocoAero[playerid] == 1)
    {
        GangZoneStopFlashForAll(GZAero);
        GangZoneShowForAll(GZAero, 0xFFFFFF96);
        GuerranoAero = 0;
        ProvocoAero[playerid] = 0;
        donoaero = 0;
        Dominando[playerid] = 0;
        KillTimer(TempoGuerraAero);
    }
    if(ProvocoPark[playerid] == 1)
    {
        GangZoneStopFlashForAll(GZPark);
        GangZoneShowForAll(GZPark, 0xFFFFFF96);
        GuerranoPark = 0;
        ProvocoPark[playerid] = 0;
        donopark = 0;
        Dominando[playerid] = 0;
        KillTimer(TempoGuerraPark);
    }

    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~O Cliente~n~~r~Saiu do jogo", 5000, 1);
                    TaxiCallTime[i] = 0;
                    DisablePlayerCheckpoint(i);
                }
            }
            else if(CopsrondaAccepted[i] < 999)
            {
                if(CopsrondaAccepted[i] == playerid)
                {
                    CopsrondaAccepted[i] = 999;
                    GameTextForPlayer(i, "~w~Policial o player~n~~r~Deixou o jogo", 5000, 1);
                    CopsrondaCallTime[i] = 0;
                    DisablePlayerCheckpoint(i);
                }
            }
            else if(MedicAccepted[i] < 999)
            {
                if(MedicAccepted[i] == playerid)
                {
                    MedicAccepted[i] = 999;
                    GameTextForPlayer(i, "~w~O Cliente~n~~r~Saiu do jogo", 5000, 1);
                    MedicCallTime[i] = 0;
                    DisablePlayerCheckpoint(i);
                }
            }
            else if(MechanicAccepted[i] < 999)
            {
                if(MechanicAccepted[i] == playerid)
                {
                    MechanicAccepted[i] = 999;
                    GameTextForPlayer(i, "~w~O Cliente~n~~r~Saiu do jogo", 5000, 1);
                    MechanicCallTime[i] = 0;
                    DisablePlayerCheckpoint(i);
                }
            }
            else if(BusAccepted[i] < 999)
            {
                if(BusAccepted[i] == playerid)
                {
                    BusAccepted[i] = 999;
                    GameTextForPlayer(i, "~w~O Cliente~n~~r~Saiu do jogo", 5000, 1);
                    BusCallTime[i] = 0;
                    DisablePlayerCheckpoint(i);
                }
            }
        }
    }
    if(TransportCost[playerid] > 0 && TransportDriver[playerid] < 999)
    {
        if(IsPlayerConnected(TransportDriver[playerid]))
        {
            TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
            TransportTime[TransportDriver[playerid]] = 0;
            TransportCost[TransportDriver[playerid]] = 0;
            format(gstring, sizeof(gstring), "~w~Passageiro saiu~n~~g~ganhou R$%d",TransportCost[playerid]);
            GameTextForPlayer(TransportDriver[playerid], gstring, 5000, 1);
        }
    }
    if(GotHit[playerid] > 0)
    {
        if(GetChased[playerid] < 999)
        {
            if(IsPlayerConnected(GetChased[playerid]))
            {
                SendClientMessage(GetChased[playerid], COLOR_YELLOW, "Seu contrato saiu do servidor.");
                GoChase[GetChased[playerid]] = 999;
            }
        }
    }

    if(HireCar[playerid] != 299)
    {
        gLastDriver[HireCar[playerid]] = 300;
        VTrancado[HireCar[playerid]] = 0;
        UnLockCar(HireCar[playerid]);
    }
    if (gLastCar[playerid] > 0)
    {
        gLastDriver[gLastCar[playerid]] = 300;
        if(PlayerInfo[playerid][pPHousekey] != gLastCar[playerid]-1)
        {
            VTrancado[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~Luta interrompida", 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~Luta interrompida", 5000, 1);
            }
        }
        InRing = 0;
        RorndStarted = 0;
        Boxer1 = 255;
        Boxer2 = 255;
        TBoxer = 255;
    }
    if(TransportDuty[playerid] == 1)
    {
        TaxiDrivers -= 1;
    }
    else if(TransportDuty[playerid] == 2)
    {
        BusDrivers -= 1;
    }
    if(IsACop(playerid))
    {
        if(EmpregoDuty[playerid] == 2) { Copsronda -= 1; }
    }
    if(PlayerInfo[playerid][pMembro] == 4 || PlayerInfo[playerid][pLider] == 4)//1 daki pr baixo os 3
    {
        if(EmpregoDuty[playerid] == 2) { Medics -= 1; }
    }
    else if(IsAMec(playerid))
    {
        if(EmpregoDuty[playerid] == 2) { Mechanics -= 1; }
    }
    //CurrentMoney[playerid] = 0;
    OnPlayerSave(playerid);
    BusrouteEast[playerid][0] = 0;
    BusrouteWest[playerid][0] = 0;
    if((PlayerInfo[playerid][pAdmin] >= 1) && (PlayerInfo[playerid][pAdmin] <= MASTER_MAISMAIS))
        {
            new string[256];
            new AdminName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, AdminName, sizeof(AdminName));
            format(string, sizeof(string), "~y~%s: ~r~OFF", AdminName);

                for(new i=0; i<MAX_PLAYERS; i++)
                {
                GameTextForPlayer(i, string , 5000, 1);
                }
        }
}
Postei tudo para ver :3
Reply


Messages In This Thread
Salvar administrador ~ - by StarAway - 09.12.2012, 01:56
Respuesta: Salvar administrador ~ - by TugaBR - 09.12.2012, 03:58
Re: Salvar administrador ~ - by Gleisson_. - 09.12.2012, 11:17
Re: Salvar administrador ~ - by StarAway - 09.12.2012, 13:32
Respuesta: Salvar administrador ~ - by TugaBR - 09.12.2012, 14:03
Re: Respuesta: Salvar administrador ~ - by StarAway - 10.12.2012, 00:39
Re: Salvar administrador ~ - by StarAway - 10.12.2012, 04:17
Re: Salvar administrador ~ - by smiiir - 10.12.2012, 08:02
Re: Salvar administrador ~ - by StarAway - 10.12.2012, 09:45

Forum Jump:


Users browsing this thread: 2 Guest(s)