DoesResourceExist

From GTA Network Wiki
Jump to: navigation, search

DoesResourceExist
Server-Side Function

utilities-terminal.png Server-Side csharp.png C#

Checks if the given resource exists.

Syntax

bool NAPI.Resource.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 (!NAPI.Resource.DoesResourceExist(name)) {
    sender.sendChatMessage("~r~Error: ~s~There is no such resource as ~r~" + name + "~s~.");
    return;
  }
  NAPI.Resource.StopResource(name);
  NAPI.Resource.StartResource(name);
}

Changelog

Version Description
1.0 Release.

References