https://wiki.multitheftauto.com/api.php?action=feedcontributions&user=Dzakub&feedformat=atomMulti Theft Auto: Wiki - User contributions [en]2024-03-29T09:07:27ZUser contributionsMediaWiki 1.39.3https://wiki.multitheftauto.com/index.php?title=Talk:GetVehicleModelFromName&diff=24055Talk:GetVehicleModelFromName2010-07-17T17:30:17Z<p>Dzakub: </p>
<hr />
<div>This function doesn't recognise names such as RC Cam or Police Maverick<br />
[[User:Dzakub|Dzakub]] 17:30, 17 July 2010 (UTC)</div>Dzakubhttps://wiki.multitheftauto.com/index.php?title=Talk:GetVehicleModelFromName&diff=24054Talk:GetVehicleModelFromName2010-07-17T17:29:53Z<p>Dzakub: Created page with 'This function doesn't recognise names such as RC Cam or Police Maverick'</p>
<hr />
<div>This function doesn't recognise names such as RC Cam or Police Maverick</div>Dzakubhttps://wiki.multitheftauto.com/index.php?title=SetGarageOpen&diff=22008SetGarageOpen2009-12-03T18:28:26Z<p>Dzakub: I think it will help</p>
<hr />
<div>__NOTOC__ <br />
{{Server client function}}<br />
This function opens or closes the specified garage door in the world.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool setGarageOpen ( int garageID, bool open )<br />
</syntaxhighlight> <br />
<br />
===Required Arguments=== <br />
*'''garageID:''' The [[Garage|garage ID]] that represents the garage door being opened or closed.<br />
*'''isOpen:''' A boolean indicating whether or not to open the door.<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' if an invalid garage id was given.<br />
<br />
==Example== <br />
<section name="Server" class="server" show="true"><br />
This example opens a garage door when a player enters a collision shape near it, and closes it when they leave:<br />
<syntaxhighlight lang="lua"><br />
GARAGE_ID = 25<br />
<br />
-- create a collision shape and attach event handlers to it when the resource starts<br />
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()),<br />
function (resource)<br />
local garageCube = createColCube(1337, 194, 28, 6, 10, 4)<br />
addEventHandler("onColShapeHit", garageCube, onGarageCubeHit)<br />
addEventHandler("onColShapeLeave", garageCube, onGarageCubeLeave)<br />
end)<br />
<br />
-- open the door when someone enters the garage's collision shape<br />
function onGarageCubeHit(hitElement, matchingDimension)<br />
if (getElementType(hitElement) == "player") then<br />
-- check to make sure the door is closed<br />
if (not isGarageOpen(GARAGE_ID)) then<br />
-- open the door<br />
setGarageOpen(GARAGE_ID, true)<br />
end<br />
end<br />
end<br />
<br />
-- close the door when someone leaves the garage's collision shape<br />
function onGarageCubeLeave(leaveElement, matchingDimension)<br />
if (getElementType(leaveElement) == "player") then<br />
-- check to make sure the door is open<br />
if (isGarageOpen(GARAGE_ID)) then<br />
-- close the door<br />
setGarageOpen(GARAGE_ID, false)<br />
end<br />
end<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{World functions}}<br />
<br />
*[[Garage|Garage IDs]]</div>Dzakub