Example #1
0
 public void ChangePlayerModel(PedHash hash)
 {
     var model = new Model(hash);
     // only in recent script hook
     /*
     if (!Game.Player.ChangeModel(model))
     {
         UI.Notify("could not request model");
     }
     */
     if (!model.IsInCdImage || !model.IsPed || !model.Request(1000))
     {
         UI.Notify("could not request model");
     }
     else
     {
         Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, model.Hash);
         Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character.Handle);
         if (hash == PedHash.FreemodeMale01 || hash == PedHash.FreemodeFemale01)
         {
             // must call SET_PED_HEAD_BLEND_DATA otherwise head overlays don't work
             var slot_key = new SlotKey(SlotType.Parent, 0);
             var slot_value = new SlotValue(0, 0, 4, 4);
             var ped = Game.Player.Character;
             SetSlotValue(ped, slot_key, slot_value);
         }
         data.Clear();
     }
     model.MarkAsNoLongerNeeded();
 }
Example #2
0
        public static void SetModel(PedHash pedhash)
        {
            var characterModel = new Model(pedhash);
            characterModel.Request(500);

            // Check the model is valid
            if (characterModel.IsInCdImage && characterModel.IsValid)
            {
                // If the model isn't loaded, wait until it is
                while (!characterModel.IsLoaded) Script.Wait(100);

                // Set the player's model
                Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, characterModel.Hash);
                Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character.Handle);
            }

            // Delete the model from memory after we've assigned it
            characterModel.MarkAsNoLongerNeeded();
        }
Example #3
0
        private static void SpawnProp(String prop, Vector3 position)
        {
            var model = new Model(prop);
            model.Request(250);

            // Check the model is valid
            if (model.IsInCdImage && model.IsValid)
            {
                // Ensure the model is loaded before we try to create it in the world
                while (!model.IsLoaded)
                {
                    Script.Wait(50);
                }

                // Create the prop in the world
                backpack = World.CreateProp(model, position, true, false);

            }

            // Mark the model as no longer needed to remove it from memory.
            model.MarkAsNoLongerNeeded();
        }
Example #4
0
        // Funtion to set Player Model
        // Menu Functions End ---------- Don't Mess with Them
        private void SetPlayerModel()
        {
            Game.FadeScreenOut(250);
            Wait(250);
            if (active == true)
            {
                playermodel = Game.Player.Character.Model;
                var characterModel = new Model(PedHash.Zombie01);
                characterModel.Request(500);

                // Check the model is valid
                if (characterModel.IsInCdImage && characterModel.IsValid)
                {

                    while (!characterModel.IsLoaded) Script.Wait(100);

                    Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, characterModel.Hash);
                    Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character.Handle);
                }

                characterModel.MarkAsNoLongerNeeded();
                player = Game.Player.Character;
            }
            else
            {
                playermodel.Request(500);

                // Check the model is valid
                if (playermodel.IsInCdImage && playermodel.IsValid)
                {

                    while (!playermodel.IsLoaded) Script.Wait(100);

                    Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, playermodel.Hash);
                    Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character.Handle);
                }
                playermodel.MarkAsNoLongerNeeded();
                player = Game.Player.Character;
            }
            Game.FadeScreenIn(250);
        }
Example #5
0
        private void ReadSetPlayerModelPacket(NetIncomingMessage netIncomingMessage)
        {
            int playerId = netIncomingMessage.ReadInt32();
            uint modelId = (uint)netIncomingMessage.ReadInt32();

            foreach (NetworkPlayer serverNetworkPlayer in Players) {
                if (serverNetworkPlayer.PlayerID == playerId) {
                    serverNetworkPlayer.Model = modelId;

                    var characterModel = new Model((PedHash)serverNetworkPlayer.Model);
                    characterModel.Request(500);

                    if (serverNetworkPlayer.LocalPlayer) {
                        // Check the model is valid
                        if (characterModel.IsInCdImage && characterModel.IsValid) {
                            // If the model isn't loaded, wait until it is
                            while (!characterModel.IsLoaded) Script.Wait(100);

                            // Set the player's model
                            Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, characterModel.Hash);
                            Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character.Handle);
                        }

                        Main.ChatBox.Add("DEBUG: Model has been set to: " + modelId);
                    }

                    // We don't want to do ped things on our own player, because we don't have our own physical ped
                    if (Main.CloneSync || GetLocalPlayer().PlayerID != playerId) {
                        SetPlayerPed(serverNetworkPlayer, serverNetworkPlayer.Model);
                        //Function.Call(Hash.SET_PLAYER_MODEL, serverNetworkPlayer.Ped, serverNetworkPlayer.Model);
                    }

                    // Delete the model from memory after we've assigned it
                    characterModel.MarkAsNoLongerNeeded();
                }
            }
        }
