Esempio n. 1
0
        public void ChangeSkinCommand(Client player, PedHash model)
        {
            API.setPlayerSkin(player, model);
            API.sendNativeToPlayer(player, Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, player.handle);

            playerData[player.socialClubName].Skin = model;
        }
Esempio n. 2
0
        public void mission(Client player, PedHash newPlayerModel, Vector3 missionStartCoord, Vector3 missionDesCoord, VehicleHash missionVeh, Vector3 vehRot, PedHash oldModel)
        {
            var playerObj = new set();
            var create    = new create();

            playerObj.playerModel(player, newPlayerModel);                           // player to garbage model
            var shape = create.shape(missionDesCoord);                               // create shape at destination
            var veh   = create.veh(missionVeh, missionStartCoord, vehRot, 255, 133); // veh create

            shape.onEntityEnterColShape += (s, ent) =>
            {
                var curVeh         = API.getEntityModel(player.CurrentVehicle);
                var missionVehicle = API.getEntityModel(veh);

                if (curVeh == missionVehicle)                // not sure if this will work
                {
                    playerObj.playerModel(player, oldModel); // not sure about this // oldModel = API.pedNameToModel(Convert.ToString(curModel));

                    API.warpPlayerOutOfVehicle(player, veh); // warp player out of vehicle
                    API.deleteEntity(veh);                   // Delete the vehicle
                    API.deleteColShape(shape);               // Delete the mission destination shape
                    API.sendChatMessageToPlayer(player, "Mission complete");
                }
                else
                {
                    API.sendChatMessageToPlayer(player, "Wrong Vehicle");
                }
            };
        }
Esempio n. 3
0
        public override bool Run(string[] inputParams)
        {
            VehicleHash vehicleHash = VehicleHash.Adder;

            if (Enum.TryParse <VehicleHash>(inputParams[1], out vehicleHash))
            {
                Program.console.log.AppendLog(inputParams[1] + hashAppend + ((uint)vehicleHash).ToString());
            }
            else
            {
                PedHash pedHash = PedHash.Abigail;
                if (Enum.TryParse <PedHash>(inputParams[1], out pedHash))
                {
                    Program.console.log.AppendLog(inputParams[1] + hashAppend + ((uint)pedHash).ToString());
                }
                else
                {
                    WeaponHash weaponHash = WeaponHash.AdvancedRifle;
                    if (Enum.TryParse <WeaponHash>(inputParams[1], out weaponHash))
                    {
                        Program.console.log.AppendLog(inputParams[1] + hashAppend + ((uint)pedHash).ToString());
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
        public void SaveCurrentPed()
        {
            int     currentPedHashKey = Game.Player.Character.Model.GetHashCode();
            PedHash currentPedHash    = (PedHash)Game.Player.Character.Model.Hash;
            string  saveName          = currentPedHash.ToString();

            Ped[] nearbypeds = World.GetNearbyPeds(Game.Player.Character.Position, 1);
            foreach (Ped ped in nearbypeds)
            {
                if (ped.Model.Hash != Game.Player.Character.Model.Hash)
                {
                    currentPedHashKey = nearbypeds[0].Model.GetHashCode();
                    currentPedHash    = (PedHash)nearbypeds[0].Model.Hash;
                    saveName          = currentPedHash.ToString();
                }
            }

            //pedNames.Add(saveName);
            //pedHashkeyList.Add(currentPedHashKey);
            //listOfPeds.Add(saveName);

            saveName = Game.GetUserInput(WindowTitle.PM_NAME_CHALL, 20);

            //Write
            var p = new XElement("PED",
                                 new XElement("PEDNAME", saveName),
                                 new XElement("ID", currentPedHashKey)
                                 );

            pedHashTable.Add(p);
            xml.Save(@"scripts//TeamDeathmatch.xml");

            UI.ShowSubtitle("Saved " + saveName + ". Available from next loading.");
        }
Esempio n. 5
0
        public void SpawnMember(int amount)
        {
            if (!spawnLocked)
            {
                Random rnd = new System.Random();

                for (int i = 0; i < amount; i++)
                {
                    PedHash selectedPed = ped;
                    if (rnd.Next(0, 50) > 25)
                    {
                        selectedPed = ped1;
                    }


                    Ped member = World.CreatePed(selectedPed, spawnPositions[rnd.Next(spawnPositions.Count)].Around(0.5f));

                    if (member != null)
                    {
                        GiveWeapon(member);
                        Function.Call(Hash.SET_PED_RELATIONSHIP_GROUP_HASH, member, relationshipGroup);
                        member.Task.RunTo(enemyTeam.spawnPositions[rnd.Next(enemyTeam.spawnPositions.Count)]);
                        members.Add(member);
                        enemyTeam.AddEnemy(member);
                    }
                }
            }
        }
Esempio n. 6
0
        public void setPlayerPedSkin(Client player, PedHash hash, int gender)
        {
            Character c = player.GetCharacter();

            if (c.Model.Gender == Character.GenderMale)
            {
                if (gender != 4)
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, "You're unable to use this skin.");
                    return;
                }
            }

            else if (c.Model.Gender == Character.GenderFemale)
            {
                if (gender != 5)
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, "You're unable to use this skin.");
                    return;
                }
            }

            InventoryManager.DeleteInventoryItem(player.GetCharacter(), typeof(Money), 250);
            API.SetPlayerSkin(player, hash);
            player.GetCharacter().Skin    = hash;
            player.GetCharacter().HasSkin = true;
            player.GetCharacter().Save();
            player.SendChatMessage("Skin changed! You were charged $250.");
        }
