예제 #1
0
        public async void SpawnEvent()
        {
            Debug.WriteLine($"[FA] Spawning Event: {ID}");

            Entity item = null;

            switch (Type.ToLower())
            {
            case "vehicle":
                item = await EntityCreate.CreateVehicle((uint)GetHashKey(Model), eventLocation(), getHeading());

                break;

            case "prop":
                item = await EntityCreate.CreateProp(Model, eventLocation(), getHeading());

                break;
            }

            if (item == null)
            {
                return;
            }

            BaseScript.TriggerServerEvent("fa:srv_addGameEntity", item.NetworkId, ID, -1);
        }
예제 #2
0
        private static async void onDeath(int playerID, int ped)
        {
            if (GameRules.GameState == Util.GameStates.STATE_STARTING)
            {
                onMatchStarting(playerID, ped);
                return;
            }

            deathCount++;
            RespawnTimer = GetGameTimer() + ((5 * deathCount) * 1000);

            int killer   = GetPedSourceOfDeath(ped);
            int killerID = NetworkGetPlayerIndexFromPed(killer);

            killerID = GetPlayerServerId(killerID);

            Debug.WriteLine($"Killer: {killer}, serverID: {killerID}");
            if (killerID > 0 && killerID != GetPlayerServerId(playerID))
            {
                Debug.WriteLine("Murdered");
                TriggerServerEvent("fa:srv_onPlayerKilled", killerID);
            }
            else
            {
                Debug.WriteLine("Death");
                TriggerServerEvent("fa:srv_onPlayerDied", killer);
            }

            if (Team == Util.Teams.TEAM_CRIMINAL)
            {
                int bag = GameEntities.GetCarryBag();
                if (DoesEntityExist(bag))
                {
                    float rot = GetEntityHeading(bag);
                    DeleteEntity(ref bag);

                    Vector3 pos    = GetEntityCoords(ped, false);
                    Prop    newbag = await EntityCreate.CreateProp("p_ld_heist_bag_s_1", pos, rot);

                    SetEntityCoords(newbag.Handle, pos.X, pos.Y, pos.Z, false, false, false, false);

                    int netID = NetworkGetNetworkIdFromEntity(newbag.Handle);
                    TriggerServerEvent("fa:srv_addGameEntity", netID, "money_bag_drop", Cash);

                    GameEntities.ResetCarryBag();
                }
            }
        }
예제 #3
0
        public static async void PickupBag(int ped)
        {
            cashBagID = -1;

            Vector3 pos  = GetEntityCoords(ped, true);
            Prop    prop = await EntityCreate.CreateProp("hei_p_f_bag_var6_bus_s", pos);

            int index = GetPedBoneIndex(ped, 0x60F0);

            AttachEntityToEntity(prop.Handle, ped, index, -0.09f, -0.05f, 0, 0, -90, 180, false, false, false, false, 0, true);

            cashBagID = prop.NetworkId;

            SetPedRelationshipGroupHash(ped, (uint)GetHashKey("traitor"));
            SetCanAttackFriendly(ped, true, true);
        }
예제 #4
0
        public async void SpawnGaurds()
        {
            Ped gaurd = await EntityCreate.CreatePed(PedHash.Cop01SMY, 6, getSpawnLocation(), getHeading());

            int handle = gaurd.Handle;

            //PlaceObjectOnGroundProperly(handle);
            GiveWeaponToPed(gaurd.GetHashCode(), (uint)WeaponHash.Pistol, 120, false, true);

            gaurd.RelationshipGroup = GameRules.relationPolice;
            gaurd.RelationshipGroup.SetRelationshipBetweenGroups("criminal", Relationship.Hate, true);
            gaurd.RelationshipGroup.SetRelationshipBetweenGroups("traitor", Relationship.Hate, true);
            gaurd.RelationshipGroup.SetRelationshipBetweenGroups("cop", Relationship.Like, true);

            gaurd.Task.FightAgainstHatedTargets(1000.0f);
            //gaurd.Task.WanderAround();

            //SetPedAsNoLongerNeeded(ref handle);
            BaseScript.TriggerServerEvent("fa:srv_addGameEntity", gaurd.NetworkId, "cop_ped", -1);
        }
예제 #5
0
        private static async Task respawnPlayer(Util.Teams team, int playerID, int ped)
        {
            string rulesID = "criminal";

            if (team == Util.Teams.TEAM_POLICE)
            {
                rulesID = "cop";
            }

            ArenaTeamData rules = GameRules.GetArenaInfo().getTeamData(rulesID);

            if (rules == null)
            {
                return;
            }

            if (team == Util.Teams.TEAM_CRIMINAL)
            {
                await EntityCreate.SetSkin("mp_m_freemode_01", playerID);
            }
            else
            {
                await EntityCreate.SetSkin("s_m_y_cop_01", playerID);
            }

            ped = GetPlayerPed(playerID);
            SetPlayerInvincible(playerID, false);
            SetPlayerInvisibleLocally(playerID, false);
            SetEntityVisible(ped, true, true);
            SetEntityCollision(ped, true, true);
            SetCanAttackFriendly(ped, false, true);
            SetEntityHealth(ped, 200);
            SetPlayerMaxArmour(playerID, 100);
            SetPedArmour(ped, 100);

            Vector3 pos = rules.playerSpawnLocation();

            pos.Z = World.GetGroundHeight(pos);

            SetEntityCoords(ped, pos.X, pos.Y, pos.Z, false, false, false, false);
            SetEntityRotation(ped, 0, 0, rules.getSpawnHeading(), 0, true);
            NetworkResurrectLocalPlayer(pos.X, pos.Y, pos.Z, rules.getSpawnHeading(), true, true);
            FreezeEntityPosition(ped, false);

            if (team == Util.Teams.TEAM_CRIMINAL)
            {
                SetPedComponentVariation(ped, 0, 0, 0, 2);  // Face
                SetPedComponentVariation(ped, 2, 11, 4, 2); // Hair
                SetPedComponentVariation(ped, 4, 1, 5, 2);  // Pantalon
                SetPedComponentVariation(ped, 6, 1, 0, 2);  // Shoees
                SetPedComponentVariation(ped, 11, 7, 2, 2); // Jacket

                GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_CROWBAR"), 0, false, false);
                GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_DBSHOTGUN"), 10, false, false);
                GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_COMBATPDW"), 260, false, true);
                GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_MOLOTOV"), 1, false, false);

                Team = Util.Teams.TEAM_CRIMINAL;
            }
            else
            {
                GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_PISTOL"), 120, false, false);
                GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_STUNGUN"), 2, false, false);
                GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_NIGHTSTICK"), 0, false, false);
                GiveWeaponToPed(ped, (uint)GetHashKey("WEAPON_PUMPSHOTGUN"), 120, false, true);

                SetCanAttackFriendly(ped, false, false);

                Team = Util.Teams.TEAM_POLICE;
            }

            SetPedRelationshipGroupHash(ped, (uint)GetHashKey(rulesID));
            setupTeamRelationships();

            bisDead = false;
        }