onResourceStart

Called when a resource starts.

Parameters

string resourceName

Examples

This example prints the name of the current resource, upon start.

Lua Example:
AddEventHandler('onResourceStart', function(resourceName)
  if (GetCurrentResourceName() ~= resourceName) then
    return
  end
  print('The resource ' .. resourceName .. ' has been started.')
end)
C# Example:
// in the class constructor
EventHandlers["onResourceStart"] += new Action<string>(OnResourceStart);

// delegate method
private void OnResourceStart(string resourceName)
{
  if (GetCurrentResourceName() != resourceName) return;

  Debug.WriteLine($"The resource {resourceName} has been started.");
}
JavaScript Example:
on("onResourceStart", (resourceName) => {
  if(GetCurrentResourceName() != resourceName) {
    return;
  }

  console.log(`The resource ${resourceName} has been started.`)
});