public void DefaultClothes() { int player_ped_hash = Function.Call <int>(Hash.PLAYER_PED_ID); CitizenFX.Core.Ped ped = new CitizenFX.Core.Ped(player_ped_hash); ped.Style.SetDefaultClothes(); }
public static async void SpawnPed() { CitizenFX.Core.Ped ped1 = await World.CreatePed(PedHash.Popov, GetEntityCoords(GetPlayerPed(-1), true)); CitizenFX.Core.Ped ped2 = await World.CreatePed(PedHash.Milton, GetEntityCoords(GetPlayerPed(-1), true)); CitizenFX.Core.Ped ped3 = await World.CreatePed(PedHash.VagosSpeak, GetEntityCoords(GetPlayerPed(-1), true)); CitizenFX.Core.Ped ped4 = await World.CreatePed(PedHash.WeiCheng, GetEntityCoords(GetPlayerPed(-1), true)); CitizenFX.Core.Ped ped5 = await World.CreatePed(PedHash.Antonb, GetEntityCoords(GetPlayerPed(-1), true)); CitizenFX.Core.Ped ped6 = await World.CreatePed(PedHash.Movprem01SMM, GetEntityCoords(GetPlayerPed(-1), true)); var pedId1 = NetToPed(ped1.NetworkId); var pedId2 = NetToPed(ped2.NetworkId); var pedId3 = NetToPed(ped3.NetworkId); var pedId4 = NetToPed(ped4.NetworkId); var pedId5 = NetToPed(ped5.NetworkId); var pedId6 = NetToPed(ped6.NetworkId); //ped1.PedGroup.Add(ped1, true); //ped1.PedGroup.Add(ped2, false); //ped1.PedGroup.Add(ped3, false); //ped1.PedGroup.Add(ped4, false); //ped1.PedGroup.Add(ped5, false); //ped1.PedGroup.Add(ped6, false); GiveWeaponToPed(pedId1, (uint)WeaponHash.SMG, 180, false, true); SetPedCombatAbility(pedId1, 100); GiveWeaponToPed(pedId2, (uint)WeaponHash.SMG, 180, false, true); SetPedCombatAbility(pedId2, 100); GiveWeaponToPed(pedId3, (uint)WeaponHash.SMG, 180, false, true); SetPedCombatAbility(pedId3, 100); GiveWeaponToPed(pedId4, (uint)WeaponHash.SMG, 180, false, true); SetPedCombatAbility(pedId4, 100); GiveWeaponToPed(pedId5, (uint)WeaponHash.SMG, 180, false, true); SetPedCombatAbility(pedId5, 100); GiveWeaponToPed(pedId6, (uint)WeaponHash.SMG, 180, false, true); SetPedCombatAbility(pedId6, 100); }
public static void ResetAllTask() { Managers.Blip.Delete(); IsTask = false; IsTaskRoad = false; IsFindNpc = false; IsTaskRoadFinish = false; if (CheckpointId > -1) { Managers.Checkpoint.Delete(CheckpointId); } CheckpointId = -1; Warning = 0; if (CurrentPed != null) { CurrentPed.MarkAsNoLongerNeeded(); } CurrentPed = null; }
public static async void CreateTest2() { var spawnTaxi = GetEntityCoords(GetPlayerPed(-1), true); string[] skins = { "s_m_m_cntrybar_01", "a_m_m_fatlatin_01", "csb_imran", "a_m_m_mexlabor_01", "a_m_y_vindouche_01", "a_m_m_fatlatin_01", "s_m_m_cntrybar_01" }; var rand = new Random(); uint vehicleHash = (uint)GetHashKey("taxi"); uint pHash = (uint)GetHashKey(skins[rand.Next(0, 6)]); if (!await Main.LoadModel(vehicleHash)) { return; } if (!await Main.LoadModel(pHash)) { return; } var veh = CreateVehicle(vehicleHash, spawnTaxi.X, spawnTaxi.Y, spawnTaxi.Z + 1f, 0, true, false); CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh); await Delay(200); CitizenFX.Core.Ped driver = new CitizenFX.Core.Ped(CreatePedInsideVehicle(vehicle.Handle, 26, pHash, -1, true, false)); var groupHandle = GetPlayerGroup(PlayerId()); SetGroupSeparationRange(groupHandle, 10.0f); SetPedNeverLeavesGroup(driver.Handle, true); SetPedAsGroupMember(driver.Handle, groupHandle); //TaskEnterVehicle(PlayerPedId(), vehicle.Handle, -1, 2, 1.0f, 1, 0); SetPedIntoVehicle(PlayerPedId(), veh, 2); SetPedCanBeDraggedOut(PlayerPedId(), false); ClearPedTasks(driver.Handle); SetVehicleEngineOn(vehicle.Handle, true, false, false); TaskVehiclePark(driver.Handle, vehicle.Handle, -1467.7531738282f, -477.02423095704f, 34.681056976318f, 0, 0, 20.0f, true); }
public static async Task <bool> IsInFrontOfWater(this CitizenFX.Core.Ped PlayerPed) { Vector3 ProbeLocation = PlayerPed.GetOffsetPosition(new Vector3(0, 8, 0)); OutputArgument z = new OutputArgument(); bool groundFound = Function.Call <bool>(Hash.GET_GROUND_Z_FOR_3D_COORD, ProbeLocation.X, ProbeLocation.Y, ProbeLocation.Z, z, false); float groundZ = z.GetResult <float>(); ProbeLocation.Z = (float)groundZ - 0.1f; Log.ToChat(ProbeLocation.ToString()); Ped ProbePed = await World.CreatePed(new Model(PedHash.Rat), ProbeLocation); ProbePed.PositionNoOffset = ProbeLocation; ProbePed.Opacity = 0; await BaseScript.Delay(50); bool isProbeInWater = Function.Call <bool>(Hash.IS_ENTITY_IN_WATER, ProbePed.Handle); ProbePed.Delete(); bool isPlayerInWater = Function.Call <bool>(Hash.IS_ENTITY_IN_WATER, PlayerPed.Handle); return(isPlayerInWater || isProbeInWater); }
public bool IsInCombatAgainst(Ped target) { return(API.IsPedInCombat(Handle, target.Handle)); }
/// <summary> /// Determines whether the <see cref="Ped"/> exists. /// </summary> /// <param name="ped">The <see cref="Ped"/> to check.</param> /// <returns><c>true</c> if the <see cref="Ped"/> exists; otherwise, <c>false</c></returns> public static bool Exists(Ped ped) { return(!ReferenceEquals(ped, null) && ped.Exists()); }
internal Tasks(Ped ped) { _ped = ped; }
public Relationship GetRelationshipWithPed(Ped ped) { return((Relationship)API.GetRelationshipBetweenPeds(Handle, ped.Handle)); }
internal Weapon(Ped owner, WeaponHash hash) { _owner = owner; Hash = hash; }
public void ReactAndFlee(Ped ped) { API.TaskReactAndFleePed(_ped.Handle, ped.Handle); }
/// <summary> /// Determine if the player is targeting a particular ped. /// </summary> /// <param name="ped">The ped to test against/</param> /// <returns>A boolean value.</returns> public bool IsTargeting(Ped ped) { return(Function.Call <bool>(Natives.IS_PLAYER_FREE_AIMING_AT_CHAR, m_playerId, ped.Handle)); }
internal Style(Ped ped) { _ped = ped; }
public static async void CreateTest() { var spawnTaxi = GetEntityCoords(GetPlayerPed(-1), true); string[] skins = { "s_m_m_cntrybar_01", "a_m_m_fatlatin_01", "csb_imran", "a_m_m_mexlabor_01", "a_m_y_vindouche_01", "a_m_m_fatlatin_01", "s_m_m_cntrybar_01" }; var rand = new Random(); uint vehicleHash = (uint)GetHashKey("taxi"); uint pHash = (uint)GetHashKey(skins[rand.Next(0, 6)]); if (!await Main.LoadModel(vehicleHash)) { return; } if (!await Main.LoadModel(pHash)) { return; } var veh = CreateVehicle(vehicleHash, spawnTaxi.X, spawnTaxi.Y, spawnTaxi.Z + 1f, 0, true, false); CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh) { IsEngineRunning = true }; SetEntityAsMissionEntity(vehicle.Handle, true, true); CitizenFX.Core.Ped driver = new CitizenFX.Core.Ped(CreatePedInsideVehicle(vehicle.Handle, 26, pHash, -1, true, false)); SetBlockingOfNonTemporaryEvents(driver.Handle, true); /*var GroupHandle = GetPlayerGroup(PlayerId()); * SetGroupSeparationRange(GroupHandle, 10.0f); * SetPedNeverLeavesGroup(driver.Handle, true); * SetPedAsGroupMember(driver.Handle, GroupHandle);*/ AddRelationshipGroup("TAXI", ref GroupHash); driver.RelationshipGroup = GroupHash; SetRelationshipBetweenGroups(RelationshipTypes.Companion, (uint)GetHashKey("PLAYER"), (uint)GetHashKey("TAXI")); SetRelationshipBetweenGroups(RelationshipTypes.Companion, (uint)GetHashKey("TAXI"), (uint)GetHashKey("PLAYER")); SetPedRelationshipGroupHash(GetPlayerPed(-1), (uint)GetPedRelationshipGroupHash(driver.Handle)); driver.CanBeTargetted = true; driver.BlockPermanentEvents = true; vehicle.IsPositionFrozen = true; vehicle.LockStatus = VehicleLockStatus.Unlocked; await Delay(5000); TaskEnterVehicle(PlayerPedId(), vehicle.Handle, 10000, 2, 1.0f, 1, 0); SetPedCanBeDraggedOut(PlayerPedId(), false); //driver.MarkAsNoLongerNeeded(); //vehicle.MarkAsNoLongerNeeded(); await Delay(10000); vehicle.IsPositionFrozen = false; TaskVehicleDriveToCoordLongrange(driver.Handle, vehicle.Handle, -1526.977f, -466.6963f, 34.90295f, 25.0f, 411, 30.0f); SetPedKeepTask(driver.Handle, true); }
public bool isTargetting(Ped ped) { return(IsTargeting(ped)); }
public void VehicleChase(Ped target) { API.TaskVehicleChase(_ped.Handle, target.Handle); }
public void ChatTo(Ped ped) { API.TaskChatToPed(_ped.Handle, ped.Handle, 16, 0f, 0f, 0f, 0f, 0f); }
public void Arrest(Ped ped) { API.TaskArrestPed(_ped.Handle, ped.Handle); }
internal PedComponent(Ped ped, PedComponents componentId) { _ped = ped; _componentdId = componentId; }
public Relationship GetRelationshipWithPed(Ped ped) { return((Relationship)Function.Call <int>(Hash.GET_RELATIONSHIP_BETWEEN_PEDS, Handle, ped.Handle)); }
internal PedProp(Ped ped, PedProps propId) { _ped = ped; _propId = propId; }
private static async Task SecTimer() { await Delay(1000); var pos = GetEntityCoords(GetPlayerPed(-1), true); if (IsFindNpc) { if (IsPedInAnyVehicle(PlayerPedId(), true) && UI.GetCurrentSpeed() < 1) { await Delay(5000); foreach (var ped in Main.GetPedListOnRadius(pos, 20f)) { if (User.IsAnimal(ped.Model.Hash)) { continue; } if (IsPedInAnyVehicle(ped.Handle, true)) { continue; } if (PedList.Contains(ped)) { continue; } CurrentPed = ped; PedList.Add(CurrentPed); SetEntityAsMissionEntity(CurrentPed.Handle, true, true); IsTask = true; IsFindNpc = false; break; } if (IsTask) { var v = new CitizenFX.Core.Vehicle(GetVehiclePedIsUsing(PlayerPedId())) { LockStatus = VehicleLockStatus.Unlocked }; TaskEnterVehicle(CurrentPed.Handle, v.Handle, 15000, 2, 1.0f, 1, 0); } } else { ResetAllTask(); } } if (IsTask) { if (IsPedInAnyVehicle(PlayerPedId(), true)) { if (!IsTaskRoad) { if (IsPedInAnyVehicle(PlayerPedId(), false) && IsPedInAnyVehicle(CurrentPed.Handle, false)) { IsTaskRoad = true; new CitizenFX.Core.Vehicle(GetVehiclePedIsUsing(PlayerPedId())) { LockStatus = VehicleLockStatus.StickPlayerInside }; var house = House.GetRandomHouseInLosSantos(); var housePos = new Vector3(house.x, house.y, house.z); //User.SetWaypoint(house.x, house.y); Managers.Blip.Create(housePos); Managers.Blip.ShowRoute(true); RoadDistance = CalculateTravelDistanceBetweenPoints(pos.X, pos.Y, pos.Z, house.x, house.y, house.z); if (RoadDistance < 150) { RoadDistance = Main.GetDistanceToSquared(housePos, pos); } CheckpointId = Managers.Checkpoint.Create(new Vector3(house.x, house.y, house.z), 50f, "taxi:finish"); Notification.SendWithTime("~g~Маршрут построен"); } } else { if (UI.GetCurrentSpeed() > 55) { Warning++; Notification.SendWithTime("~y~Не превышайте скорость"); Notification.SendWithTime("~y~Итоговая стоимость поездки будет ниже"); await Delay(5000); } } if (IsTaskRoadFinish && UI.GetCurrentSpeed() < 1) { IsTask = false; var v = new CitizenFX.Core.Vehicle(GetVehiclePedIsUsing(PlayerPedId())) { LockStatus = VehicleLockStatus.Unlocked }; TaskLeaveVehicle(CurrentPed.Handle, GetVehiclePedIsUsing(CurrentPed.Handle), 1); int money = Convert.ToInt32(RoadDistance / 20) * User.Bonus; if (money > 1000) { money = 1000; } int star = 5; if (Warning > 0) { if (Warning > 9) { Warning = 9; } star = Convert.ToInt32(Math.Round((10 - Warning) / 2f, 1)); int moneyWarning = Warning * 5; if (moneyWarning >= money) { money = 20; } else { money = money - moneyWarning; } Notification.SendWithTime($"~y~Сумма штрафа: ~s~${moneyWarning:#,#}"); } else { money = money + 20; Notification.SendWithTime("~b~Бонус за поездку: ~s~$20"); } int moneyTaxi = Convert.ToInt32(money * 0.1); int moneyUser = Convert.ToInt32(money * 0.9); Notification.SendWithTime($"~g~Вы заработали: ~s~${moneyUser:#,#}"); Notification.SendWithTime($"~g~Отдали таксопарку: ~s~${moneyTaxi:#,#}"); Notification.SendWithTime($"~g~Оценка за поездку: ~s~{star} зв."); User.AddCashMoney(moneyUser); if (v.Model.Hash == 2088999036) { Business.AddMoney(92, moneyTaxi); } else { Business.AddMoney(114, moneyTaxi); } await Delay(3500); foreach (var vehicleDoor in v.Doors) { if (vehicleDoor.IsOpen) { vehicleDoor.Close(); } } ResetAllTask(); } } else { ResetAllTask(); } } }
internal WeaponComponentCollection(Ped owner, Weapon weapon) { _owner = owner; _weapon = weapon; _components = GetComponentsFromHash(weapon.Hash); }
public void FleeFrom(Ped ped, int duration = -1) { API.TaskSmartFleePed(_ped.Handle, ped.Handle, 100f, duration, false, false); }
public void ShootAt(Ped target, int duration = -1, FiringPattern pattern = FiringPattern.Default) { API.TaskShootAtEntity(_ped.Handle, target.Handle, duration, (uint)pattern); }
internal PedBoneCollection(Ped owner) : base(owner) { _owner = owner; }
public bool IsInCombatAgainst(Ped target) { return(Function.Call <bool>(Hash.IS_PED_IN_COMBAT, Handle, target.Handle)); }
public void VehicleShootAtPed(Ped target) { API.TaskVehicleShootAtPed(_ped.Handle, target.Handle, 20f); }
internal WeaponCollection(Ped owner) { _owner = owner; }
public void FightAgainst(Ped target, int duration) { API.TaskCombatPedTimed(_ped.Handle, target.Handle, duration, 0); }