コード例 #1
0
        public void Spawn(int typ, Vector3 spawn, uint hash)
        {
            ClientGlobals.LastSpawn = spawn;
            SpawnType type = (SpawnType)typ;

            if (type == SpawnType.PLAYER)
            {
                LocalPlayer.Character.Position = spawn;
                PlayerSpawn(null);
            }
            else if (type == SpawnType.WEAPON)
            {
                if (ClientGlobals.CurrentGame != null)
                {
                    if (ClientGlobals.CurrentGame.Map == null)
                    {
                        Debug.WriteLine("Map null");
                    }
                    else
                    {
                        SaltyWeapon wep = new SaltyWeapon(SpawnType.WEAPON, hash, spawn);
                        ClientGlobals.CurrentGame.Map.Weapons.Add(wep);
                    }
                }
                else
                {
                    Debug.WriteLine("Game null");
                }
            }
        }
コード例 #2
0
        public void DropWeapon()
        {
            if (Game.PlayerPed.Weapons.Current.Hash.ToString() == "Unarmed")
            {
                return;
            }

            foreach (var wep in PlayerWeapons.ToArray())
            {
                if ((uint)LocalPlayer.Character.Weapons.Current.Hash == wep)
                {
                    SaltyWeapon weapon = new SaltyWeapon(SpawnType.WEAPON, wep, LocalPlayer.Character.Position);
                    weapon.AmmoCount = LocalPlayer.Character.Weapons.Current.Ammo;
                    Map.Weapons.Add(weapon);
                    PlayerWeapons.Remove(wep);
                    RemoveWeaponFromPed(PlayerPedId(), wep);
                    return;
                }
            }
        }