Difference between revisions of "GetVersion"

From Multi Theft Auto: Wiki
Line 16: Line 16:
 
*'''name:''' the full MTA product name.
 
*'''name:''' the full MTA product name.
 
*'''netcode:''' the netcode version number.
 
*'''netcode:''' the netcode version number.
*'''os:''' can be "Windows", "Linux", "FreeBSD" or "OpenBSD".
+
*'''os:''' can be ''"Windows"'', ''"Linux"'', ''"FreeBSD"'' or ''"OpenBSD"''.
*'''type:''' the type of build.  can be "Nightly rX" (where X represents the nightly build revision) or "Custom" (custom compiled builds), or "Release" for public releases (provisional).
+
*'''type:''' the type of build.  can be:
 +
**'''"Nightly rX"''' - A nightly development build.  '''X''' represents the nightly build revision.
 +
**'''"Custom"''' - A build compiled manually
 +
**'''"Release"''' - A build that is publically released (provisional).
  
  

Revision as of 00:57, 6 May 2009

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".
  • type: the type of build. can be:
    • "Nightly rX" - A nightly development build. X represents the nightly build revision.
    • "Custom" - A build compiled manually
    • "Release" - A build that is publically released (provisional).


Example

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

Click to collapse [-]
Server
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