Esempio n. 7
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();
    }
Esempio n. 8
0
        private void TickEvent(object sender, EventArgs e)
        {
            if (Game.IsKeyPressed(Keys.F3))
            {
                string resultPed = GetUserInput();

                if (resultPed != null)
                {
                    PedHash pedHash = Function.Call <PedHash>(Hash.GET_HASH_KEY, resultPed);

                    Vector3 aimPos = GetAimPosition();

                    int pedHandle = CreatePed(pedHash, aimPos.X, aimPos.Y, aimPos.Z, aimPos.ToHeading());

                    if (Function.Call <bool>(Hash.DOES_ENTITY_EXIST, pedHandle))
                    {
                        RDR2.UI.Screen.ShowSubtitle($"{resultPed} spawned");
                    }
                }
            }

            if (IsExplosiveShotgunsEnabled)
            {
                ExplosiveShotguns();
            }
        }
Esempio n. 9
0
        public override bool Run(string[] inputParams)
        {
            PedHash pedHash = PedHash.Abigail;

            if (!Enum.TryParse <PedHash>(inputParams[1], out pedHash))
            {
                return(false);
            }

            Model characterModel = new Model(pedHash);

            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();
            return(true);
        }
Esempio n. 10
0
        public override State OnTick()
        {
            if (Started == 0)
            {
                Started = GameTime;
                return(new Teleport(NodeHandle.DesertAirfield,
                                    new Delay(1000, (State)((s) => {
                    NearbyVehicles().Take(10).Cast <EntHandle>().Each(Delete);
                    NearbyHumans().Take(10).Cast <EntHandle>().Each(Delete);
                    return new SpawnPed(PedType.Cop, PedHash.Cop01SFY, this);
                }))
                                    ));
            }
            if ((GameTime - Started) > Timeout)
            {
                return(Fail);
            }
            PedHandle ped   = First(NearbyHumans().Where(p => GetPedType(p) == PedType.Cop));
            PedHash   model = GetModel(ped);

            if (ped == PedHandle.Invalid || model == PedHash.Invalid)
            {
                return(this);
            }
            bool test = model == PedHash.Cop01SFY;

            Log($"Should have spawned a cop: {test} {ped} {model}");
            return(test ? Next : Fail);
        }
