OnClientPlayerStuntStart: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Dox'd)
 
m (Typo in the event handler in example.)
(3 intermediate revisions by 2 users not shown)
Line 15: Line 15:


==Example==  
==Example==  
[[Category:Needs Example]]
This is a simple stunt script which tells player what stunt he/she started and finished, time the stunt taken to perform and distance travelled while stunting.
<syntaxhighlight lang="lua">
addEventHandler( "onClientPlayerStuntStart", getRootElement( ),
    function ( stuntType )
        outputChatBox( "You started stunt: " .. stuntType );
    end
);
 
addEventHandler( "onClientPlayerStuntFinish", getRootElement( ),
    function ( stuntType, stuntTime, distance )
        outputChatBox( "You finished stunt: " .. stuntType ..", Time: " .. tostring( stuntTime ).. ", Distance: " .. tostring( distance ) );
    end
);
</syntaxhighlight>


==See Also==
==See Also==
{{Event_functions}}
===Client player events===
{{Client_player_events}}
===Client event functions===
{{Client_event_functions}}

Revision as of 17:39, 15 May 2010

This event is triggered whenever the local player starts doing a vehicle stunt.

Parameters

string stuntType
  • stuntType: the type of stunt the player is starting to perform. Valid types are:
    • 2wheeler
    • wheelie
    • stoppie

Source

The source of this event is the local player.

Example

This is a simple stunt script which tells player what stunt he/she started and finished, time the stunt taken to perform and distance travelled while stunting.

addEventHandler( "onClientPlayerStuntStart", getRootElement( ),
    function ( stuntType )
        outputChatBox( "You started stunt: " .. stuntType );
    end
);

addEventHandler( "onClientPlayerStuntFinish", getRootElement( ),
    function ( stuntType, stuntTime, distance )
        outputChatBox( "You finished stunt: " .. stuntType ..", Time: " .. tostring( stuntTime ).. ", Distance: " .. tostring( distance ) );
    end
);

See Also

Client player events


Client event functions