RemovePlayerFromVehicle
From Multi Theft Auto: Wiki
This function is deprecated. This means that its use is discouraged and that it might not exist in future versions. | |
Please use removePedFromVehicle instead. |
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 ( player thePlayer )
Required Arguments
- thePlayer: 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.
local policevehicles = { [596]=true, [597]=true, [598]=true, [599]=true } -- make a table of police vehicle IDs local policeskins = { [283]=true, [284]=true, [285]=true, [286]=true } -- make a table of police skin IDs function enterVehicle ( theVehicle, seat, jacked ) -- when a player enters a vehicle local skinID = getPlayerSkin ( source ) -- get his skin ID local vehID = getVehicleID ( theVehicle ) if policevehicles[vehID] and not policeskins[skinID] 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 policemen can enter police cars!", source ) -- and tell the player why end end addEventHandler ( "onPlayerEnterVehicle", getRootElement(), enterVehicle ) -- add an event for onPlayerEnterVehicle
See Also
FROM VERSION 1.5.7 r19626 ONWARDS
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getModelHandling
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
FROM VERSION 1.6 r7485 ONWARDS
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleRespawnPosition
- getVehicleRespawnRotation
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- getVehiclesOfType
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleSirens
- removeVehicleUpgrade
- resetVehicleExplosionTime
- resetVehicleIdleTime
- respawnVehicle
- setModelHandling
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
FROM VERSION 1.6 r7485 ONWARDS
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleIdleRespawnDelay
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleRespawnDelay
- setVehicleRespawnPosition
- setVehicleRespawnRotation
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition