Community Resources

From Multi Theft Auto: Wiki

This page lists PHP calls that MTA Community allows you to use in your scripts, via callRemote.

community.mtasa.com/mta/resources.php

Retrieves the latest version number for a resource available on MTA Community.

Arguments:

string "version", string resourceName

Returns:

  • a string with the resource name
  • a string of the resource version in format of "x.x.x", or integer 0 if an error has occurred
  • a number which is the community id for the resource, or nil if an error has occurred

Example

addEventHandler( "onResourceStart", getResourceRootElement(), 
   function()
      callRemote( "http://community.mtasa.com/mta/resources.php", handleVersionCheck, "version", getResourceName(getThisResource()) )
   end
)

function handleVersionCheck( resName, commVer, commId )
    local thisVer = getResourceInfo(getThisResource(), "version")
    if commId and thisVer ~= commVer then
        outputChatBox( getResourceName(getThisResource()) .. " is outdated. Your version: " .. thisVer .. " | Current: " .. commVer )
        outputChatBox( "Please download the update @ http://community.multitheftauto.com/index.php?p=resources&s=details&id=" .. commId )
    end
end

community.mtasa.com/mta/groups.php

Retrieves group information from MTA Community.

Arguments:

string "info", int groupID

Returns 5 values:

  • Group name
  • Owner username
  • Number of members
  • Public. Integer: 1 if the group is public, 0 otherwise
  • Registration time


Members list:

string "members", int groupID

Returns: a table of usernames in the group

Examples

Click to expand [+]
Group Example
Click to expand [+]
Members Example