CityRP Documentation Repository

core.plugins.vehicles.sv_init

Serverside Vehicle Plugin.

Functions

ServerCanPlayerEnterVehicleexitloc(ply, vehicle, role)Source ☍

Remember where a player stood when they got in, so leaving can offer them that spot back. A hull-tested candidate for vmGetVehicleExitPos, not a placement: the car may have parked against something since.

Parameters

  • plyPlayerThe player entering the vehicle.
  • vehicleVehicleThe vehicle or seat being entered.
  • rolenumberUnused.
Servercityrp.remotedoor(ply)Source ☍

Toggle a remote door.

Parameters

  • plyanyThe player firing off a remote door request.
Servercityrp.siren(ply)Source ☍

Parameters

  • plyany
ServergetVehicleFilter(veh) → tableSource ☍

Fetch a vehicle filter for a given vehicle.

Parameters

  • vehany

Returns

  1. table
ServeronVehicleLightsUsed(ply, group)Source ☍

Inventory function called when attempting to load up civilian emergency lighting on a vehicle.

Parameters

  • plyanyThe player loading lighting.
  • groupanyThe type of lighting.
ServervmDoEnterVehicle(player, vehicle, role) → boolean|nilSource ☍

Hook called when a player requests to enter a vehicle.

Parameters

  • playerany
  • vehicleany
  • roleany

Returns

  1. boolean|nilIf the entry was allowed.
ServervmDoVehicleExit(ply)Source ☍

Hook called when a player attempts to exit the vehicle. Calls vmGetVehicleExit. Deals with being injured from ejecting, etc. Chasecam restore happens in PlayerLeaveVehicle so we never re-enable it while the player is still seated (or when the exit is denied for speed/locks).

Parameters

  • plyany
ServervmEnterVehicle(ply, vehicle, role) → boolean|nilSource ☍

Hook called when a player enters a vehicle. Handles interactions with emergency lighting, team restricted vehicles and such.

Parameters

  • plyanyThe player entering the vehicle.
  • vehicleanyThe vehicle being entered.
  • roleanyUnused.

Returns

  1. boolean|nilIf the entry was allowed.
ServervmExitCar(ply, key) → boolean|nilSource ☍

Called when a player presses a key to request exit from the vehicle. Handles internal locking and passes onto exits.

Parameters

  • plyany
  • keyany

Returns

  1. boolean|nil
ServervmGetVehicleExit(player, vehicle, force) → boolean?Source ☍

Hook called when a player exits a vehicle.

Parameters

  • playerPlayerThe player exiting the vehicle.
  • vehicleVehicleThe vehicle or passenger seat being exited.
  • forceboolean?Should the player be forced out of the vehicle? (e.g. if hostaged/cuffed)

Returns

  1. boolean?Return false to deny the exit; return nil to allow default behaviour.
ServervmGetVehicleExitPos(vehicle, ply) → Vector?, Angle?Source ☍

Resolve where somebody leaving a vehicle should be placed. A candidate has to be clear of geometry, standing on something, reachable from the vehicle and inside the map, so placing somebody never puts them through a wall or off the world. alone — the seat has no vehicle, or nothing around it is usable.

Parameters

  • vehicleVehicleThe vehicle or passenger seat being left.
  • plyPlayer?The player being placed; their hull is what candidates are tested against.

Returns

  1. 1Vector?World position to place them at, or nil to leave the engine's own placement
  2. 2Angle?Eye angles to face them in on arrival, for CityRP vehicles only.
ServervmRepositionPlayer(ply, veh)Source ☍

Adjust a players sitting position based on pre-defined configs.

Parameters

  • plyanyThe player having their position ajusted.
  • vehanyThe vehicle of which the player is sitting in.
ServervmSpawnedVehicle(player, vehicle)Source ☍

Called when a vehicle has been spawned. Sets up skins, bodygroups, fixes collisions.

Parameters

  • playeranyThe player who spawned the vehicle.
  • vehicleanyThe vehicle which was spawned.