Jump to content

Disable store clerks


vulture001

Recommended Posts

1 minute ago, CowNation said:

No clue but you could try teleporting a ped inside the store and then delete all nearby peds

Trying to make a robbery callout, but what would the code be??

 

 is it

Function.Call(Hash.SET_PED_POPULATION_BUDGET, 0); ?

 

cd.png

Link to comment
Share on other sites

Just rename the namespace to what ever it was when you made the .cs file

 

using LSPD_First_Response.Engine.Scripting;
using LSPD_First_Response.Mod.API;
using Rage;
using Rage.Native;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

 

namespace Code_2_Callouts.Stuff
{
    internal static class Utils
    {
        public static Ped Player => Game.LocalPlayer.Character;

        public static readonly Random Random = new Random();

        public static bool IsLSPDFRPluginRunning(string Plugin, Version minversion = null)
        {
            return Functions.GetAllUserPlugins().Select(assembly => assembly.GetName()).Where(an => string.Equals(an.Name, Plugin, StringComparison.CurrentCultureIgnoreCase)).Any(an => minversion == null || an.Version.CompareTo(minversion) >= 0);
        }

        public static void AddLog(this string s)
        {
            Game.LogTrivial($"[RoadIncidentCallouts] {s}");
        }

        public static SpawnHelper getNearestSpawnHelper(Vector3 refLocation, IEnumerable<SpawnHelper> locationList)
        {
            var location = locationList.OrderBy(element => element.location.DistanceTo2D(refLocation)).First();
            return location;
        }

        public static float GetGroundZ(this Vector3 position)
        {
            NativeFunction.Natives.GET_GROUND_Z_FOR_3D_COORD(position.X, position.Y, position.Z, out float height, false);
            return height;
        }

        public static Vector3 ToGround(this Vector3 position)
        {
            return new Vector3(position.X, position.Y, position.GetGroundZ());
        }

        public static void TurnToFaceEntity(this Ped ped, Entity entity, int duration = -1)
        {
            NativeFunction.Natives.TASK_TURN_PED_TO_FACE_ENTITY(ped, entity, duration);
        }

        public static string GetPolicePedModelForPosition(Vector3 position)
        {
            var result = string.Empty;
            var array1 = new[]
            {
                "s_m_y_cop_01",
                "s_f_y_cop_01"
            };
            var array2 = new[]
            {
                "s_m_y_sheriff_01",
                "s_f_y_sheriff_01"
            };
            result = Functions.GetZoneAtPosition(position).County == EWorldZoneCounty.LosSantos
                ? array1[Random.Next(array1.Length)]
                : array2[Random.Next(array2.Length)];
            return result;
        }

        public static string GetPoliceVehicleModelForPosition(Vector3 position)
        {
            var result = string.Empty;
            var array1 = new[]
            {
                "police",
                "police2",
                "police3",
                "police4"
            };
            var array2 = new[]
            {
                "sheriff",
                "sheriff2"
            };
            result = Functions.GetZoneAtPosition(position).County == EWorldZoneCounty.LosSantos ? array1[Random.Next(array1.Length)] : array2[Random.Next(array2.Length)];
            return result;
        }

        public static void RandomizeLicensePlate(this Vehicle vehicle)
        {
            if (vehicle)
                vehicle.LicensePlate = MathHelper.GetRandomInteger(0, 9).ToString() +
                                       MathHelper.GetRandomInteger(0, 9) +
                                       Convert.ToChar(Convert.ToInt32(Math.Floor(26 * MathHelper.GetRandomDouble(0, 1) + 65))) +
                                       Convert.ToChar(Convert.ToInt32(Math.Floor(26 * MathHelper.GetRandomDouble(0, 1) + 65))) +
                                       Convert.ToChar(Convert.ToInt32(Math.Floor(26 * MathHelper.GetRandomDouble(0, 1) + 65))) +
                                       MathHelper.GetRandomInteger(0, 9) +
                                       MathHelper.GetRandomInteger(0, 9) +
                                       MathHelper.GetRandomInteger(0, 9);
        }

        public static void Damage(this Vehicle vehicle, float radius, float amount)
        {
            var model = vehicle.Model;
            model.GetDimensions(out var vector3_1, out var vector3_2);
            var num = new Random().Next(10, 45);
            for (var index = 0; index < num; ++index)
            {
                var randomInt1 = MathHelper.GetRandomSingle(vector3_1.X, vector3_2.X);
                var randomInt2 = MathHelper.GetRandomSingle(vector3_1.Y, vector3_2.Y);
                var randomInt3 = MathHelper.GetRandomSingle(vector3_1.Z, vector3_2.Z);
                vehicle.Deform(new Vector3(randomInt1, randomInt2, randomInt3), radius, amount);
            }
        }

