Vehicle
Shared Vehicle Metatable.
- ServerVehicle:_AddHP(hp, save) → numberSource ☍
-
Add HP to a vehicle. This is a higher level interface, so clamps HP in the 0 - 100 range.
Parameters
- hpnumberHealth to add.
- savebooleanIf the HP should be saved in the DB (default: true).
Returns
- numberHP.
- ServerVehicle:AddHP(hp, save) → number, boolean, booleanSource ☍
-
Adds HP to a vehicle and runs appropriate actions (disabling the vehicle on 0 HP). This is a high level interface, so clamps HP in the 0 - 100 range.
Parameters
- hpnumberHealth to add.
- savebooleanIf the HP should be saved in the DB (default: true).
Returns
- 1numberHP.
- 2booleanthe vehicle is stopping.
- 3booleanthe vehicle is starting.
- SharedVehicle:CarName() → stringSource ☍
-
Get the name of a vehicle.
Returns
- stringThe name of the vehicle.
- SharedVehicle:CarOwner(type) → EntitySource ☍
-
Get the owner of a vehicle.
Parameters
- typestring?The type of owner to return (string/name or entity).
Returns
- Entityowner entity.
- SharedVehicle:GetHP() → numberSource ☍
-
Get the vehicle's HP.
Returns
- numberhealth.
- SharedVehicle:getVehicleLocation() → stringSource ☍
-
Function that returns the current location of the vehicle.
Returns
- stringThe position of the vehicle.
- SharedVehicle:HasControlPermission(player) → booleanSource ☍
-
Checks if a player has permission to control this vehicle.
Parameters
- playerPlayerThe player entity to check permission for.
Returns
- booleanTrue if the player has permission, false otherwise.
- ServerVehicle:InternalLock()Source ☍
-
Removed and deprecated.
- SharedVehicle:InternalLocked() → booleanSource ☍
-
Check if a car is internally locked.
Returns
- booleanthe vehicle has been internally locked.
- ServerVehicle:InternalUnLock()Source ☍
-
Removed and deprecated.
- SharedVehicle:IsDestroyed() → booleanSource ☍
-
Gets if the vehicle is "destroyed".
Returns
- booleanthe vehicle is destroyed.
- ServerVehicle:lock(emote)Source ☍
-
Lock a vehicle.
Parameters
- emotebooleanAdd notification, sound and lockdelay if true.
- SharedVehicle:OwnerWarranted() → booleanSource ☍
-
Check if a car is marked as wanted.
Returns
- booleanthe car is marked as wanted.
- ServerVehicle:SetHP(hp, save) → numberSource ☍
-
Set the vehicle's new HP. This is a low level interface, so does not clamp HP in the 0 - 100 range.
Parameters
- hpnumberNew health.
- savebooleanIf the HP should be saved in the DB (default: true).
Returns
- numberHP.
- ServerVehicle:TurnOff(emote)Source ☍
-
Turn off a vehicle.
Parameters
- emotebooleanDetermine if player should emote the action or not.
- ServerVehicle:TurnOn(emote)Source ☍
-
Turn on a vehicle.
Parameters
- emotebooleanDetermine if player should emote the action or not.
- ServerVehicle:unlock(emote)Source ☍
-
Unlock a vehicle.
Parameters
- emotebooleanAdd notification, sound and unlockdelay if true.
- SharedVehicleSource ☍
-
The vehicle metatable, with CityRP's own additions to Garry's Mod's
Vehicle.