Search Results for

    Show / Hide Table of Contents

    Class Script

    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.

    Inheritance
    Object
    Script
    WorldThread
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: GTA
    Assembly: ScriptHookVDotNet3.dll
    Syntax
    public abstract class Script

    Constructors

    | Improve this Doc View Source

    Script()

    Declaration
    public Script()

    Properties

    | Improve this Doc View Source

    BaseDirectory

    Gets the Directory where this Script is stored.

    Declaration
    public string BaseDirectory { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    Filename

    Gets the filename of this Script.

    Declaration
    public string Filename { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    Interval

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

    Declaration
    protected int Interval { get; set; }
    Property Value
    Type Description
    Int32
    | Improve this Doc View Source

    IsExecuting

    Checks if this Script is executing.

    Declaration
    public bool IsExecuting { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    IsPaused

    Checks if this Script is paused.

    Declaration
    public bool IsPaused { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    IsRunning

    Checks if this Script is running.

    Declaration
    public bool IsRunning { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    Name

    Gets the name of this Script.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    Settings

    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.

    Declaration
    public ScriptSettings Settings { get; }
    Property Value
    Type Description
    ScriptSettings

    Methods

    | Improve this Doc View Source

    Abort()

    Aborts execution of this Script.

    Declaration
    public void Abort()
    | Improve this Doc View Source

    GetRelativeFilePath(String)

    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".

    Declaration
    public string GetRelativeFilePath(string filePath)
    Parameters
    Type Name Description
    String filePath

    The file path relative to the location of this Script.

    Returns
    Type Description
    String
    | Improve this Doc View Source

    InstantiateScript<T>()

    Spawns a new Script instance of the specified type.

    Declaration
    public static T InstantiateScript<T>()
        where T : Script
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Pause()

    Pause execution of this Script.

    Declaration
    public void Pause()
    | Improve this Doc View Source

    Resume()

    Starts execution of this Script after it has been Paused.

    Declaration
    public void Resume()
    | Improve this Doc View Source

    ToString()

    Returns a string that represents this Script.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String
    Overrides
    Object.ToString()
    | Improve this Doc View Source

    Wait(Int32)

    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).

    Declaration
    public static void Wait(int ms)
    Parameters
    Type Name Description
    Int32 ms

    The time in milliseconds to pause for.

    | Improve this Doc View Source

    Yield()

    Yields the execution of the script for 1 frame.

    Declaration
    public static void Yield()

    Events

    | Improve this Doc View Source

    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.

    Declaration
    public event EventHandler Aborted
    Event Type
    Type Description
    EventHandler
    | Improve this Doc View Source

    KeyDown

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

    Declaration
    public event KeyEventHandler KeyDown
    Event Type
    Type Description
    KeyEventHandler
    | Improve this Doc View Source

    KeyUp

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

    Declaration
    public event KeyEventHandler KeyUp
    Event Type
    Type Description
    KeyEventHandler
    | Improve this Doc View Source

    Tick

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

    Declaration
    public event EventHandler Tick
    Event Type
    Type Description
    EventHandler
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX