RU/setMinuteDuration
Jump to navigation
Jump to search
Устанавливает продолжительность минуты в игре. В GTA изначально равна 1000.
Использование
bool setMinuteDuration ( int milliseconds )
Необходимые параметры
- milliseconds: новая продолжительность игровой минуты.
Что возвращается
Возвращается true, если изменение успешно произошло, или false, если изменение не произошло.
Пример
В этом примере мы изменяем продолжительность времени на реальную и синхронизируем с реальным временем.
Click to collapse [-]
Серверfunction syncRealTime(player) -- get the current real time and send it to the player local realtime = getRealTime() triggerClientEvent(player, "doSyncRealTime", getRootElement(), realtime.hour, realtime.minute) end function resourceStart() -- when the resource starts, send the real time to all players currently in the server local players = getElementsByType("player") for i,player in ipairs(players) do syncRealTime(player) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resourceStart) function playerJoin() -- send the real time to joining players syncRealTime(source) end addEventHandler("onPlayerJoin", getRootElement(), playerJoin)
Click to collapse [-]
Clientfunction syncRealTime(h, m) -- set the ingame time setTime(h, m) -- make ingame time progress at the same rate as real time (60 seconds per minute) setMinuteDuration(60000) end -- attach the above function to the doSyncRealTime event addEvent("doSyncRealTime", true) addEventHandler("doSyncRealTime", getRootElement(), syncRealTime)
Смотри также
- areTrafficLightsLocked
- getCloudsEnabled
- getGameSpeed
- getGravity
- getHeatHaze
- getJetpackMaxHeight
- getMinuteDuration
- getSkyGradient
- getTime
- getTrafficLightState
- getVehiclesLODDistance
- getWeather
- getZoneName
- isGarageOpen
- resetSkyGradient
- resetHeatHaze
- setCloudsEnabled
- setGameSpeed
- setGarageOpen
- setGravity
- setHeatHaze
- setMinuteDuration
- setSkyGradient
- setTime
- setTrafficLightState
- setTrafficLightsLocked
- setVehiclesLODDistance
- setWeather
- setWeatherBlended
- setInteriorSoundsEnabled
- getInteriorSoundsEnabled
- setRainLevel
- getRainLevel
- resetRainLevel
- setSunSize
- getSunSize
- resetSunSize
- setSunColor
- getSunColor
- resetSunColor
- setWindVelocity
- getWindVelocity
- resetWindVelocity
- setFarClipDistance
- getFarClipDistance
- resetFarClipDistance
- setFogDistance
- getFogDistance
- resetFogDistance
- removeWorldModel
- restoreWorldModel
- restoreAllWorldModels
- setOcclusionsEnabled
- getOcclusionsEnabled
- setJetpackWeaponEnabled
- getJetpackWeaponEnabled
- setAircraftMaxVelocity
- getAircraftMaxVelocity
- setMoonSize
- getMoonSize
- resetMoonSize