Add native to control time per zone
Closed this issue · 4 comments
Currently, in MTA:SA, the setTime function changes the time globally for the entire map.
There is no way to make different areas of San Andreas have different times of day.
This limits creativity for servers that want unique atmospheres, for example: making one city night while another stays daytime.
Describe the solution you'd like
I propose adding a new native function
setZoneTime(zoneName, hour, minute)
- zoneName String, name of the zone (e.g., "Los Santos", "Las Venturas", "San Fierro", or custom defined areas).
- hour Integer (0–23).
- minute Integer (0–59).
Optional function :
resetZoneTime(zoneName)
Resets the zone to follow global time again.
Currently, the only option is to fake different times using client-side shaders or skybox replacements.
These methods are inefficient, performance heavy, and do not integrate with MTA’s native time system.
Example usage :
-- Make Los Santos night, Las Venturas daytime
setZoneTime("Los Santos", 22, 0) -- 10 PM
setZoneTime("Las Venturas", 12, 0) -- 12 PM (noon)
-- Reset SF to follow global time
resetZoneTime("San Fierro")
This feature would allow more immersive environments, especially for RPG/roleplay, story servers, or special event gamemodes.
Is possible within lua, use getZoneName to get players current zone and then set the time locally on client.
I understand that using getZoneName and setting time client-side is possible but it has limitations
Time changes are local only and not synchronized across players
It can cause performance issues with many players
Scripts become more complex to maintain compared to a simple native call
A dedicated native like setZoneTime(zoneName, hour, minute) would provide consistent, reliable, and easy-to-use control over zone-specific time which client-side workarounds cannot fully achieve
How would cause that performance issues or become more complex?
create a timer which runs every second or so, grab the local players position, get the zone name, compare it to a table with all zone names and time values, set the time locally. The server might send the table with time data once the client connects.
This can be done easily with Lua. There are no native GTA functions for such things. Creating such a function in MTA would be exactly the same as doing it in Lua, i.e. changing the time for the local player when entering a specified zone.