Esempio n. 11
0
        public static void SetPlayerSkin(PedHash skin)
        {
            var PlayerChar = Game.Player.Character;
            var health     = PlayerChar.Health;
            var model      = new Model(skin);

            ModelRequest = true;
            model.Request(1000);

            if (model.IsInCdImage && model.IsValid)
            {
                while (!model.IsLoaded)
                {
                    Script.Yield();
                }

                Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, model.Hash);
                Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, PlayerChar);
            }
            PlayerChar   = Game.Player.Character;
            ModelRequest = false;
            //model.MarkAsNoLongerNeeded();

            PlayerChar.MaxHealth = 200;
            PlayerChar.Health    = health;
        }
Esempio n. 12
0
        public void LoadCharacterEvent(Client player, params object[] arguments)
        {
            PlayerModel playerModel = Database.LoadCharacterInformationByName(arguments[0].ToString());
            SkinModel   skinModel   = Database.GetCharacterSkin(playerModel.id);

            // Carga de skin hombre/mujer
            String  pedModel = playerModel.sex == 0 ? Constants.MALE_PED_MODEL : Constants.FEMALE_PED_MODEL;
            PedHash pedHash  = NAPI.Util.PedNameToModel(pedModel);

            NAPI.Player.SetPlayerName(player, playerModel.realName);
            NAPI.Player.SetPlayerSkin(player, pedHash);

            // Cargamos los datos básicos del personaje
            LoadCharacterData(player, playerModel);

            // Generación del modelo del personaje
            PopulateCharacterSkin(player, skinModel);

            // Generación de la ropa del personaje
            Globals.PopulateCharacterClothes(player);

            // Añadimos la vida y chaleco
            NAPI.Player.SetPlayerHealth(player, playerModel.health);
            NAPI.Player.SetPlayerArmor(player, playerModel.armor);

            Database.UpdateLastCharacter(player.SocialClubName, playerModel.id);
        }
Esempio n. 13
0
    /// <summary>
    /// Sets up all correctly configured PlayerPed
    /// </summary>
    private void SetupPlayerPeds()
    {
        foreach (UserIndex player in userIndices)
        {
            if (bool.Parse(PlayerSettings.GetValue(player, EnabledKey, false.ToString())))
            {
                string guid = PlayerSettings.GetValue(player, ControllerKey, "");

                foreach (InputManager input in InputManager.GetAvailableInputManagers())
                {
                    if (input.DeviceGuid.Equals(guid))
                    {
                        InputManager manager = input;
                        if (input is DirectInputManager)
                        {
                            manager = DirectInputManager.LoadConfig(((DirectInputManager)input).device, GetIniFile());
                        }

                        PedHash    characterHash = PlayerSettings.GetEnumValue <PedHash>(player, CharacterHashKey, PedHash.Trevor.ToString());
                        BlipSprite blipSprite    = PlayerSettings.GetEnumValue <BlipSprite>(player, BlipSpriteKey, BlipSprite.Standard.ToString());
                        BlipColor  blipColor     = PlayerSettings.GetEnumValue <BlipColor>(player, BlipColorKey, BlipColor.Green.ToString());

                        PlayerPed playerPed = new PlayerPed(player, characterHash, blipSprite, blipColor, player1, manager);
                        playerPeds.Add(playerPed);
                        break;
                    }
                }
            }
        }
    }
Esempio n. 14
0
 public VehiclePed(Vector3 location, float heading, PedHash model, VehicleSeat seat)
 {
     Location = location;
     Heading  = heading;
     Model    = model;
     Seat     = seat;
 }
