DoesResourceExist

From GT-MP
Jump to: navigation, search
DoesResourceExist
Server-Side Function
Utilities-terminal.png Server-Side Csharp.png C#

Checks if the given resource exists.

Syntax

API.doesResourceExist(string resource);


Required Arguments

  • resource: parameter input should be in string type.

NOTE: This function returns data in bool type.

Usage example

[Command("restart", ACLRequired = true)]
public void RestartCommand(Client sender, string name)
{
  if (!API.doesResourceExist(name)) {
    sender.sendChatMessage("~r~Error: ~s~There is no such resource as ~r~" + name + "~s~.");
    return;
  }
  API.stopResource(name);
  API.startResource(name);
}

References