public void PlayAnimation(string animDict, string animName, float blendInSpeed, float blendOutSpeed, int duration, AnimationFlags flags, float playbackRate) { InputArgument[] arguments = new InputArgument[] { animDict }; Function.Call(Hash.REQUEST_ANIM_DICT, arguments); DateTime time = DateTime.UtcNow + new TimeSpan(0, 0, 0, 0, 0x3e8); while (true) { InputArgument[] argumentArray2 = new InputArgument[] { animDict }; if (Function.Call <bool>(Hash.HAS_ANIM_DICT_LOADED, argumentArray2)) { InputArgument[] argumentArray3 = new InputArgument[11]; argumentArray3[0] = this._ped.Handle; argumentArray3[1] = animDict; argumentArray3[2] = animName; argumentArray3[3] = blendInSpeed; argumentArray3[4] = blendOutSpeed; argumentArray3[5] = duration; argumentArray3[6] = flags; argumentArray3[7] = playbackRate; argumentArray3[8] = 0; argumentArray3[9] = 0; argumentArray3[10] = 0; Function.Call(Hash.TASK_PLAY_ANIM, argumentArray3); return; } Script.Yield(); if (DateTime.UtcNow >= time) { return; } } }
public static string GetUserInput(WindowTitle windowTitle, string defaultText, int maxLength) { ScriptDomain.CurrentDomain.PauseKeyboardEvents(true); InputArgument[] arguments = new InputArgument[] { true, windowTitle.ToString(), string.Empty, defaultText, string.Empty, string.Empty, string.Empty, maxLength + 1 }; Function.Call(Hash.DISPLAY_ONSCREEN_KEYBOARD, arguments); while (Function.Call <int>(Hash.UPDATE_ONSCREEN_KEYBOARD, Array.Empty <InputArgument>()) == 0) { Script.Yield(); } ScriptDomain.CurrentDomain.PauseKeyboardEvents(false); return(Function.Call <string>(Hash.GET_ONSCREEN_KEYBOARD_RESULT, Array.Empty <InputArgument>())); }
/// <summary> /// Creates an input box for the user to input text using the keyboard. /// </summary> /// <param name="windowTitle">The title of the input box window.</param> /// <param name="maxLength">The maximum length of text input allowed.</param> /// <param name="defaultText">The default text.</param> /// <returns>The <see cref="string"/> of what the user entered or <see cref="string.Empty"/> if the user canceled.</returns> public static string GetUserInput(WindowTitle windowTitle, string defaultText, int maxLength) { SHVDN.ScriptDomain.CurrentDomain.PauseKeyEvents(true); Function.Call(Hash.DISPLAY_ONSCREEN_KEYBOARD, true, _windowTitles[(int)windowTitle], SHVDN.NativeMemory.NullString, defaultText, SHVDN.NativeMemory.NullString, SHVDN.NativeMemory.NullString, SHVDN.NativeMemory.NullString, maxLength + 1); while (Function.Call <int>(Hash.UPDATE_ONSCREEN_KEYBOARD) == 0) { Script.Yield(); } SHVDN.ScriptDomain.CurrentDomain.PauseKeyEvents(false); return(Function.Call <string>(Hash.GET_ONSCREEN_KEYBOARD_RESULT)); }
public bool Request(int timeout) { this.Request(); DateTime time = (timeout >= 0) ? (DateTime.UtcNow + new TimeSpan(0, 0, 0, 0, timeout)) : DateTime.MaxValue; while (!this.IsLoaded) { Script.Yield(); if (DateTime.UtcNow >= time) { return(false); } this.Request(); } return(true); }
public void PlayAnimation(string animDict, string animName, float blendInSpeed, float blendOutSpeed, int duration, AnimationFlags flags, float playbackRate) { Function.Call(Hash.REQUEST_ANIM_DICT, animDict); DateTime endtime = DateTime.UtcNow + new TimeSpan(0, 0, 0, 0, 1000); while (!Function.Call <bool>(Hash.HAS_ANIM_DICT_LOADED, animDict)) { Script.Yield(); if (DateTime.UtcNow >= endtime) { return; } } Function.Call(Hash.TASK_PLAY_ANIM, _ped.Handle, animDict, animName, blendInSpeed, blendOutSpeed, duration, flags, playbackRate, 0, 0, 0); }
public bool Request(int timeout) { Request(); DateTime endtime = timeout >= 0 ? DateTime.UtcNow + new TimeSpan(0, 0, 0, 0, timeout) : DateTime.MaxValue; while (!IsLoaded) { Script.Yield(); if (DateTime.UtcNow >= endtime) { return(false); } } return(true); }
public bool RequestAdditionTextFile(int timeout = 1000) { if (!Function.Call <bool>(Hash.HAS_THIS_ADDITIONAL_TEXT_LOADED, "mod_mnu", 10)) { Function.Call(Hash.CLEAR_ADDITIONAL_TEXT, 10, true); Function.Call(Hash.REQUEST_ADDITIONAL_TEXT, "mod_mnu", 10); int end = Game.GameTime + timeout; { while (Game.GameTime < end) { if (Function.Call <bool>(Hash.HAS_THIS_ADDITIONAL_TEXT_LOADED, "mod_mnu", 10)) { return(true); } Script.Yield(); } return(false); } } return(true); }
public bool RequestAdditionTextFile(int timeout = 0x3e8) { InputArgument[] arguments = new InputArgument[] { "mod_mnu", 10 }; if (Function.Call <bool>(Hash.HAS_THIS_ADDITIONAL_TEXT_LOADED, arguments)) { return(true); } InputArgument[] argumentArray2 = new InputArgument[] { 10, true }; Function.Call(Hash.CLEAR_ADDITIONAL_TEXT, argumentArray2); InputArgument[] argumentArray3 = new InputArgument[] { "mod_mnu", 10 }; Function.Call(Hash.REQUEST_ADDITIONAL_TEXT, argumentArray3); int num = Game.GameTime + timeout; while (Game.GameTime < num) { InputArgument[] argumentArray4 = new InputArgument[] { "mod_mnu", 10 }; if (Function.Call <bool>(Hash.HAS_THIS_ADDITIONAL_TEXT_LOADED, argumentArray4)) { return(true); } Script.Yield(); } return(false); }