private void CreateItemPreview() { if (Entity.op_Equality((Entity)this._currentPreview, (Entity)null)) { this.PreviewComplete = false; this._currentOffset = Vector3.get_Zero(); Prop prop = World.CreateProp(Model.op_Implicit(this._currnetPropHash), (Vector3)null, (Vector3)null, false, false); if (Entity.op_Equality((Entity)prop, (Entity)null)) { UI.Notify(string.Format("Failed to load prop, even after request.\nProp Name: {0}", (object)this._currnetPropHash)); this._resultProp = (Prop)null; this._preview = false; this.PreviewComplete = true; } else { ((Entity)prop).set_HasCollision(false); this._currentPreview = prop; ((Entity)this._currentPreview).set_Alpha(150); Database.PlayerPed.get_Weapons().Select((WeaponHash) - 1569615261, true); this._resultProp = (Prop)null; } } else { UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_AIM~ to cancel.\nPress ~INPUT_ATTACK~ to place the item.", true); Game.DisableControlThisFrame(2, (Control)25); Game.DisableControlThisFrame(2, (Control)24); Game.DisableControlThisFrame(2, (Control)257); Game.DisableControlThisFrame(2, (Control)152); Game.DisableControlThisFrame(2, (Control)153); Game.DisableControlThisFrame(2, (Control)44); Game.DisableControlThisFrame(2, (Control)27); Game.DisableControlThisFrame(2, (Control)172); Game.DisableControlThisFrame(2, (Control)173); Game.DisableControlThisFrame(2, (Control)21); GameExtended.DisableWeaponWheel(); if (Game.IsDisabledControlPressed(2, (Control)25)) { ((Entity)this._currentPreview).Delete(); this._currentPreview = this._resultProp = (Prop)null; this._preview = false; this.PreviewComplete = true; ScriptEventHandler.Instance.UnregisterScript(new EventHandler(this.OnTick)); } else { Vector3 position = GameplayCamera.get_Position(); Vector3 direction = GameplayCamera.get_Direction(); RaycastResult raycastResult = World.Raycast(position, Vector3.op_Addition(position, Vector3.op_Multiply(direction, 15f)), (IntersectOptions) - 1, (Entity)Database.PlayerPed); Vector3 hitCoords = ((RaycastResult) ref raycastResult).get_HitCoords(); if (Vector3.op_Inequality(hitCoords, Vector3.get_Zero()) && (double)((Vector3) ref hitCoords).DistanceTo(Database.PlayerPosition) > 1.5) { ItemPreview.DrawScaleForms(); float num = Game.IsControlPressed(2, (Control)21) ? 1.5f : 1f; if (Game.IsControlPressed(2, (Control)152)) { Vector3 rotation = ((Entity)this._currentPreview).get_Rotation(); ref __Null local = ref rotation.Z;
public static bool IsOnScreen(this Vector3 vector3) { Vector3 position = GameplayCamera.get_Position(); Vector3 direction = GameplayCamera.get_Direction(); float fieldOfView = GameplayCamera.get_FieldOfView(); return((double)Vector3.Angle(Vector3.op_Subtraction(vector3, position), direction) < (double)fieldOfView); }