예제 #1
0
        private void AddWeaponObjectToStreamList(object[] args)
        {
            CWeaponObject obj = Newtonsoft.Json.JsonConvert.DeserializeObject <CWeaponObject>(args[0].ToString());

            if (StreamedWeaponObjects.FirstOrDefault(x => x.Key == obj.Key) == null)
            {
                int weapObject = CreateWeaponObject(obj.Hash, 1, obj.Pos_X, obj.Pos_Y, obj.Pos_Z - 500.0f, true, 0.0f, 0, 0, 0);

                for (int i = 0; i < obj.Components.Length; i++)
                {
                    GiveWeaponComponentToWeaponObject(weapObject, GetHashKey(obj.Components[i]));
                }

                SetEntityVisible(weapObject, false, false);
                FreezeEntityPosition(weapObject, true);

                obj.Streamed = false;
                obj.EntityID = weapObject;

                StreamedWeaponObjects.Add(obj);
            }
        }
예제 #2
0
        private void DropPedWeaponSync(object[] args)
        {
            object[]      _args = Newtonsoft.Json.JsonConvert.DeserializeObject <object[]>(args[1].ToString());
            CWeaponObject obj   = Newtonsoft.Json.JsonConvert.DeserializeObject <CWeaponObject>(_args[0].ToString());

            int weapObject = CreateWeaponObject(obj.Hash, 1, obj.Pos_X, obj.Pos_Y, obj.Pos_Z, true, 0.0f, 0, 0, 0);

            for (int i = 0; i < obj.Components.Length; i++)
            {
                GiveWeaponComponentToWeaponObject(weapObject, GetHashKey(obj.Components[i]));
            }

            SetEntityRotation(weapObject, 90.0f, 0.0f, 0.0f, 0, true);
            SetEntityDynamic(weapObject, true);
            FreezeEntityPosition(weapObject, false);
            SetEntityHasGravity(weapObject, true);
            SetEntityRecordsCollisions(weapObject, true);

            obj.Streamed = true;
            obj.EntityID = weapObject;

            StreamedWeaponObjects.Add(obj);
        }