SetResourceInfo: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{server function}} This function sets the value of any attribute in a resource info tag. Note, that this is protected under ACL ModifyOtherObjects. ==Syntax== <syntaxhighlight lang="lua">[lua...)
 
mNo edit summary
Line 11: Line 11:


===Required Arguments===  
===Required Arguments===  
*'''theResource:''' the resource we are getting the info from.
*'''theResource:''' the resource we are setting info to.
*'''attribute:''' the name of the attribute we want info about.
*'''attribute:''' the name of the attribute that is to be set.
*'''value:''' the value of this attribute
*'''value:''' the value of this attribute



Revision as of 19:19, 17 May 2008

This function sets the value of any attribute in a resource info tag.

Note, that this is protected under ACL ModifyOtherObjects.

Syntax

bool setResourceInfo ( resource theResource, string attribute, string value ) 

Required Arguments

  • theResource: the resource we are setting info to.
  • attribute: the name of the attribute that is to be set.
  • value: the value of this attribute

Returns

Returns true if the info was successfully set, false otherwise

Example

This function sets the author of the current resource.

function outputAuthor(newAuthorName)
    author = getResourceInfo ( getThisResource(), "author" )    --Get the authors name
    if author then    --if it exists
        outputChatBox( author .. " made this script." )    --tell the world his name
    else    --if it doesn't
        getResourceInfo ( getThisResource(), "author", newAuthorName )
        outputChatBox( "Author set to: "..newAuthorName )    --tell them that it was set
    end
end

See Also