Ok so I'm trying to make it so when the user jumps in a car if there is a driver loop through all other seats to see if there is a seat available if it is get in to that seat and not actually jack the car.
Heres what I was thinking of doing but I noticed warpplayer is now being made redundant and couldn't find a similar command. Any ideas?
Thanks,
Carl
function enterVehicle ( vehicle, seat, jacked ) --when a player enters a vehicle
local occupants = getVehicleOccupants(vehicle) -- Get all vehicle occupants
local seats = getVehicleMaxPassengers(vehicle) -- Get the amount of passenger seats
for seat = 0, seats do
local occupant = occupants[seat]
if occupant and getElementType(occupant)=="player" then -- If the seat is occupied by a player...
occupant = getPlayerName(occupant) -- ... get his name
outputConsole("Seat "..seat..": "..occupant,player) -- Print who's in the seat
else
warpPlayerIntoVehicle ( source, vehicle, seat)
end
end
end
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), enterVehicle )