        public static float GetRandomHeading()
        {
            return MathHelper.GetRandomSingle(0, 360);
        }

        public static void ClearAreaOfPeds(Vector3 position, float radius)
        {
            var allPeds = World.GetAllPeds();
            foreach (var ped in allPeds)
            {
                if (!ped) continue;
                if (!(ped.DistanceTo2D(position) <= radius)) continue;
                if (ped != Game.LocalPlayer.Character)
                {
                    ped.Delete();
                }
            }
        }

        public static void ClearAreaOfVehicles(Vector3 position, float radius)
        {
            var allVehicles = World.GetAllVehicles();
            foreach (var vehicle in allVehicles)
            {
                if (!vehicle) continue;
                if (!(vehicle.DistanceTo2D(position) <= radius)) continue;
                if (vehicle != Game.LocalPlayer.Character.LastVehicle)
                {
                    vehicle.Delete();
                }
            }
        }

        public static void PlayRadioAnimation(this Ped ped)
        {
            if (ped && ped.IsAlive)
            {
                GameFiber.StartNew(delegate
                {
                    ped.Tasks.Clear();
                    var animTask1 = ped.Tasks.PlayAnimation(new AnimationDictionary("random@arrests"), "generic_radio_enter", 1f, AnimationFlags.SecondaryTask | AnimationFlags.StayInEndFrame | AnimationFlags.UpperBodyOnly);
                    var length1 = animTask1.Length;
                    GameFiber.Sleep((int)length1 * 1000);
                    ped.Tasks.PlayAnimation(new AnimationDictionary("random@arrests"), "generic_radio_chatter", 1f, AnimationFlags.SecondaryTask | AnimationFlags.StayInEndFrame | AnimationFlags.UpperBodyOnly);
                    GameFiber.Sleep(5000);
                    var animTask2 = ped.Tasks.PlayAnimation(new AnimationDictionary("random@arrests"), "generic_radio_exit", 1f, AnimationFlags.SecondaryTask | AnimationFlags.StayInEndFrame | AnimationFlags.UpperBodyOnly);
                    var length2 = animTask2.Length;
                    GameFiber.Sleep((int)length2 * 1000);
                    ped.Tasks.Clear();
                });
            }
        }
    }
}

Link to comment
Share on other sites

1 minute ago, SRS Bladez said:

Just rename the namespace to what ever it was when you made the .cs file

 

using LSPD_First_Response.Engine.Scripting;
using LSPD_First_Response.Mod.API;
using Rage;
using Rage.Native;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

 

namespace Code_2_Callouts.Stuff
{
    internal static class Utils
    {
        public static Ped Player => Game.LocalPlayer.Character;

        public static readonly Random Random = new Random();

        public static bool IsLSPDFRPluginRunning(string Plugin, Version minversion = null)
        {
            return Functions.GetAllUserPlugins().Select(assembly => assembly.GetName()).Where(an => string.Equals(an.Name, Plugin, StringComparison.CurrentCultureIgnoreCase)).Any(an => minversion == null || an.Version.CompareTo(minversion) >= 0);
        }

        public static void AddLog(this string s)
        {
            Game.LogTrivial($"[RoadIncidentCallouts] {s}");
        }

        public static SpawnHelper getNearestSpawnHelper(Vector3 refLocation, IEnumerable<SpawnHelper> locationList)
        {
            var location = locationList.OrderBy(element => element.location.DistanceTo2D(refLocation)).First();
            return location;
        }

        public static float GetGroundZ(this Vector3 position)
        {
            NativeFunction.Natives.GET_GROUND_Z_FOR_3D_COORD(position.X, position.Y, position.Z, out float height, false);
            return height;
        }

        public static Vector3 ToGround(this Vector3 position)
        {
            return new Vector3(position.X, position.Y, position.GetGroundZ());
        }

        public static void TurnToFaceEntity(this Ped ped, Entity entity, int duration = -1)
        {
            NativeFunction.Natives.TASK_TURN_PED_TO_FACE_ENTITY(ped, entity, duration);
        }

        public static string GetPolicePedModelForPosition(Vector3 position)
        {
            var result = string.Empty;
            var array1 = new[]
            {
                "s_m_y_cop_01",
                "s_f_y_cop_01"
            };
            var array2 = new[]
            {
                "s_m_y_sheriff_01",
                "s_f_y_sheriff_01"
            };
            result = Functions.GetZoneAtPosition(position).County == EWorldZoneCounty.LosSantos
                ? array1[Random.Next(array1.Length)]
                : array2[Random.Next(array2.Length)];
            return result;
        }