Example #6
0
        void Onkeyup(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.F12) && (Game.Player.WantedLevel > 1))
            {
            hours = 10 + (Game.Player.WantedLevel * 10);
            Game.Player.WantedLevel = 0;
            intial1();
            }
            if ((e.KeyCode == Keys.E) && arrested)
            {
            if ((Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f)) < 2f) && (Game.Player.Money > 0x4c4b40))
            {
                bail.Remove();
                roit.Remove();
                Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f);
                Game.Player.Character.Heading = 258.4564f;
                Player player = Game.Player;
                player.Money -= 0x4c4b40;
                Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5 );
                Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character);
                arrested = false;
                _headsup = null;
                _headsupRectangle = null;
            }
            if ((Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f) && !escape)
            {
                stop_scripts();
                bail.Remove();
                roit.Remove();
                Player player2 = Game.Player;
                player2.Money -= 0x4c4b40;
                stop_scripts();
                arrested = false;
                _headsup = null;
                _headsupRectangle = null;

                Model mod = new Model(VehicleHash.Valkyrie);
                mod.Request();
                while (!mod.IsLoaded)
                {
                    stop_scripts();
                    Script.Wait(0);
                }
                escape_veh3 = World.CreateVehicle(mod, new Vector3(-1179.25f, -2845.386f, 13.5665f));
                escape_veh3.Heading = 325.6199f;
                escape_veh3.IsPersistent = true;
                mod.MarkAsNoLongerNeeded();
                //============================================================================================================
                mod = new Model(VehicleHash.Comet2);
                mod.Request();
                while (!mod.IsLoaded)
                {
                    stop_scripts();
                    Script.Wait(0);
                }
                escape_veh1 = World.CreateVehicle(mod, new Vector3(-1729.416f, -1109.523f, 12.7468f));
                escape_veh1.Heading = 321.1888f;
                escape_veh1.IsPersistent = true;
                mod.MarkAsNoLongerNeeded();
                //===========================================================================================================
                mod = new Model(VehicleHash.Insurgent2);
                mod.Request();
                while (!mod.IsLoaded)
                {
                    stop_scripts();
                    Script.Wait(0);
                }
                escape_veh2 = World.CreateVehicle(mod, new Vector3(1373.179f, -2077.577f, 51.6181f));
                escape_veh2.Heading = 332.3142f;
                escape_veh2.IsPersistent = true;
                mod.MarkAsNoLongerNeeded();

                int hash = Function.Call<int>(Hash.GET_ENTITY_MODEL, new InputArgument[] { Game.Player.Character });
                if (hash == Function.Call<int>(Hash.GET_HASH_KEY, new InputArgument[] { "player_zero" }))    //m
                {
                    mod = new Model(PedHash.Franklin);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped1 = World.CreatePed(mod, new Vector3(-1726.644f, -1112.538f, 13.2474f));
                    escape_ped1.Heading = 42.1536f;
                    escape_ped1.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();

                    mod = new Model(PedHash.Trevor);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped2 = World.CreatePed(mod, new Vector3(1376.8f, -2076.873f, 51.9985f));
                    escape_ped2.Heading = 47.19263f;
                    escape_ped2.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();

                }
                else if (hash == Function.Call<int>(Hash.GET_HASH_KEY, new InputArgument[] { "player_one" })) //f
                {
                    mod = new Model(PedHash.Michael);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped1 = World.CreatePed(mod, new Vector3(-1726.644f, -1112.538f, 13.2474f));
                    escape_ped1.Heading = 42.1536f;
                    escape_ped1.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();

                    mod = new Model(PedHash.Trevor);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped2 = World.CreatePed(mod, new Vector3(1376.8f, -2076.873f, 51.9985f));
                    escape_ped2.Heading = 47.19263f;
                    escape_ped2.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();
                }
                else if (hash == Function.Call<int>(Hash.GET_HASH_KEY, new InputArgument[] { "player_two" }))//tr
                {
                    mod = new Model(PedHash.Michael);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped1 = World.CreatePed(mod, new Vector3(-1726.644f, -1112.538f, 13.2474f));
                    escape_ped1.Heading = 42.1536f;
                    escape_ped1.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();

                    mod = new Model(PedHash.Franklin);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    escape_ped2 = World.CreatePed(mod, new Vector3(1376.8f, -2076.873f, 51.9985f));
                    escape_ped2.Heading = 47.19263f;
                    escape_ped2.IsPersistent = true;
                    mod.MarkAsNoLongerNeeded();
                }
                original_ped = Game.Player.Character;

                Game.FadeScreenOut(3000);
                while (!Function.Call<bool>(Hash.IS_SCREEN_FADED_OUT))
                    Script.Wait(0);
                Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, escape_ped1, 1, 0);
                Game.FadeScreenIn(3000);
                while (!Function.Call<bool>(Hash.IS_SCREEN_FADED_IN))
                    Script.Wait(0);
                current_ped = 1;
                vehb = escape_veh1.AddBlip();
                vehb.Color = BlipColor.Blue;
                UI.ShowSubtitle("Get in the ~b~ Vehicle",3000);
                steps = 0;

                player_status = status.In_escape;
                Function.Call(Hash.SET_MAX_WANTED_LEVEL,  5);

                escape = true;
            }
            }
            if (e.KeyCode == Keys.E && steps == 5)
            {
            if (current_ped == 1)
            {
                Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, escape_ped2, 1, 0);
                //drive task

                current_ped = 2;
            }
            else
            {
                Function.Call(Hash.CHANGE_PLAYER_PED, Game.Player, escape_ped1, 1, 0);
                //shot task
                escape_ped2.Task.FightAgainstHatedTargets(150f);
                escape_ped2.AlwaysKeepTask = true;
                current_ped = 1;
            }
            }
            if (((e.KeyCode == Keys.Y) && arrested) && (Game.Player.Character.Position.DistanceTo(escape_Ped.Position) < 4f))
            {
            time = Game.GameTime;
            int i;
            for (i = 0; i < prisoner.Count; i++)
            {
                GiveWeapons_prisoner(prisoner[i]);
                prisoner[i].CanSwitchWeapons = true;

            }
            for (i = 0; i < garde.Count; i++)
            {
                GiveWeapons_Garde(garde[i]);
                garde[i].CanSwitchWeapons = true;
                //Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, garde[i], true);

            }
            GiveWeapons_prisoner(Game.Player.Character);
            Player player3 = Game.Player;
            player3.Money -= 0x4c4b40;
            Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 5, 0x7ea26372, -183807561 });
            Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 5, -183807561, 0x7ea26372 });
            }

            if (((e.KeyCode == Keys.E) && (player_status == status.In_road)) && !sciped)
            {
            try
            {
                Game.FadeScreenOut(3000);
                while (!Function.Call<bool>(Hash.IS_SCREEN_FADED_OUT))
                {
                    Script.Wait(0);
                }

                policecar.Position = new Vector3(2124.503f, 2760.919f, 49.1893f);
                policecar.Heading = 130.5902f;

                Game.FadeScreenIn(3000);
                sciped = true;
            }
            catch (Exception ex)
            {
                SimpleLog.Error(ex);
                throw;
            }

            }
        }
