Exports
All of these run on the client, so call them from a client_script
GetTemperature
Section titled “GetTemperature”The temperature from the player’s location.
local celsius = exports['vMenu.Enhanced']:GetTemperature()
if celsius and celsius < 0 then print('It is freezing out here.')endGetTemperatureAtHeight
Section titled “GetTemperatureAtHeight”The temperature at a height you choose, in metres above sea level.
local ped = GetPlayerPed(GetPlayerFromServerId(serverId))local position = GetEntityCoords(ped)
local celsius = exports['vMenu.Enhanced']:GetTemperatureAtHeight(position.z)Good to know
Section titled “Good to know”- Both can give back
nilfor a short moment right after vMenu starts, before it has worked out the first value. Always check fornilbefore you use the number. - vMenu refreshes the value twice per second, (or faster when weather and time are changing, but expect twice per second to be safe) so calling these often is cheap.
- The value is a decimal number, such as
23.4. Round it yourself if you only want whole degrees. - The temperature value is in celsius.
