getResourceConfig | Multi Theft Auto: Wiki Skip to content

getResourceConfig

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function is used to return the root node of a configuration file. Config files must be predefined in a resource's meta file. An alternative way to load XML files is to use xmlLoadFile.

Syntax

getResourceConfig ( )

Code Examples

server

This example opens a configuration file and prints the value of the 'attr' attribute of the first 'group' node.

function resourceStart ( ) -- When the resource is started
local node = getResourceConfig( "config.xml" ) -- get the configuration file
local subNode = xmlFindChild( node, "group", 0 ) -- get a subnode in it
outputChatBox( xmlNodeGetAttribute( subNode, "attr" ),root ) -- output its attributes value to chatbox
end
addEventHandler ( "onResourceStart", resourceRoot, resourceStart )