OnClientVehicleNitroStateChange: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Created page with "{{Client event}} __NOTOC__ This event gets triggered when nitro state is changing. ==Parameters== <syntaxhighlight lang="lua"> bool state </syntaxhighlight> *'''state:''' current state of nitro ==Source==...")
 
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 2: Line 2:
__NOTOC__
__NOTOC__
This event gets triggered when nitro state is changing.
This event gets triggered when nitro state is changing.
 
{{Note|This event is only triggered for vehicles that are streamed in}}
==Parameters==
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 13: Line 13:


==Example==
==Example==
This example get short chat message on nitro state changing.
This example is showing short chat message on nitro state changing.
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function nitroState(state)     
function nitro_updateState(state)     
     if (state == true) then
     if state then
         outputChatBox("You starts using nitro...", 150, 255, 150, true)
         outputChatBox("Nitro #00FF00activated!", 255, 200, 0, true)
     elseif (state == false) then
     elseif not state then
         outputChatBox("Nitro fuel gots empty...", 255, 150, 150, true)
         outputChatBox("Nitro #FF0000deactivated!", 255, 200, 0, true)
     end
     end
end   
end   
addEventHandler("onClientVehicleNitroStateChange", getRootElement(), nitroState)
addEventHandler("onClientVehicleNitroStateChange", root, nitro_updateState)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==

Latest revision as of 02:55, 20 January 2015

This event gets triggered when nitro state is changing.

[[{{{image}}}|link=|]] Note: This event is only triggered for vehicles that are streamed in

Parameters

bool state
  • state: current state of nitro

Source

The source of this event is the player vehicle.

Example

This example is showing short chat message on nitro state changing.

Click to collapse [-]
Client
function nitro_updateState(state)    
    if state then
        outputChatBox("Nitro #00FF00activated!", 255, 200, 0, true)
    elseif not state then
        outputChatBox("Nitro #FF0000deactivated!", 255, 200, 0, true)
    end
end   
addEventHandler("onClientVehicleNitroStateChange", root,  nitro_updateState)

See Also

Client vehicle events


Client event functions