EngineSetModelVisibleTime: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
{{New feature/item|3.0160|1.5.8|20416|This function changes model visibility time, this is used for example for building lights being shown after 23:00.}}
{{Added feature/item|1.5.9|1.5.8|20704|This function changes model visibility time, this is used for example for building lights being shown after 23:00.}}


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool engineSetModelVisibleTime( int model_id, int timeOn, int timeOff )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool engineSetModelVisibleTime ( int modelID, int timeOn, int timeOff )</syntaxhighlight>  
===Required Arguments===
===Required Arguments===
*'''modelID''': ID of the model
*'''modelID''': The ID of the model.
*'''timeOn''': value between 23 and 0 that states when the model should appear
*'''timeOn''': Value between 0 and 24 that states when the model should appear.
*'''timeOff''': value between 23 and 0 that states when the model should disappear
*'''timeOff''': Value between 0 and 24 that states when the model should disappear.


===Returns===
===Returns===
Returns '''true''' if the change was successful, '''false''' otherwise.
Returns ''true'' if the change was successful, ''false'' otherwise.


==Example==  
==Example==  
<section name="Client" class="client" show="true">
Make Los Santos Tower visible only between 10 and 12 AM. Please keep in mind that this function does not affect collision - the building is still there, it's just invisible:
Make Los Santos Tower visible only between 10 and 12 AM. Please keep in mind that this function does not affect collision - the building is still there, it's just invisible.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function init()
function init ()
engineSetModelVisibleTime(4550, 10, 12)
    engineSetModelVisibleTime (4550, 10, 12)
end
end
addEventHandler("onClientResourceStart", resourceRoot, init)
 
addEventHandler ("onClientResourceStart", resourceRoot, init)
</syntaxhighlight>
</syntaxhighlight>
</section>


==Requirements==
==Requirements==
{{Requirements|n/a|1.5.8-9.20416|}}
{{Requirements|n/a|1.5.8-9.20704|}}
 
==See Also==
==See Also==
{{Engine_functions}}
{{Engine_functions}}

Latest revision as of 20:36, 23 September 2021

This function changes model visibility time, this is used for example for building lights being shown after 23:00.

Syntax

bool engineSetModelVisibleTime ( int modelID, int timeOn, int timeOff )

Required Arguments

  • modelID: The ID of the model.
  • timeOn: Value between 0 and 24 that states when the model should appear.
  • timeOff: Value between 0 and 24 that states when the model should disappear.

Returns

Returns true if the change was successful, false otherwise.

Example

Make Los Santos Tower visible only between 10 and 12 AM. Please keep in mind that this function does not affect collision - the building is still there, it's just invisible:

function init ()
    engineSetModelVisibleTime (4550, 10, 12)
end

addEventHandler ("onClientResourceStart", resourceRoot, init)

Requirements

Minimum server version n/a
Minimum client version 1.5.8-9.20704

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.5.8-9.20704" />

See Also