GetVersion

From Multi Theft Auto: Wiki
Revision as of 18:02, 7 March 2009 by Kevuwk (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This function gives you various version information about MTA and the operating system.

Syntax

table getVersion ( )

Required Arguments

None.

Returns

Returns a table with version information. Specifically these keys are present in the table:

  • number: the MTA server or client version (depending where the function was called) in pure numerical form.
  • mta: the MTA server or client version in textual form.
  • name: the full MTA product name.
  • netcode: the netcode version number.
  • os: can be "Windows", "Linux", "FreeBSD" or "OpenBSD".


Example

This example will make a script compatible with only version 1.0:

function setHoboSkin ( playerSource )
  local version = getVersion ( )
  if version.number < 256 then -- MTA 1.0 version number is 0x0100
    setPlayerSkin ( playerSource, 137 )
  else
    setElementModel ( playerSource, 137 )
  end
end
addCommandHandler ( "hobo", setHoboSkin )


See Also