AV Scripts
StoreDiscord
  • Documentation
  • Guides
    • Dealerships
      • Installation
      • Admin Panel
        • Permissions
        • Creator
        • Import Vehicles
        • Warehouse
      • Dealership Panel
        • Dealership Blip
        • Overview
        • Auctions
        • Bank
        • Employees
        • Orders
        • Financing
        • Rentals
        • Showroom
        • Warehouse
        • Pre Owned
        • Settings
      • Showroom
      • Exports
      • FAQ
    • House Robbery
      • Installation
      • Add Shells
      • Dispatch
      • Exports
      • Weather
      • Minigames
      • Notifications
      • New Houses
      • Object Types
      • Sell Items
    • Illegal Runs
      • Installation
      • Customization
      • Ox Inventory
      • QB Inventory
    • Multicharacter
      • Installation
      • Character Slots
      • Clothes
      • Scenes
        • Previews
      • Exports
      • Weather
    • Paleto Heist
      • Buy here
    • Refund System
      • Installation
        • Inventories
    • Tuning Script
      • Installation
      • Events and Controls
      • Exports
      • Price Multiplier
    • Vehicleshop
      • Installation
      • Admin Panel
      • Addon Vehicles
      • Functions
        • Fuel
        • Keys
        • VIP
        • Weather
      • Garages
      • HUD
      • Society
    • Weather Script
      • Installation
      • Breath Condensation
      • Fog
      • Real Time Sync
      • Exports
    • VIP Script
      • Installation
      • Exports
      • Categories
      • Admin
      • Tebex
      • Free Tokens
  • LAPTOP PACK V3
    • Laptop v3
      • Installation
        • Inventory
        • Cosmo
        • Permissions
        • QBCore
        • Custom Framework/Inventory
        • Phone
        • Translate
      • Browser
      • Terminal
      • Documents
      • APPs Config
      • Exports
    • Boosting
      • Create Profile
      • APP
      • Contracts
      • Dispatch
      • Lockpick Export
      • VIN Export
    • Business
      • Installation
        • Inventories
          • Origen Inventory
            • ESX
            • QBCore
          • OX Inventory
          • QB/PS/LJ Inventory
          • Quasar Inventory
            • ESX
            • QBCore
          • Codem Inventory
          • Tgiann Inventory
        • ESX
      • Admin Panel
        • Create Zones
        • Edit Zones
      • Config
        • Animations
        • Blips
        • Buttons
        • Crafting
        • Effects
        • Events
          • Items
          • Zones
        • Logs
          • Custom Logs
        • Permissions
      • Exports
      • Banking Scripts
      • Multijobs
    • Cameras
      • Installation
        • Vehicle Cameras
      • Place Camera
      • Job Cameras
    • Drugs
      • Installation
      • Admin Panel
      • APP
      • Tables
      • Labs
        • PC
        • Raids
      • Alert Cops
      • Shells
      • Exports
    • Gangs
      • Installation
      • Admin Panel
        • Gangs
        • Whitelist
      • Properties
      • Register Gang
      • APP
        • Members
        • Settings
        • Missions
        • Blackmarket
        • Properties
      • Graffitis
      • Missions
      • Gang NPC
      • Shells
      • Exports
      • Labs
    • Groups
      • Events
      • Exports
    • Music
      • Installation
      • Music Labels
      • APP
        • Search Music
        • Playlists
        • Headphones
      • CDs
    • Racing
      • Installation
        • Permissions
        • Discord Logs
        • Addon Vehicles
      • Admin Panel
      • Categories
      • Events
      • Exports
      • Personal Settings
      • The Underground
    • Custom APPs
    • Discord Support
Powered by GitBook
On this page
  1. Guides
  2. Weather Script

Exports

The following events and exports can be used from your own scripts to interact and/or receive info from the weather script.

zoneUpdated

This event gets triggered when a zone is updated from server, contains the zone name and a table with zone info.

params:

  • zone: string

  • data: table

AddEventHandler('av_weather:zoneUpdated', function(zone,data)
    print(zone, json.encode(data,{ indent = true}))
    --[[
        data = {
           wind: number,
           zone: string,
           fog: string,
           windState: string,
           label: string,
           weather: string,
           freeze: boolean,
           frozenFog: string,
           temperature: number
        }
    ]]--
end

timeUpdated

This event gets triggered when in game time is updated.

params:

  • hours: number

  • minutes: number

  • seconds: number

AddEventHandler('av_weather:timeUpdated',function(hours,minutes,seconds)
    print(hours, minutes, seconds)
end)

Freeze/Unfreeze Time and Weather for local player

Use this event to freeze or sync the time for a local player, useful for multicharacter, spawn scripts, houses/motel scripts, etc.

params:

  • state: Boolean

  • hours: number optional

  • minutes: number optional

  • weather: string optional

  • blackout: Boolean optional

  • fog: string optional

  • snow: boolean optional

-- This is an example on how to freeze a player time:
local state = true
local hours = 23
local minutes = 0
local weather = "CLEAR"
local blackout = false
local fog = false
local snow = false -- render snow on ground
-- Fog options: "automatic", "no", "normal", "low", "medium", "high", "max" or false
TriggerEvent('av_weather:freeze', state, hours, minutes, weather, blackout, fog, snow)
-- This is an example on how to unfreeze player time and sync with server
TriggerEvent('av_weather:freeze', false)

getZone()

Use this export to get the current zone where the player is standing.

returns:

zone: string

local zone = exports['av_weather']:getZone()
-- zone can be "santos", "cayo", "paleto" or "sandy"

getBlackout()

Use this export to retrieve the current blackout state.

returns:

state: Boolean

local blackout = exports['av_weather']:getBlackout()
-- blackout = true or false

setRain()

Removes rain effects from the player, useful for those using YMAPs where rain comes through the roof creating puddles inside their map.

params:

state: Boolean

local state = true -- or false to enable effect again
exports['av_weather']:setRain(state)

generateWeathers()

Use this export to generate random weathers for all zones.

exports['av_weather']:generateWeathers()

getZone()

Retrieve a zone info.

parameters:

name: string

local name = "santos" -- options: "santos", "sandy", "paleto", "cayo
local zoneInfo = exports['av_weather']:getZone(name)
--[[
    zone info returns false or table:
    {
        zone: string,
        label: string,
        weather: string,
        wind: number,
        temperature: number,
        freeze: boolean,
        fog: string
    }
]]--

updateZone()

Not recommended, use the weather menu instead.

parameters:

zone: string

weather: string

freeze: boolean

local zone = "santos"
local weather = "THUNDER"
local freeze = false
exports['av_weather']:updateZone(zone, weather, freeze)

updateTime()

Not recommended, use the weather menu instead.

parameters:

hour: number

minutes: number

freeze: boolean

instant: boolean

local hour = 20
local minutes = 0
local freeze = false
local instant = false -- if false then time will increase progressively
exports['av_weather']:updateTime(hour, minutes, freeze, instant)

setBlackout()

Change the blackout state for all server players.

parameters:

state: Boolean

local state = true -- enable/disable blackout globally
exports['av_weather']:setBlackout(state)

getBlackout()

Get the server blackout state.

returns

state: Boolean

local state = exports['av_weather']:getBlackout()

getTime()

Get server time.

returns

value: table

local serverTime = exports['av_weather']:getTime()
print(json.encode(serverTime, {indent = true}))
--[[
    serverTime = {
        hour: number,
        minutes: number,
        seconds: number
    }
]]--

Last updated 6 months ago