Exemplo n.º 1
0
        public static Task <int> Spawn(string model)
        {
            var player = Game.Player.Character.Handle;
            var hash   = (uint)API.GetHashKey(model);

            if (!API.IsModelValid(hash))
            {
                Hud.Notification(string.Format("Invalid model hash: 0x{0:X8} ({1})", hash, model));
                return(Task.FromResult(-1));
            }

            if (API.IsPedInAnyVehicle(player, false))
            {
                var vehicle = API.GetVehiclePedIsIn(player, false);
                return(SpawnOnEntity(vehicle, hash));
            }
            else
            {
                return(SpawnInFrontOfPed(player, hash));
            }
        }