Example #7
0
        public void ReadInitializationPacket(NetIncomingMessage netIncomingMessage)
        {
            int playerId = netIncomingMessage.ReadInt32();
            float posX = netIncomingMessage.ReadFloat();
            float posY = netIncomingMessage.ReadFloat();
            float posZ = netIncomingMessage.ReadFloat();
            bool safeForNet = netIncomingMessage.ReadBoolean();

            // Sets actual playerid
            CreateNetworkPlayer(playerId, posX, posY, posZ, true);

            // Changes the physical location
            Vector3 position = new Vector3(posX, posY, posZ);
            Game.Player.Character.Position = position;

            // Removes all weapons from player
            Game.Player.Character.Weapons.RemoveAll();

            // Set default server synchronized player model
            var characterModel = new Model(PedHash.Brad);
            characterModel.Request(500);

            // Check the model is valid
            if (characterModel.IsInCdImage && characterModel.IsValid) {
                // If the model isn't loaded, wait until it is
                while (!characterModel.IsLoaded) Script.Wait(100);

                // Set the player's model
                Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, characterModel.Hash);
                Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character.Handle);

                GetLocalPlayer().Model = (uint)PedHash.Brad;
            }

            // Delete the model from memory after we've assigned it
            characterModel.MarkAsNoLongerNeeded();

            Main.ChatBox.Add("(internal) Allocated PlayerID: " + GetLocalPlayer().PlayerID);
            //Main.ChatBox.Add("(internal) Packet data: " + receivedPacket + ", " + playerId + ", " + posX + ", " + posY + ", " + posZ + ", " + safeForNet);

            WorldRelationship = World.AddRelationshipGroup("AMP_PED");
            World.SetRelationshipBetweenGroups(Relationship.Companion, WorldRelationship, Game.Player.Character.RelationshipGroup); // Make the opposing party ally us (no fleeing)
            World.SetRelationshipBetweenGroups(Relationship.Neutral, Game.Player.Character.RelationshipGroup, WorldRelationship);

            // Sets safe for net flag
            SafeForNet = safeForNet;
        }
