Difference between revisions of "OnClientVehicleExit"

From Multi Theft Auto: Wiki
 
Line 1: Line 1:
 
[[Category:Incomplete Event]]
 
[[Category:Incomplete Event]]
 +
{{Client event}}
 +
__NOTOC__
 +
This event gets fired when a player gets out of a vehicle.
  
__NOTOC__
+
==Parameters==
This event is blahblah and is used for blahblah.
+
*'''player:''' the player that exited the vehicle
 +
*'''seat:''' the number of the seat that the player was sitting on. 0 = driver, higher numbers are passenger seats.
  
==Syntax==  
+
==Source==
<syntaxhighlight lang="lua">
+
The source of the event is the vehicle that the player exited.
void onClientVehicleExit ( player thePlayer, int seat )
 
</syntaxhighlight>
 
  
 
==Example==  
 
==Example==  
This example does...
+
This code updates a GUI label with the name of the vehicle the local player is in.
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
--This line does...
+
lblVehicle = guiCreateLabel(10, 200, 150, 20, "Currently on foot", false)
blabhalbalhb --abababa
+
addEventHandler("onClientVehicleEnter", getRootElement(),
--This line does this...
+
    function(thePlayer, seat)
mooo
+
        if thePlayer == getLocalPlayer() then
 +
            guiSetText(lblVehicle, "Currently in a " .. getVehicleName(source))
 +
        end
 +
    end
 +
)
 +
addEventHandler("OnClientVehicleExit", getRootElement(),
 +
    function(thePlayer, seat)
 +
        if thePlayer == getLocalPlayer() then
 +
            guiSetText(lblVehicle, "Currently on foot")
 +
        end
 +
    end
 +
)
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 17:53, 14 December 2007

This event gets fired when a player gets out of a vehicle.

Parameters

  • player: the player that exited the vehicle
  • seat: the number of the seat that the player was sitting on. 0 = driver, higher numbers are passenger seats.

Source

The source of the event is the vehicle that the player exited.

Example

This code updates a GUI label with the name of the vehicle the local player is in.

lblVehicle = guiCreateLabel(10, 200, 150, 20, "Currently on foot", false)
addEventHandler("onClientVehicleEnter", getRootElement(),
    function(thePlayer, seat)
        if thePlayer == getLocalPlayer() then
            guiSetText(lblVehicle, "Currently in a " .. getVehicleName(source))
        end
    end
)
addEventHandler("OnClientVehicleExit", getRootElement(),
    function(thePlayer, seat)
        if thePlayer == getLocalPlayer() then
            guiSetText(lblVehicle, "Currently on foot")
        end
    end
)