Beispiel #1
0
        private static async void onMatchStarting(int playerID, int ped)
        {
            GameEntities.ResetCarryBag();

            await respawnPlayer(Util.Teams.TEAM_CRIMINAL, playerID, ped);

            ped = GetPlayerPed(playerID);
            SetPlayerInvincible(playerID, true);
            SetEntityCollision(ped, false, false);
            FreezeEntityPosition(ped, true);
        }
Beispiel #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();
                }
            }
        }
Beispiel #3
0
        public static void AddCash(int amount)
        {
            int ped = GetPlayerPed(PlayerId());

            Cash += amount;
            if (Cash < 0)
            {
                Cash = 0;
            }
            else if (Cash > 5000)
            {
                Cash = 5000;
            }

            if (GameEntities.GetCarryBag() == 0 && Cash > 0)
            {
                GameEntities.PickupBag(ped);
            }
        }
        // Privates
        private static void tickGameActive()
        {
            if (User.IsDead() || User.Team == Util.Teams.TEAM_POLICE)
            {
                return;
            }

            Dictionary <int, GameEntity> entities = Arenas.GetGameEntities();

            foreach (KeyValuePair <int, GameEntity> entry in entities)
            {
                if (NetworkDoesNetworkIdExist(entry.Key))
                {
                    int  entID  = NetworkGetEntityFromNetworkId(entry.Key);
                    bool exists = (entID > 0 && DoesEntityExist(entID));
                    if (exists)
                    {
                        string id = entities[entry.Key].ID;
                        GameEntities.HandleEntities(id, entID);
                    }
                }
            }
        }