GetVersion: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 16: Line 16:
*'''name:''' the full MTA product name, either ''"MTA:SA Server"'' or ''"MTA:SA Client"''.
*'''name:''' the full MTA product name, either ''"MTA:SA Server"'' or ''"MTA:SA Client"''.
*'''netcode:''' the netcode version number.
*'''netcode:''' the netcode version number.
*'''os:''' returns the operating system on which the server is running
*'''os:''' returns the operating system on which the server or client is running
*'''type:''' the type of build.  can be:
*'''type:''' the type of build.  can be:
**'''"Nightly rX"''' - A nightly development build.  '''X''' represents the nightly build revision.
**'''"Nightly rX"''' - A nightly development build.  '''X''' represents the nightly build revision.

Revision as of 14:28, 3 October 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, e.g. "256"
  • mta: the MTA server or client version (depending where the function was called) in textual form, e.g. "1.0"
  • name: the full MTA product name, either "MTA:SA Server" or "MTA:SA Client".
  • netcode: the netcode version number.
  • os: returns the operating system on which the server or client is running
  • 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