SHVDN  v3
An ASI plugin for Grand Theft Auto V, which allows running scripts written in any .NET language in-game. Developed by crosire https://github.com/crosire/scripthookvdotnet/
GTA.Script Class Reference

A base class for all user scripts to inherit. Only scripts that inherit directly from this class and have a default (parameterless) public constructor will be detected and started. More...

Public Member Functions

 Script ()
 
override string ToString ()
 Returns a string that represents this Script. More...
 
string GetRelativeFilePath (string filePath)
 Gets the full file path for a file relative to this Script. e.g: GetRelativeFilePath("ScriptFiles\texture1.png") may return "C:\Program Files\Rockstar Games\Grand Theft Auto V\scripts\ScriptFiles\texture1.png". More...
 
void Abort ()
 Aborts execution of this Script. More...
 
void Pause ()
 Pause execution of this Script. More...
 
void Resume ()
 Starts execution of this Script after it has been Paused. More...
 

Static Public Member Functions

static void Wait (int ms)
 Pauses execution of the Script for a specific amount of time. Must be called inside the main script loop (the Tick event or any sub methods called from it). More...
 
static void Yield ()
 Yields the execution of the script for 1 frame. More...
 
static T InstantiateScript< T > ()
 Spawns a new Script instance of the specified type. More...
 

Public Attributes

string BaseDirectory => Path.GetDirectoryName(Filename)
 Gets the Directory where this Script is stored. More...
 

Properties

EventHandler Tick
 An event that is raised every tick of the script. Put code that needs to be looped each frame in here. More...
 
EventHandler Aborted
 An event that is raised when this Script gets aborted for any reason. This should be used for cleaning up anything created during this Script. More...
 
WinForms.KeyEventHandler KeyUp
 An event that is raised when a key is lifted. The System.Windows.Forms.KeyEventArgs contains the key that was lifted. More...
 
WinForms.KeyEventHandler KeyDown
 An event that is raised when a key is first pressed. The System.Windows.Forms.KeyEventArgs contains the key that was pressed. More...
 
string Name [get]
 Gets the name of this Script. More...
 
string Filename [get]
 Gets the filename of this Script. More...
 
bool IsPaused [get]
 Checks if this Script is paused. More...
 
bool IsRunning [get]
 Checks if this Script is running. More...
 
bool IsExecuting [get]
 Checks if this Script is executing. More...
 
ScriptSettings Settings [get]
 Gets an INI file associated with this Script. The File will be in the same location as this Script but with an extension of ".ini". Use this to save and load settings for this Script. More...
 
int Interval [get, set]
 Gets or sets the interval in ms between Tick for this Script. Default value is 0 meaning the event will execute once each frame. More...
 

Detailed Description

A base class for all user scripts to inherit. Only scripts that inherit directly from this class and have a default (parameterless) public constructor will be detected and started.

Constructor & Destructor Documentation

◆ Script()

GTA.Script.Script ( )

Member Function Documentation

◆ Abort()

void GTA.Script.Abort ( )

Aborts execution of this Script.

◆ GetRelativeFilePath()

string GTA.Script.GetRelativeFilePath ( string  filePath)

Gets the full file path for a file relative to this Script. e.g: GetRelativeFilePath("ScriptFiles\texture1.png") may return "C:\Program Files\Rockstar Games\Grand Theft Auto V\scripts\ScriptFiles\texture1.png".

Parameters
filePathThe file path relative to the location of this Script.

◆ InstantiateScript< T >()

static T GTA.Script.InstantiateScript< T > ( )
static

Spawns a new Script instance of the specified type.

Type Constraints
T :Script 

◆ Pause()

void GTA.Script.Pause ( )

Pause execution of this Script.

◆ Resume()

void GTA.Script.Resume ( )

Starts execution of this Script after it has been Paused.

◆ ToString()

override string GTA.Script.ToString ( )

Returns a string that represents this Script.

◆ Wait()

static void GTA.Script.Wait ( int  ms)
static

Pauses execution of the Script for a specific amount of time. Must be called inside the main script loop (the Tick event or any sub methods called from it).

Parameters
msThe time in milliseconds to pause for.

◆ Yield()

static void GTA.Script.Yield ( )
static

Yields the execution of the script for 1 frame.

Member Data Documentation

◆ BaseDirectory

string GTA.Script.BaseDirectory => Path.GetDirectoryName(Filename)

Gets the Directory where this Script is stored.

Property Documentation

◆ Aborted

EventHandler GTA.Script.Aborted
addremove

An event that is raised when this Script gets aborted for any reason. This should be used for cleaning up anything created during this Script.

◆ Filename

string GTA.Script.Filename
get

Gets the filename of this Script.

◆ Interval

int GTA.Script.Interval
getsetprotected

Gets or sets the interval in ms between Tick for this Script. Default value is 0 meaning the event will execute once each frame.

◆ IsExecuting

bool GTA.Script.IsExecuting
get

Checks if this Script is executing.

◆ IsPaused

bool GTA.Script.IsPaused
get

Checks if this Script is paused.

◆ IsRunning

bool GTA.Script.IsRunning
get

Checks if this Script is running.

◆ KeyDown

WinForms.KeyEventHandler GTA.Script.KeyDown
addremove

An event that is raised when a key is first pressed. The System.Windows.Forms.KeyEventArgs contains the key that was pressed.

◆ KeyUp

WinForms.KeyEventHandler GTA.Script.KeyUp
addremove

An event that is raised when a key is lifted. The System.Windows.Forms.KeyEventArgs contains the key that was lifted.

◆ Name

string GTA.Script.Name
get

Gets the name of this Script.

◆ Settings

ScriptSettings GTA.Script.Settings
get

Gets an INI file associated with this Script. The File will be in the same location as this Script but with an extension of ".ini". Use this to save and load settings for this Script.

◆ Tick

EventHandler GTA.Script.Tick
addremove

An event that is raised every tick of the script. Put code that needs to be looped each frame in here.


The documentation for this class was generated from the following file: