Ejemplo n.º 1
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();
                }
            }
        }
Ejemplo n.º 2
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);
            }
        }