Esempio n. 15
0
        public void OnPlayerConnected(Client player)
        {
            // Initialize the player
            InitializePlayerData(player);
            InitializePlayerSkin(player);

            AccountModel account = Database.GetAccount(player.SocialClubName);

            switch (account.status)
            {
            case -1:
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + Messages.INF_ACCOUNT_DISABLED);
                NAPI.Player.KickPlayer(player, Messages.INF_ACCOUNT_DISABLED);
                break;

            case 0:
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + Messages.INF_ACCOUNT_NEW);
                NAPI.Player.KickPlayer(player, Messages.INF_ACCOUNT_NEW);
                break;

            default:
                // Welcome message
                String welcomeMessage = String.Format(Messages.GEN_WELCOME_MESSAGE, player.SocialClubName);
                NAPI.Chat.SendChatMessageToPlayer(player, welcomeMessage);
                NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_WELCOME_HINT);
                NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_HELP_HINT);
                NAPI.Chat.SendChatMessageToPlayer(player, Messages.GEN_TICKET_HINT);

                if (account.lastCharacter > 0)
                {
                    // Load selected character
                    PlayerModel character = Database.LoadCharacterInformationById(account.lastCharacter);
                    SkinModel   skin      = Database.GetCharacterSkin(account.lastCharacter);

                    String  pedModel = character.sex == 0 ? Constants.MALE_PED_MODEL : Constants.FEMALE_PED_MODEL;
                    PedHash pedHash  = NAPI.Util.PedNameToModel(pedModel);
                    NAPI.Player.SetPlayerName(player, character.realName);
                    NAPI.Player.SetPlayerSkin(player, pedHash);

                    LoadCharacterData(player, character);

                    PopulateCharacterSkin(player, skin);

                    Globals.PopulateCharacterClothes(player);
                }
                else
                {
                    PedHash pedHash = NAPI.Util.PedNameToModel(Constants.DEFAULT_PED_MODEL);
                    NAPI.Player.SetPlayerSkin(player, pedHash);
                }

                // Make the player invisible
                NAPI.Entity.SetEntityTransparency(player, 255);

                // Show login window and synchronize the time
                TimeSpan currentTime = TimeSpan.FromTicks(DateTime.Now.Ticks);
                NAPI.ClientEvent.TriggerClientEvent(player, "accountLoginForm", currentTime.Hours, currentTime.Minutes, currentTime.Seconds);
                break;
            }
        }
Esempio n. 16
0
 public void OnClientEvent(Client Player, string eventName, params object[] arguments)     //arguments param can contain multiple params
 {
     if (eventName == "SC_clothes_changesex_freeze")
     {
         API.setEntityInvincible(API.getPlayerVehicle(Player), (bool)arguments[0]);
         API.freezePlayer(Player, (bool)arguments[0]);
     }
     if (eventName == "SC_clothes_changeskin_skin")
     {
         var money = 10000;
         if (API.getEntitySyncedData(Player, "SC_SKIN_CHANGE") == 1)
         {
             money = 0;
         }
         var m = API.getEntityData(Player, "SC_money");
         if (m.getMoney() >= money)
         {
             m.addMoney(-money);
             var     p = arguments[0].ToString();
             PedHash v = (PedHash)arguments[0];
             API.setPlayerSkin(Player, v);
             var lg = new login();
             lg.SetPlayerAccess(Player, "SC_SKIN", p);
             lg = null;
             API.resetEntitySyncedData(Player, "SC_SKIN_CHANGE");
         }
         else
         {
             API.sendChatMessageToPlayer(Player, "~r~朋友,你的金錢不夠呀!");
         }
         m = null;
     }
 }