Example #8
0
        /// <summary>
        /// Reset old player model
        /// </summary>
        public void resetPlayerModel()
        {
            bool playerWasDead = false;
            bool playerWasArrested = false;
            Ped player = Game.Player.Character;
            if ((PedHash)player.Model.Hash != DemagoScript.savedPlayerModelHash)
            {
                Vehicle currentVehicle = null;
                if (player.IsInVehicle())
                {
                    currentVehicle = player.CurrentVehicle;
                }

                if (player.IsDead || Function.Call<bool>(Hash.IS_PLAYER_BEING_ARRESTED, Game.Player, false))
                {
                    #region Create remplacement ped
                    Ped replacementPed = Function.Call<Ped>(Hash.CLONE_PED, Game.Player.Character, Function.Call<int>(Hash.GET_ENTITY_HEADING, Function.Call<int>(Hash.PLAYER_PED_ID)), false, true);

                    if (player.IsDead)
                    {
                        playerWasDead = true;
                        replacementPed.Kill();
                    }
                    else
                    {
                        playerWasArrested = true;
                        replacementPed.Task.HandsUp(10000);
                    }

                    replacementPed.MarkAsNoLongerNeeded();
                    #endregion
                }

                #region Change player model with saved PedHash
                var characterModel = new Model(DemagoScript.savedPlayerModelHash);
                characterModel.Request(500);

                if (characterModel.IsInCdImage && characterModel.IsValid)
                {
                    while (!characterModel.IsLoaded) Script.Wait(100);

                    Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, characterModel.Hash);
                    Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character.Handle);
                }

                characterModel.MarkAsNoLongerNeeded();
                #endregion

                player = Game.Player.Character;
                if (currentVehicle != null)
                {
                    player.SetIntoVehicle(currentVehicle, VehicleSeat.Driver);
                }

                if ((playerWasDead || playerWasArrested) && DemagoScript.isThereACurrentMission())
                {
                    #region Hide real player and wait for game recovery
                    player.IsVisible = false;
                    player.IsInvincible = true;
                    player.Task.StandStill(-1);

                    //Tant qu'on charge le jeu, on fait attendre le script GTA Démago
                    while (!Function.Call<bool>(Hash.IS_PLAYER_PLAYING, Game.Player))
                    {
                        Script.Wait(100);
                    }

                    player.IsVisible = true;
                    player.IsInvincible = false;
                    #endregion

                    while (!Function.Call<bool>(Hash.IS_PLAYER_CONTROL_ON, Game.Player))
                    {
                        Script.Wait(100);
                    }

                    #region Show death or arrested popups
                    var title = (playerWasDead) ? "Vous êtes mort" : "Vous vous êtes fait arrêter";
                    var subtitle = "Voulez-vous revenir au dernier checkpoint ?";

                    ConfirmationPopup checkpointPopup = new ConfirmationPopup(title, subtitle);
                    checkpointPopup.OnPopupAccept += () =>
                    {

                        DemagoScript.loadLastCheckpointOnCurrentMission();
                    };
                    checkpointPopup.OnPopupRefuse += () =>
                    {
                        DemagoScript.stopCurrentMission(true);
                    };
                    checkpointPopup.show();
                    #endregion
                }
            }
        }
