- Documentation
- Server functions
- removePedFromVehicle
Function
removePedFromVehicle
Instantly takes a player or an NPC out of a vehicle and places them next to it, without the get-out animation. It fires onPlayerVehicleExit just like a normal exit and blocks the player from getting back in for 3 seconds so the game does not put them back. Returns false when the ped is not in a vehicle.
Syntax
bool removePedFromVehicle(ped ped)Arguments
pedped- A player or an NPC.
Returns
true on success, false when the ped was on foot.
Example
addCommandHandler("wyrzuc", function(admin, _, name)
local target = getPlayerFromName(name or "")
if target and isPedInVehicle(target) then removePedFromVehicle(target) end
end)
See also
warpPedIntoVehicleInstantly puts a player or an NPC into the chosen vehicle seat, without walking up and without the get-in animation. If the ped was in another car, it is taken out of it first. When the chosen seat is occupied by someone else, nothing happens and the function returnsfalse. The player's game receives the order immediately, and the server blocks the player from getting out on their own for 3 seconds so the warp is not undone. An NPC in a vehicle always stays seated: while it is in the car, its body has no collision (only bullets hit it), walking and turning wait until it leaves the car, and if the game takes it out of the seat, the client puts it back at once.setPedExitVehicleTakes a ped out of its vehicle on the server, records its "exit vehicle" task and sends every client theonClientPedExitRequestevent (ped, vehicle). The exit works likeremovePedFromVehicle, i.e. instantly, without the door animation. Returnsfalsewhen the ped is not in a vehicle.