Esempio n. 17
0
        public void buyskin_cmd(Client player, PedHash hash)
        {
            Account account = player.GetAccount();
            var     biz     = PropertyManager.IsAtPropertyInteraction(player);

            if (biz?.Type != PropertyManager.PropertyTypes.Clothing)
            {
                NAPI.Chat.SendChatMessageToPlayer(player, "You aren't at a clothing interaction point.");
                return;
            }

            if (account.VipLevel < 1)
            {
                player.SendChatMessage("You must be a VIP to use this command.");
                return;
            }

            if (Money.GetCharacterMoney(player.GetCharacter()) < 250)
            {
                NAPI.Chat.SendChatMessageToPlayer(player, "Not Enough Money");
                return;
            }

            if (illegalpeds.Contains(hash))
            {
                player.SendChatMessage("This skin is not allowed.");
                return;
            }

            NAPI.ClientEvent.TriggerClientEvent(player, "checkPedGender", NAPI.Util.ToJson(hash));
        }
Esempio n. 18
0
 public MissionNPC(PedHash model, Family fam, Vector3 position, float h, string nm, Mission.Type t, int r)
     : base(fam, model, position, h)
 {
     name = nm;
     missionType = t;
     repNeeded = r;
 }
Esempio n. 19
0
 public Member(Family f, PedHash m, Vector3 p, float h)
     : base(new Ped(1337))
 {
     family = f;
     model = m;
     position = new Vector3(p.X, p.Y, p.Z-1f);
     heading = h;
 }
Esempio n. 20
0
        /// <summary>
        /// Создать НПС
        /// </summary>
        public Ped CreatePed(PedHash hash, Vector3 position, Vector3 rotation, int dimension = 0)
        {
            var ped = API.createPed(hash, position, 0, dimension);

            API.setEntityRotation(ped, rotation);
            API.setEntityPosition(ped, position);
            return(ped);
        }
Esempio n. 21
0
 public Dealer(PedHash pedHash)
 {
     Name    = RandomNames.GetRandomName();
     X       = 85.50f;
     Y       = -1959.43f;
     Z       = 21.12f;
     R       = 344.75f;
     PedName = pedHash.ToString();
 }
Esempio n. 22
0
        public static Ped CreatePed(PedHash model, float forwardVector = 5)
        {
            //Model Spawn location
            Vector3 spawnloc = Game.Player.Character.Position +
                               (Game.Player.Character.ForwardVector * forwardVector);

            //Spawn the model
            return(World.CreatePed(model, spawnloc));
        }
        public override void SpawnEntities()
        {
            Vector3 spawn = GetSpawnPoint();

            if (IsValidSpawn(spawn))
            {
                DropType[] dropTypes = (DropType[])Enum.GetValues(typeof(DropType));
                DropType   randDrop  = _dropType = dropTypes[Database.Random.Next(dropTypes.Length)];
                string     model     = (_dropType == DropType.Weapons) ? "prop_mil_crate_01" : "ex_prop_crate_closed_bc";
                _prop = World.CreateProp(model, spawn, Vector3.Zero, false, false);
                if (_prop == null)
                {
                    Complete();
                }
                else
                {
                    Vector3 position = _prop.Position;
                    _blip       = World.CreateBlip(position.Around(45f), 145f);
                    _blip.Color = GTA.BlipColor.Yellow;
                    _blip.Alpha = 150;
                    _dropZone   = _blip.Position;
                    position    = _prop.Position;
                    Vector3 particlePos = position.Around(5f);
                    _particle       = WorldExtended.CreateParticleEffectAtCoord(particlePos, "exp_grd_flare");
                    _particle.Color = Color.LightGoldenrodYellow;
                    int rand = Database.Random.Next(3, 6);
                    for (int i = 0; i <= rand; i++)
                    {
                        Vector3 pedSpawn = spawn.Around(10f);
                        PedHash pedHash  = _pedHashes[Database.Random.Next(_pedHashes.Length)];
                        Ped     ped      = World.CreatePed(pedHash, pedSpawn);
                        if (!(ped == null))
                        {
                            if (i > 0)
                            {
                                ped.Weapons.Give(_weapons[Database.Random.Next(_weapons.Length)], 45, true, true);
                            }
                            else
                            {
                                ped.Weapons.Give(GTA.Native.WeaponHash.SniperRifle, 15, true, true);
                            }
                            ped.Accuracy = 100;
                            ped.Task.GuardCurrentPosition();
                            ped.RelationshipGroup = Relationships.MilitiaRelationship;
                            _pedGroup.Add(ped, i == 0);
                            _peds.Add(ped);
                            EntityEventWrapper pedWrapper = new EntityEventWrapper(ped);
                            pedWrapper.Died += PedWrapperOnDied;
                        }
                    }
                    Model val = "mesa3";
                    position = _prop.Position;
                    World.CreateVehicle(val, World.GetNextPositionOnStreet(position.Around(25f)));
                    UI.Notify(string.Format("~y~Merryweather~s~ {0} drop nearby.", (_dropType == DropType.Loot) ? "loot" : "weapons"));
                }
            }
        }
