```lua
local status, ev = pcall(require, 'lib.samp.events')
local activeWeather = -1
local activeHour = -1
local activeMinute = 0
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("setw", function(param)
local id = tonumber(param)
if id then
activeWeather = math.min(math.max(id, 0), 255)
forceWeatherNow(activeWeather)
else
activeWeather = -1
end
end)
sampRegisterChatCommand("sett", function(param)
local h, m = param:match("(%d+)%s*(%d*)")
if h then
activeHour = math.min(math.max(tonumber(h), 0), 23)
activeMinute = math.min(math.max(tonumber(m) or 0, 0), 59)
setTimeOfDay(activeHour, activeMinute)
else
activeHour = -1
end
end)
while true do
wait(500)
if activeHour ~= -1 then
setTimeOfDay(activeHour, activeMinute)
end
if activeWeather ~= -1 then
forceWeatherNow(activeWeather)
end
end
end
if status then
function ev.onSetWeather(weatherId)
if activeWeather ~= -1 then
return false
end
end
function ev.onSetWorldTime(hour, minute)
if activeHour ~= -1 then
return false
end
end
end
```