RU/setGarageOpen: Difference between revisions
Jump to navigation
Jump to search
(Created page with '__NOTOC__ {{RU/Server client function}} This function opens or closes the specified garage door in the world. ==Использование== <syntaxhighlight lang="lua"> bool setGarageOpen (…') |
No edit summary |
||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{RU/Server client function}} | {{RU/Server client function}} | ||
Эта функция открывает, или закрывает определенную дверь гаража в игре. | |||
==Использование== | ==Использование== | ||
| Line 9: | Line 9: | ||
===Необходимые параметры=== | ===Необходимые параметры=== | ||
*'''garageID:''' | *'''garageID:''' [[RU/Garage|ID гаража]], дверь которого нужно открыть либо закрыть. | ||
*'''isOpen:''' | *'''isOpen:''' параметр, указывающий на открытие либо закрытие двери данного гаража. | ||
===Что возвращается=== | ===Что возвращается=== | ||
Возвращается ''true'', если действие произошло, или ''false'', если был введен неправильный id гаража. | |||
==Пример== | ==Пример== | ||
<section name=" | <section name="Сервер" class="server" show="true"> | ||
В этом примере открывается дверь гаража, когда игрок соприкасается с ней, и закрывает её, когда игрок покидает гараж. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
GARAGE_ID = 25 | GARAGE_ID = 25 | ||
Latest revision as of 09:11, 8 March 2010
Эта функция открывает, или закрывает определенную дверь гаража в игре.
Использование
bool setGarageOpen ( int garageID, bool open )
Необходимые параметры
- garageID: ID гаража, дверь которого нужно открыть либо закрыть.
- isOpen: параметр, указывающий на открытие либо закрытие двери данного гаража.
Что возвращается
Возвращается true, если действие произошло, или false, если был введен неправильный id гаража.
Пример
Click to collapse [-]
СерверВ этом примере открывается дверь гаража, когда игрок соприкасается с ней, и закрывает её, когда игрок покидает гараж.
GARAGE_ID = 25
-- create a collision shape and attach event handlers to it when the resource starts
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()),
function (resource)
local garageCube = createColCube(1337, 194, 28, 6, 10, 4)
addEventHandler("onColShapeHit", garageCube, onGarageCubeHit)
addEventHandler("onColShapeLeave", garageCube, onGarageCubeLeave)
end)
-- open the door when someone enters the garage's collision shape
function onGarageCubeHit(hitElement, matchingDimension)
if (getElementType(hitElement) == "player") then
-- check to make sure the door is closed
if (not isGarageOpen(GARAGE_ID)) then
-- open the door
setGarageOpen(GARAGE_ID, true)
end
end
end
-- close the door when someone leaves the garage's collision shape
function onGarageCubeLeave(leaveElement, matchingDimension)
if (getElementType(leaveElement) == "player") then
-- check to make sure the door is open
if (isGarageOpen(GARAGE_ID)) then
-- close the door
setGarageOpen(GARAGE_ID, false)
end
end
end
Смотри также
- 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