RemovePlayerFromVehicle: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This | This function removes a player from a vehicle immediately. This works for drivers and passengers. Note that this removes the player from the vehicle and puts him in the exact position where the command was initiated. | ||
==Syntax== | ==Syntax== | ||
Line 10: | Line 8: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''player:''' The player you wish to remove from a vehicle | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if | Returns ''true'' if the operation was successful, ''false'' otherwise. | ||
==Example== | ==Example== | ||
This example | This example forces a player out of a police vehicle if he is not a policeman. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" ) --add an event for onPlayerEnterVehicle | ||
function onPlayerEnterVehicle ( vehicle, seat, jacked ) --when a player enters a vehicle | |||
-- | if ( vehicle == 598 or 596 or 597 or 599 ) and ( getPlayerSkin ( source ) ~= 280 or 281 or 282 or 283 or 284 or 285 or 286 ) then --if the vehicle is one of 4 police cars, and the skin is not a police skin | ||
removePlayerFromVehicle ( source )--force the player out of the vehicle | |||
outputChatBox ( "Only policeman can enter police cars!", source ) --and tell the player why | |||
end | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{ | {{Vehicle functions}} |
Revision as of 21:17, 13 August 2006
This function removes a player from a vehicle immediately. This works for drivers and passengers. Note that this removes the player from the vehicle and puts him in the exact position where the command was initiated.
Syntax
bool removePlayerFromVehicle ( element player )
Required Arguments
- player: The player you wish to remove from a vehicle
Returns
Returns true if the operation was successful, false otherwise.
Example
This example forces a player out of a police vehicle if he is not a policeman.
addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" ) --add an event for onPlayerEnterVehicle function onPlayerEnterVehicle ( vehicle, seat, jacked ) --when a player enters a vehicle if ( vehicle == 598 or 596 or 597 or 599 ) and ( getPlayerSkin ( source ) ~= 280 or 281 or 282 or 283 or 284 or 285 or 286 ) then --if the vehicle is one of 4 police cars, and the skin is not a police skin removePlayerFromVehicle ( source )--force the player out of the vehicle outputChatBox ( "Only policeman can enter police cars!", source ) --and tell the player why end end
See Also
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates