qbcore-framework / qb-weathersync

Weather System Used With QB-Core :sun_behind_rain_cloud:
GNU General Public License v3.0
23 stars 144 forks source link

[ENHANCEMENT] Add getTime export #69

Closed meta-hub closed 1 year ago

meta-hub commented 1 year ago

Describe Pull request Adds getTime export for server-side.

Questions: Q: Have you personally loaded this code into an updated qbcore project and checked all it's functionality? A: Yes

Q: Does your code fit the style guidelines? A: Yes

Q: Does your PR fit the contribution guidelines? A: Yes

Z3rio commented 1 year ago

What is this trying to return? Because from what I see, it doesnt return in game time nor IRL time.

meta-hub commented 1 year ago

What is this trying to return? Because from what I see, it doesnt return in game time nor IRL time.

It returns the game time. Example:

local WeatherSync = exports["qb-weathersync"]

RegisterCommand("testtime", function(source, args)
    local setHour = tonumber(args[1] or 12)
    local setMinute = tonumber(args[2] or 0)

    WeatherSync:setTime(setHour, setMinute)

    local retHour,retMinute = WeatherSync:getTime()

    print("set", setHour, setMinute)
    print("ret", retHour, retMinute)
end, false)