SetTrainDerailable: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (void -> bool)
Line 19: Line 19:
<section name="Example" class="server" show="true">
<section name="Example" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- TODO
function makeTrain(thePlayer)
local myTrain = createVehicle(537,1995,-1949,13)  -- This will make a freight train just east of the LS train station
setTrainDerailable(myTrain, false) -- myTrain can not be derailed now
outputChatBox("A freight train has been created for you.", thePlayer) -- Just a simple message for the player
end
addCommandHandler("trainmeup", makeTrain)
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 16:20, 30 December 2009

This function will set a train or tram as derailable. This is, if it can derail when it goes above the maximum speed.

Syntax

bool setTrainDerailable ( vehicle derailableVehicle, bool derailable )              

Required Arguments

  • derailableVehicle: The vehicle that you wish to set derailable.
  • derailable: whether the train or tram is derailable. True as derailable, False as non-derailable.

Returns

Returns true if the state was successfully set, false otherwise.

Example

Click to collapse [-]
Example
function makeTrain(thePlayer)
	local myTrain = createVehicle(537,1995,-1949,13)  -- This will make a freight train just east of the LS train station
	setTrainDerailable(myTrain, false) -- myTrain can not be derailed now
	outputChatBox("A freight train has been created for you.", thePlayer) -- Just a simple message for the player
end
addCommandHandler("trainmeup", makeTrain)

See Also