car restart
#1

Hi
Someone could help me out that I could manage to keep the trailer were not respawn?

script
Код:
    #include <a_samp>
           #include <zcmd>
                   #include <sscanf2>
    /*                              Szнn definiciу       */
    #define COLOR_ORANGE 0xFFA500FF
    /*              Beбllнtбsok          */
    #define K_TIME 2
           #define Z_TIME 3
    /*              Timerek              */
    new vehicletimer, vehtimer;
    /*              Forward              */
    forward VehicleRespawn();
    forward CheckTimer();
    /*                                   */
    public OnFilterScriptInit()
    {
            print("**************************");
            print("Jбrmű respawnolу betцltve!");
            print("Kйszнtő: Sheet");
            SetTimer("CheckTimer", 3600000, true);
            return 1;
    }
    public OnPlayerConnect(playerid)
    {
            SendClientMessage(playerid, COLOR_ORANGE, "A szerver 'Sheet' Jбrmű respawnolу scriptjйt hasznбlja!");
            return 1;
    }
    public CheckTimer()
    {
            new time[4];
            gettime(time[0], time[1], time[2]);
            if(time[0] >= K_TIME && time[0] <= Z_TIME)
            {
                    vehicletimer = 60;
                    vehtimer = SetTimer("VehicleRespawn", 1000, true);
                SendClientMessageToAll(COLOR_ORANGE, "Minden hasznбlaton kнvьli jбrmű repsawnolva lesz 60 mбsodperc mulva a rendszer бltal.");
            }
    }
    COMMAND:respawnallcars(playerid, params[])
    {
            return cmd_rac(playerid, params);
    }
    COMMAND:rac(playerid, params[])
    {
            new vehicletime;
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_ORANGE, "Nem vagy RCON admin!");
            if(sscanf(params, "d", vehicletime)) return SendClientMessage(playerid, COLOR_ORANGE, "Hasznбlat: /r(espawn)a(ll)c(ars) [Idő]");
                vehicletimer = vehicletime;
                vehtimer = SetTimer("VehicleRespawn", 1000, true);
                new string[128], sendername[MAX_PLAYER_NAME];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* Minden hasznбlaton kнvьli jбrmű repsawnolva lesz %d mбsodperc mulva %s бltal.", vehicletime, sendername);
                SendClientMessageToAll(COLOR_ORANGE, string);
            return 1;
    }
     
    public VehicleRespawn()
    {
            --vehicletimer;
            if( !vehicletimer )     {
            new vehid;
            while(vehid < MAX_VEHICLES)
            {
            if(!IsVehicleOccupied(vehid))
            {
                    SetVehicleToRespawn(vehid);
            }
            vehid++;
            }
            KillTimer(vehtimer);
            return;
    }
            static string[ 3 ];
            format( string, 3, "%d", vehicletimer );
            GameTextForAll(string, 1000, 6 );
    }
    stock IsVehicleOccupied ( vehicleid )
    {
            new i;
            while(i < MAX_PLAYERS)
            {
                    if ( IsPlayerInVehicle ( i, vehicleid ) ) return 1;
                    i++;
            }
            return 0;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)