OnResourceStart

From GT-MP
Jump to: navigation, search
OnResourceStart
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

This type of event is mainly used for handling stuff after the resource has been initiated.

Requirements

First of all, it should be defined in your Main constructor for it to be called, otherwise it wouldn't be initiated at all!

In C#
Server-Side Function

public Main()
   {
      API.onResourceStart += OnResourceStartHandler;
   }

In Javascript
Client-Side Function

API.onResourceStart.connect(function () {
///Some Code
});

Usage example(s)

In C#
Server-Side Function

   public void OnResourceStartHandler()
   { 
      API.consoleOutput("Resource Started..");
   }

In Javascript
Client-Side Function

API.onResourceStart.connect(function () {
      API.sendChatMessage("Loaded");
});

References