示例#1
0
文件: Team.cs 项目: Andew/gta5-mods
 public void spawnTeam() {
     EmergencyVehicle vehicle = new EmergencyVehicle(this.vehicleModel);
     Vehicle v = vehicle.getVehicle();
     Random rnd = new Random();
     for (int seat = -1; seat <= v.PassengerSeats; seat++) {
         EmergencyCrewMember p = new EmergencyCrewMember(this.memberModels[rnd.Next(this.memberModels.Count)], this.isPoliceTeam);
         p.addWeapons(this.weapons);
         p.addWeaponAmmoCounts(this.ammoCounts);
         p.spawnIntoVehicle(vehicle, seat);
     }
     vehicle.spawn();
 }
示例#2
0
        public void spawnIntoVehicle(EmergencyVehicle v, int seat) {
            Vehicle copCar = v.getVehicle();
            // Add the officer into the car & do the setup work
            Function.Call(Hash.CREATE_PED_INSIDE_VEHICLE, copCar.Handle, 26, this.m.Hash, seat, true, true);
            Ped crewMember = Function.Call<Ped>(Hash.GET_PED_IN_VEHICLE_SEAT, copCar.Handle, seat);
            for (int i = 0; i < this.weapons.Count; i++) {
                try {
                    // converts the string in the config file to a weapon hash
                    uint wp_hash = (uint) Function.Call<int>(Hash.GET_HASH_KEY, this.weapons[i]);
                    crewMember.Weapons.Give((WeaponHash)wp_hash, this.ammoCounts[i], true, true);
                } catch (Exception e) {
                        UI.Notify(Messages.get("app-something-went-wrong", new string[] { e.Message }));
                }
            }

            if (this.isPoliceOfficer) {
                // We're police officers, after all.
                Function.Call(Hash.SET_PED_AS_COP, crewMember, true);
            }
            crewMember.IsPersistent = false;
        }