        public static string GetPoliceVehicleModelForPosition(Vector3 position)
        {
            var result = string.Empty;
            var array1 = new[]
            {
                "police",
                "police2",
                "police3",
                "police4"
            };
            var array2 = new[]
            {
                "sheriff",
                "sheriff2"
            };
            result = Functions.GetZoneAtPosition(position).County == EWorldZoneCounty.LosSantos ? array1[Random.Next(array1.Length)] : array2[Random.Next(array2.Length)];
            return result;
        }

        public static void RandomizeLicensePlate(this Vehicle vehicle)
        {
            if (vehicle)
                vehicle.LicensePlate = MathHelper.GetRandomInteger(0, 9).ToString() +
                                       MathHelper.GetRandomInteger(0, 9) +
                                       Convert.ToChar(Convert.ToInt32(Math.Floor(26 * MathHelper.GetRandomDouble(0, 1) + 65))) +
                                       Convert.ToChar(Convert.ToInt32(Math.Floor(26 * MathHelper.GetRandomDouble(0, 1) + 65))) +
                                       Convert.ToChar(Convert.ToInt32(Math.Floor(26 * MathHelper.GetRandomDouble(0, 1) + 65))) +
                                       MathHelper.GetRandomInteger(0, 9) +
                                       MathHelper.GetRandomInteger(0, 9) +
                                       MathHelper.GetRandomInteger(0, 9);
        }

        public static void Damage(this Vehicle vehicle, float radius, float amount)
        {
            var model = vehicle.Model;
            model.GetDimensions(out var vector3_1, out var vector3_2);
            var num = new Random().Next(10, 45);
            for (var index = 0; index < num; ++index)
            {
                var randomInt1 = MathHelper.GetRandomSingle(vector3_1.X, vector3_2.X);
                var randomInt2 = MathHelper.GetRandomSingle(vector3_1.Y, vector3_2.Y);
                var randomInt3 = MathHelper.GetRandomSingle(vector3_1.Z, vector3_2.Z);
                vehicle.Deform(new Vector3(randomInt1, randomInt2, randomInt3), radius, amount);
            }
        }

        public static float GetRandomHeading()
        {
            return MathHelper.GetRandomSingle(0, 360);
        }

        public static void ClearAreaOfPeds(Vector3 position, float radius)
        {
            var allPeds = World.GetAllPeds();
            foreach (var ped in allPeds)
            {
                if (!ped) continue;
                if (!(ped.DistanceTo2D(position) <= radius)) continue;
                if (ped != Game.LocalPlayer.Character)
                {
                    ped.Delete();
                }
            }
        }

        public static void ClearAreaOfVehicles(Vector3 position, float radius)
        {
            var allVehicles = World.GetAllVehicles();
            foreach (var vehicle in allVehicles)
            {
                if (!vehicle) continue;
                if (!(vehicle.DistanceTo2D(position) <= radius)) continue;
                if (vehicle != Game.LocalPlayer.Character.LastVehicle)
                {
                    vehicle.Delete();
                }
            }
        }

        public static void PlayRadioAnimation(this Ped ped)
        {
            if (ped && ped.IsAlive)
            {
                GameFiber.StartNew(delegate
                {
                    ped.Tasks.Clear();
                    var animTask1 = ped.Tasks.PlayAnimation(new AnimationDictionary("random@arrests"), "generic_radio_enter", 1f, AnimationFlags.SecondaryTask | AnimationFlags.StayInEndFrame | AnimationFlags.UpperBodyOnly);
                    var length1 = animTask1.Length;
                    GameFiber.Sleep((int)length1 * 1000);
                    ped.Tasks.PlayAnimation(new AnimationDictionary("random@arrests"), "generic_radio_chatter", 1f, AnimationFlags.SecondaryTask | AnimationFlags.StayInEndFrame | AnimationFlags.UpperBodyOnly);
                    GameFiber.Sleep(5000);
                    var animTask2 = ped.Tasks.PlayAnimation(new AnimationDictionary("random@arrests"), "generic_radio_exit", 1f, AnimationFlags.SecondaryTask | AnimationFlags.StayInEndFrame | AnimationFlags.UpperBodyOnly);
                    var length2 = animTask2.Length;
                    GameFiber.Sleep((int)length2 * 1000);
                    ped.Tasks.Clear();
                });
            }
        }
    }
}

thanks alot man 🙂

cd.png

Link to comment
Share on other sites

1. check distance between player and store owner

2.

var nearbyPeds = StoreOwner.GetNearbyPeds(16);
foreach(var ped in nearbyPeds)
{
    if (ped.Model == StoreOwner.Model)
    {
        ped.Delete();
    }
}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...