Class Game
Inherited Members
Namespace: GTA
Assembly: ScriptHookVDotNet3.dll
Syntax
public static class Game
Properties
| Improve this Doc View SourceFPS
Gets the current frame rate in frames per second.
Declaration
public static float FPS { get; }
Property Value
| Type | Description |
|---|---|
| Single |
FrameCount
Gets the total number of frames that have been rendered in this session.
Declaration
public static int FrameCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
GameTime
Gets how many milliseconds the game has been open in this session
Declaration
public static int GameTime { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
IsCutsceneActive
Gets a value indicating whether the cutscene is active.
Declaration
public static bool IsCutsceneActive { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsLoading
Gets a value indicating whether there is a loading screen being displayed.
Declaration
public static bool IsLoading { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsMissionActive
Gets or sets a value informing the engine if a mission is in progress.
Declaration
public static bool IsMissionActive { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsNightVisionActive
Gets or sets a value indicating whether to render the world with a night vision filter.
Declaration
public static bool IsNightVisionActive { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsPaused
Gets or sets a value indicating whether the pause menu is active.
Declaration
public static bool IsPaused { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsRandomEventActive
Gets or sets a value informing the engine if a random event is in progress.
Declaration
public static bool IsRandomEventActive { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsThermalVisionActive
Gets or sets a value indicating whether to render the world with a thermal vision filter.
Declaration
public static bool IsThermalVisionActive { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsVibrationEnabled
Gets a value indicating whether the controller vibration is enabled.
Declaration
public static bool IsVibrationEnabled { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsWaypointActive
Gets a value indicating whether there is a waypoint set on the map.
Declaration
public static bool IsWaypointActive { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Language
Gets the current game language.
Declaration
public static Language Language { get; }
Property Value
| Type | Description |
|---|---|
| Language |
LastFrameTime
Gets the time in seconds it took for the last frame to render.
Declaration
public static float LastFrameTime { get; }
Property Value
| Type | Description |
|---|---|
| Single |
LastInputMethod
Gets whether the last input was made with a GamePad or keyboard and mouse.
Declaration
public static InputMethod LastInputMethod { get; }
Property Value
| Type | Description |
|---|---|
| InputMethod |
MaxWantedLevel
Gets or sets the maximum wanted level a Player can receive.
Declaration
public static int MaxWantedLevel { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 | The maximum wanted level, only accepts values 0 to 5. |
MeasurementSystem
Gets the measurement system the game uses to display.
Declaration
public static MeasurementSystem MeasurementSystem { get; }
Property Value
| Type | Description |
|---|---|
| MeasurementSystem |
NorthBlip
Gets the north blip, which is shown on the radar.
Declaration
public static Blip NorthBlip { get; }
Property Value
| Type | Description |
|---|---|
| Blip |
Player
Gets the Player that you are controlling.
Declaration
public static Player Player { get; }
Property Value
| Type | Description |
|---|---|
| Player |
PlayerBlip
Gets the blip of the Player that you are controlling.
Declaration
public static Blip PlayerBlip { get; }
Property Value
| Type | Description |
|---|---|
| Blip |
PlayerTargetingMode
Gets the current targeting mode of the local player.
Declaration
public static PlayerTargetingMode PlayerTargetingMode { get; }
Property Value
| Type | Description |
|---|---|
| PlayerTargetingMode |
RadioStation
Gets or sets the current radio station.
Declaration
public static RadioStation RadioStation { get; set; }
Property Value
| Type | Description |
|---|---|
| RadioStation |
TimeScale
Gets or Sets the time scale of the game.
Declaration
public static float TimeScale { get; set; }
Property Value
| Type | Description |
|---|---|
| Single | The time scale, only accepts values in range 0.0f to 1.0f. |
Version
Gets the version of the game.
Declaration
public static GameVersion Version { get; }
Property Value
| Type | Description |
|---|---|
| GameVersion |
Methods
| Improve this Doc View SourceDisableAllControlsThisFrame()
Disables all Controls this frame.
Declaration
public static void DisableAllControlsThisFrame()
DisableControlThisFrame(Control)
Makes the engine ignore input from the given Control this frame.
Declaration
public static void DisableControlThisFrame(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control. |
DoAutoSave()
Performs an automatic game save.
Declaration
public static void DoAutoSave()
EnableAllControlsThisFrame()
Enables all Controls this frame.
Declaration
public static void EnableAllControlsThisFrame()
EnableControlThisFrame(Control)
Makes the engine respond to the given Control this frame.
Declaration
public static void EnableControlThisFrame(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to enable.. |
FindPattern(String, IntPtr)
Searches the address space of the current process for a memory pattern.
Declaration
public static IntPtr FindPattern(string pattern, IntPtr startAddress = default(IntPtr))
Parameters
| Type | Name | Description |
|---|---|---|
| String | pattern | The pattern. |
| IntPtr | startAddress | The address to start searching at. If Zero (langword_csharp_default), search is started at the base address. |
Returns
| Type | Description |
|---|---|
| IntPtr | The address of a region matching the pattern, or Zero if none was found. |
Remarks
This function takes the Cheat Engine/IDA format ("48 8B 0D ?? ?? ? ? 44 8B C6 8B D5 8B D8" for example, where ?? and ? are wildcards).
FindPattern(String, String, IntPtr)
Searches the address space of the current process for a memory pattern.
Declaration
public static IntPtr FindPattern(string pattern, string mask, IntPtr startAddress = default(IntPtr))
Parameters
| Type | Name | Description |
|---|---|---|
| String | pattern | The pattern. |
| String | mask | The pattern mask. |
| IntPtr | startAddress | The address to start searching at. If Zero (langword_csharp_default), search is started at the base address. |
Returns
| Type | Description |
|---|---|
| IntPtr | The address of a region matching the pattern, or Zero if none was found. |
Remarks
This function takes the classic format ("\x48\x8B\x0D\x00\x00\x00\x00\x44\x8B\xC6\x8B\xD5\x8B\xD8" as the pattern and "xxx????xxxxxxx" as the mask for example, where \x00 in the pattern and ? In the mask is a wildcard).
GenerateHash(String)
Calculates a Jenkins One At A Time hash from the given String which can then be used by any native function that takes a hash. Can be called in any thread.
Declaration
public static int GenerateHash(string input)
Parameters
| Type | Name | Description |
|---|---|---|
| String | input | The input String to hash. |
Returns
| Type | Description |
|---|---|
| Int32 | The Jenkins hash of the input String. |
GetControlValue(Control)
Gets an analog value of a Control input.
Declaration
public static int GetControlValue(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to check. |
Returns
| Type | Description |
|---|---|
| Int32 | The Control value. |
GetControlValueNormalized(Control)
Gets an analog value of a Control input between -1.0f and 1.0f.
Declaration
public static float GetControlValueNormalized(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to check. |
Returns
| Type | Description |
|---|---|
| Single | The normalized Control value. |
GetDisabledControlValueNormalized(Control)
Gets an analog value of a disabled Control input between -1.0f and 1.0f.
Declaration
public static float GetDisabledControlValueNormalized(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to check. |
Returns
| Type | Description |
|---|---|
| Single | The normalized Control value. |
GetLocalizedString(Int32)
Returns a localized String from the games language files with a specified GXT key hash.
Declaration
public static string GetLocalizedString(int entryLabelHash)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | entryLabelHash | The GXT key hash. |
Returns
| Type | Description |
|---|---|
| String | The localized String if the key hash exists; otherwise, Empty |
GetLocalizedString(String)
Returns a localized String from the games language files with a specified GXT key.
Declaration
public static string GetLocalizedString(string entry)
Parameters
| Type | Name | Description |
|---|---|---|
| String | entry | The GXT key. |
Returns
| Type | Description |
|---|---|
| String |
GetProfileSetting(Int32)
Gets an value associated with the specified index of the profile setting.
Declaration
public static int GetProfileSetting(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | The index of the profile setting values. |
Returns
| Type | Description |
|---|---|
| Int32 | The integer value associated with the specified index of the profile setting. |
GetUserInput(WindowTitle, String, Int32)
Creates an input box for the user to input text using the keyboard.
Declaration
public static string GetUserInput(WindowTitle windowTitle, string defaultText, int maxLength)
Parameters
| Type | Name | Description |
|---|---|---|
| WindowTitle | windowTitle | The title of the input box window. |
| String | defaultText | The default text. |
| Int32 | maxLength | The maximum length of text input allowed. |
Returns
| Type | Description |
|---|---|
| String | The String of what the user entered or Empty if the user canceled. |
GetUserInput(String)
Creates an input box for the user to input text using the keyboard.
Declaration
public static string GetUserInput(string defaultText = "")
Parameters
| Type | Name | Description |
|---|---|---|
| String | defaultText | The default text. |
Returns
| Type | Description |
|---|---|
| String | The String of what the user entered or Empty if the user canceled. |
IsControlEnabled(Control)
Gets whether a Control is enabled or disabled this frame.
Declaration
public static bool IsControlEnabled(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to check. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the Control is Enabled; otherwise, false |
IsControlJustPressed(Control)
Gets whether a Control was just pressed this frame
Declaration
public static bool IsControlJustPressed(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to check. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the Control was just pressed this frame; otherwise, false |
IsControlJustReleased(Control)
Gets whether a Control was just released this frame
Declaration
public static bool IsControlJustReleased(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to check. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the Control was just released this frame; otherwise, false |
IsControlPressed(Control)
Gets whether a Control is currently pressed.
Declaration
public static bool IsControlPressed(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to check. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the Control is pressed; otherwise, false |
IsEnabledControlJustPressed(Control)
Gets whether a Control is enabled and was just pressed this frame.
Declaration
public static bool IsEnabledControlJustPressed(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to check. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the Control was just pressed this frame; otherwise, false |
IsEnabledControlJustReleased(Control)
Gets whether a Control is enabled and was just released this frame.
Declaration
public static bool IsEnabledControlJustReleased(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to check. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the Control was just released this frame; otherwise, false |
IsEnabledControlPressed(Control)
Gets whether a Control is enabled and currently pressed.
Declaration
public static bool IsEnabledControlPressed(Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to check. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the Control is pressed; otherwise, false |
IsKeyPressed(Keys)
Gets whether the specified key is currently held down.
Declaration
public static bool IsKeyPressed(Keys key)
Parameters
| Type | Name | Description |
|---|---|---|
| Keys | key | The key to check. |
Returns
| Type | Description |
|---|---|
| Boolean |
Pause(Boolean)
Pause/resume the game.
Declaration
public static void Pause(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | value | True/false for pause/resume. |
SetControlValueNormalized(Control, Single)
Override a Control by giving it a user-defined value this frame.
Declaration
public static void SetControlValueNormalized(Control control, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| Control | control | The Control to check. |
| Single | value | the value to set the control to. |
ShowSaveMenu()
Shows the save menu enabling the user to perform a manual game save.
Declaration
public static void ShowSaveMenu()
WasButtonCombinationJustEntered(Button[])
Gets whether a specific sequence of Buttons has been pressed.
Declaration
public static bool WasButtonCombinationJustEntered(params Button[] buttons)
Parameters
| Type | Name | Description |
|---|---|---|
| Button[] | buttons | The sequence of Buttons in the order the user should enter them in-game. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the combination was just entered; otherwise, false |
Remarks
There must be between 6 and 29 inclusive Buttons otherwise an ArgumentException is thrown. It only works for GamePad inputs. The in-game cheat combinations use the same system.
WasCheatStringJustEntered(String)
Gets whether a cheat code was entered into the cheat text box.
Declaration
public static bool WasCheatStringJustEntered(string cheat)
Parameters
| Type | Name | Description |
|---|---|---|
| String | cheat | The name of the cheat to check. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the cheat was just entered; otherwise, false |