Esempio n. 24
0
 public void onServerResourceStartHandler(string resource)
 {
     if (resource == "goto")
     {
         Vector3 radlnpc = new Vector3(-1613.619, -1076.322, 13.01853);
         PedHash Denise  = PedHash.Denise;
         API.createPed(Denise, radlnpc, 65);
         API.consoleOutput("Denise is da");
     }
 }
Esempio n. 25
0
        private void onPlayerEnterVehicle(Client player, NetHandle vehicle)
        {
            PedHash model = API.pedNameToModel("Abigail");
            Vector3 pos   = API.getEntityPosition(player);

            for (int i = 0; i < 10; i++)
            {
                API.createPed(model, pos, 0);
            }
        }
Esempio n. 26
0
        public static void SetPlayerSkin(PedHash skin)
        {
            var model = new Model(skin);

            model.Request(10000);

            Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, model.Hash);

            model.MarkAsNoLongerNeeded();
        }
        private Ped CreatePed(PedHash hash, Vector3 startPos, Vector3 endPos)
        {
            Model model = new Model(hash);

            model.Request(1000);
            ped = Function.Call <Ped>(Hash.CREATE_PED, 26, (int)hash, startPos.X, startPos.Y, startPos.Z, 0, 0, 0);
            Function.Call(Hash.SET_PED_INTO_VEHICLE, ped.Handle, vehicle.Handle, -1);
            Function.Call <bool>(Hash.TASK_VEHICLE_DRIVE_TO_COORD, ped.Handle, vehicle.Handle, endPos.X, endPos.Y, endPos.Z, 60F, 1, vehicle.Model.Hash, 262144, 0.0f, -1);
            return(ped);
        }
Esempio n. 28
0
        public static PedHandle CreatePed(PedType type, PedHash model, Vector3 pos, float heading)
        {
            switch (RequestModel(model))
            {
            case AssetStatus.Invalid: return(PedHandle.ModelInvalid);

            case AssetStatus.Loading: return(PedHandle.ModelLoading);

            default: return(Call <PedHandle>(CREATE_PED, type, model, pos.X, pos.Y, pos.Z, heading, false, true));
            }
        }
Esempio n. 29
0
 private bool LoadPed(PedHash pedHash)
 {
     if (LoadModel((int)pedHash))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 30
0
        public void sad(Player client, string id, PedHash ped)
        {
            var target = playerManager.getPlayer(id);

            if (target == null)
            {
                client.SendChatMessage("nu exista.");
                return;
            }
            target.SetSkin(ped);
        }
Esempio n. 31
0
        public PedData AddPed(PedHash ped, PedData data)
        {
            data.Hash();
            if (this.pedData.ContainsKey((int)ped))
            {
                return(this.pedData[(int)ped]);
            }

            this.pedData.Add((int)ped, data);

            return(data);
        }
Esempio n. 32
0
        private int CreatePed(PedHash ped, float posx, float posy, float posz, float heading)
        {
            var task = LoadPed(ped);

            _ = task;
            int pedToCreate = Function.Call <int>(Hash.CREATE_PED, (uint)ped, posx, posy, posz, heading, true, true, true, true);

            //Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, pedToCreate, true, true); // setting this true for this ped not "despawn"
            SetRandomOutfitVariation(pedToCreate);
            Function.Call(Hash.SET_MODEL_AS_NO_LONGER_NEEDED, ((uint)ped));
            return(pedToCreate);
        }
Esempio n. 33
0
        public static Ped SpawnCompanion(PedHash pedHash, Vector3 location, int groupId)
        {
            var ped = GTA.World.CreatePed(pedHash, location);
            ped.IsPersistent = true;
            ped.RelationshipGroup = groupId;
            ped.NeverLeavesGroup = true;

            var blip = ped.AddBlip();
            blip.IsFriendly = true;
            blip.Scale = 0.5f;

            return ped;
        }
Esempio n. 34
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();
 }