Example #9
0
 private string propCreate()
 {
     var model = new Model("prop_boogieboard_02");
     model.Request(250);
     if (!model.IsInCdImage || !model.IsValid)
         NativeWorkbench.Str[0] = "Not a Valid Model";
     while (!model.IsLoaded)
         Script.Wait(50);
     var placeAt = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 10, 0));
     World.CreateProp(model, placeAt, true, true);
     model.MarkAsNoLongerNeeded();
     NativeWorkbench.Model[0] = model;
     NativeWorkbench.Str[0] = "done!";
     return NativeWorkbench.Str[0];
 }
Example #10
0
 private string spawnWindTurbine()
 {
     var model = new Model(1952396163);
     model.Request(250);
     if (!model.IsInCdImage || !model.IsValid)
         NativeWorkbench.Str[0] = "Not a Valid Model";
     while (!model.IsLoaded)
         Script.Wait(50);
     World.CreateProp(new Model(1952396163), Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 20, 0)), true, true);
     model.MarkAsNoLongerNeeded();
     NativeWorkbench.Str[0] = "done";
     return NativeWorkbench.Str[0];
 }
        public void prison_controle_Tick()
        {
            if (arrested)
            {
                stop_scripts();
            }
            if (inprison)
            {
                stop_scripts();
                if (Game.Player.Character.Position.DistanceTo(new Vector3(1752.894f, 2592.242f, 45.56502f)) < 1f)
                {
                    arrested = true;

                    escape = false;
                    Function.Call(Hash.ENABLE_ALL_CONTROL_ACTIONS, new InputArgument[] { 1 });
                    Game.FadeScreenOut(0x9c4);
                    Game.Player.Character.Weapons.RemoveAll();
                    while (!Function.Call<bool>(Hash.IS_SCREEN_FADED_OUT, new InputArgument[0]))
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    Game.Player.Character.Position = new Vector3(1617.643f, 2523.981f, 45.56489f);
                    Game.Player.Character.Heading = 264.718f;
                    clothes_changer();
                    Game.FadeScreenIn(0x9c4);
                    Game.Player.CanControlCharacter = true;
                    Function.Call(Hash.SET_ENABLE_HANDCUFFS, new InputArgument[] { Game.Player.Character, 0 });
                    Function.Call(Hash.SET_ENABLE_BOUND_ANKLES, new InputArgument[] { Game.Player.Character, 0 });
                    int num = 0x7ea26372;
                    int num2 = Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, new InputArgument[] { Game.Player.Character });
                    Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 0xff, num, num2 });
                    Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 0xff, num2, num });
                    Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, new InputArgument[] { 1, num, num2 });
                    bail = World.CreateBlip(new Vector3(1691.709f, 2565.036f, 45.56487f));
                    bail.Color = BlipColor.White;
                    Function.Call(Hash.SET_CLOCK_TIME, new InputArgument[] { 13, 0, 0 });
                    roit = World.CreateBlip(escape_Ped.Position);
                    roit.Sprite = BlipSprite.DollarSign;
                    _headsup = new UIText(string.Concat(new object[] { "Time: ~b~", hours, ":", minit }), new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.HouseScript, false);
                    _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(0xd7, 0x41), Color.FromArgb(100, 0, 0, 0));
                    if (police != null)
                    {
                        police.Delete();
                    }
                    if (policecar != null)
                    {
                        policecar.Delete();
                    }
                    inprison = false;
                }
                if ((Game.Player.Character.Position.DistanceTo(new Vector3(1764.323f, 2604.595f, 45.56498f)) < 5f) && (Game.Player.Character.CurrentVehicle == policecar))
                {
                    Game.Player.Character.Task.GoTo(new Vector3(1752.894f, 2592.242f, 45.56502f));
                }
            }
            if (arrested)
            {

                if (Game.Player.Character.IsDead)
                {
                    respawn.RespawnPlayer(new Vector3(1617.643f, 2523.981f, 45.56489f), 264.718f);
                }

                if (player_status == status.In_roit && Game.GameTime > time +1000)
                {
                    Model mod = new Model(PedHash.Prisoner01);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    Ped[] allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                            if (prisoner[j] == allped[i])
                                find = true;

                        if (!find)
                            prisoner.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                    mod = new Model(PedHash.Prisoner01SMY);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                            if (prisoner[j] == allped[i])
                                find = true;

                        if (!find)
                            prisoner.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                    mod = new Model(PedHash.Prisguard01SMM);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < garde.Count; j++)
                            if (garde[j] == allped[i])
                                find = true;

                        if (!find)
                            garde.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();

                    for (int j = 0; j < prisoner.Count; j++)
                    {
                        GiveWeapons_prisoner(prisoner[j]);
                        prisoner[j].CanSwitchWeapons = true;
                        //Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, prisoner[j], true);
                    }
                    for (int j = 0; j < garde.Count; j++)
                    {
                        GiveWeapons_Garde(garde[j]);
                        garde[j].CanSwitchWeapons = true;
                       // Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, garde[j], true);
                    }
                    time = Game.GameTime;
                }

                Function.Call(Hash.SET_MAX_WANTED_LEVEL, new InputArgument[] { 0 });
                stop_scripts();
                int hh = Function.Call<int>(Hash.GET_CLOCK_HOURS, new InputArgument[0]);
                int mm = Function.Call<int>(Hash.GET_CLOCK_MINUTES, new InputArgument[0]);
                if ((hh == 14) && (mm == 0))
                {
                    Function.Call(Hash.SET_CLOCK_TIME, new InputArgument[] { 13, 0, 0 });
                    time = Game.GameTime;
                }
                if (!((mm != 0) || hhh))
                {
                    minit = 0;
                    hours--;
                    hhh = true;
                }
                else if (mm > 0)
                {
                    minit = 60 - mm;
                    hhh = false;
                }
                if ((mm == 0 || mm == 5 || mm == 10 || mm == 15 || mm == 20 || mm == 25 || mm == 30 || mm == 35 || mm == 40 || mm == 45 || mm == 50 || mm == 55 || mm == 60) && !doit)
                {
                    Model mod = new Model(PedHash.Prisoner01);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    Ped[] allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length;i++ )
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                            if (prisoner[j] == allped[i])
                                find = true;

                        if (!find)
                            prisoner.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                     mod = new Model(PedHash.Prisoner01SMY);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                     allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < prisoner.Count; j++)
                            if (prisoner[j] == allped[i])
                                find = true;

                        if (!find)
                            prisoner.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();
                    //===================================================
                    mod = new Model(PedHash.Prisguard01SMM);
                    mod.Request();
                    while (!mod.IsLoaded)
                    {
                        stop_scripts();
                        Script.Wait(0);
                    }
                    allped = World.GetAllPeds(mod);
                    for (int i = 0; i < allped.Length; i++)
                    {
                        bool find = false;
                        for (int j = 0; j < garde.Count; j++)
                            if (garde[j] == allped[i])
                                find = true;

                        if (!find)
                            garde.Add(allped[i]);
                    }
                    mod.MarkAsNoLongerNeeded();

                        doit = true;
                }
                else if ((mm != 0 && mm != 5 && mm != 10 && mm != 15 && mm != 20 && mm != 25 && mm != 30 && mm != 35 && mm != 40 && mm != 45 && mm != 50 && mm != 55 && mm != 60) && doit)
                {
                    doit = false;
                }

                stop_scripts();
                _headsup = new UIText(string.Concat(new object[] { "Time: ~b~", hours, ":", minit }), new Point(2, 520), 0.7f, Color.WhiteSmoke, GTA.Font.ChaletComprimeCologne, false);
                _headsupRectangle = new UIRectangle(new Point(0, 520), new Size(0xd7, 0x41), Color.FromArgb(100, 0, 0, 0));
                _headsup.Draw();
                _headsupRectangle.Draw();
                if (Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f)) < 2f)
                {
                    UI.Notify("press [E] to bail : ~g~ " + 0x4c4b40 + "~w~$");
                }
                else if (Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f)
                {
                    UI.Notify("press [E] to escape for : ~g~ " + 0x4c4b40 + "~w~$");
                    UI.Notify("press [Y] to make roit for : ~g~ " + 0x4c4b40 + "~w~$");
                }
                if ((hours == 0) && (minit == 0))
                {
                    bail.Remove();
                    roit.Remove();
                    escape_Ped.MarkAsNoLongerNeeded();
                    Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f);
                    Game.Player.Character.Heading = 258.4564f;
                    Function.Call(Hash.SET_MAX_WANTED_LEVEL, new InputArgument[] { 5 });
                    Function.Call(Hash.PAUSE_CLOCK, new InputArgument[] { 0 });
                    arrested = false;
                    _headsup = null;
                    _headsupRectangle = null;
                }
            }
        }