Esempio n. 35
0
 public void AddCategoryToMenu(UIMenu menu, string name, PedHash[] models)
 {
     var submenu = AddSubMenu(menu, name);
     foreach (PedHash model in models)
     {
         var subitem = new UIMenuItem(model.ToString());
         submenu.AddItem(subitem);
     }
     submenu.OnItemSelect += (sender, item, index) =>
     {
         ped_data.ChangePlayerModel(_pedhash[item.Text]);
     };
 }
Esempio n. 36
0
 /// <summary>
 /// Creates a new MissionNPC
 /// </summary>
 /// <param name="fam">The family</param>
 /// <param name="model">The model</param>
 /// <param name="pos">The position</param>
 /// <param name="heading">The way the npc is facing</param>
 /// <param name="name">The name of the npc</param>
 /// <param name="mtype">The mission type this npc gives</param>
 /// <param name="rep">The repetition needed to start a mission</param>
 /// <returns>Returns a new MissionNPC</returns>
 protected MissionNPC CreateMissionNPC(Family fam, PedHash model, Vector3 pos, float heading, string name, Mission.Type mtype, int rep)
 {
     MissionNPC qm = new MissionNPC(model, fam, pos, heading, name, mtype, rep);
     for (int i = questMembers.Count-1; i >= 0 ; i--)
     {
         if (questMembers[i] == null)
         {
             continue;
         }
         MissionNPC qmem = questMembers[i];
         if (qmem.Equals(qm))
         {
             qmem.Dispose();
             questMembers.Remove(qmem);
             break;
         }
     }
     questMembers.Add(qm);
     return qm;
 }
Esempio n. 37
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();
        }
Esempio n. 38
0
 public Member(Family f, PedHash m, Vector2 p)
     : this(f, m, new Vector3(p.X, p.Y, World.GetGroundHeight(new Vector2(p.X, p.Y))))
 {
 }
Esempio n. 39
0
 public NpcObject(string name, PedHash modelName, Vector3 pos, float heading)
     : base(0)
 {
     BlipSprite = BlipSprite.SMG;
     Name = name;
     ModelName = modelName;
     Position = pos;
     Heading = heading;
     IsQuestNpc = true;
     Dialog = new DialogContainer(this);
     SimpleDialog = new List<string>();
     Ped = null;
 }
Esempio n. 40
0
 public Member(Family f, PedHash m, Vector3 p)
     : this(f, m, p, 0.0f)
 {
 }
Esempio n. 41
0
 public NpcObject(string name, PedHash modelName, Vector3 pos, float heading)
     : base(0)
 {
     BlipSprite = BlipSprite.SMG;
     Name = name;
     ModelName = modelName;
     Position = pos;
     Heading = heading;
     IsQuestNpc = true;
     Dialog = new DialogContainer(this);
     SimpleDialog = new List<string>();
     Ped = null;
     QuestsToGive = new List<string>();
     PersonalQuestLine = new List<string>();
     QuestHandIns = new List<string>();
     SideQuests = new List<string>();
     QuestConditionChecks = new List<QuestConditionCheck>();
 }