toggleVehicleRespawn | Multi Theft Auto: Wiki Skip to content

toggleVehicleRespawn

Client-side
Server-side
Shared

Pair: isVehicleRespawnable

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function toggles whether or not the vehicle will be respawned after blown or idle.

OOP Syntax Help! I don't understand this!

  • Method:vehicle:toggleRespawn(...)
  • Variable: .respawnable

Syntax

bool toggleVehicleRespawn ( vehicle theVehicle, bool Respawn )
Required Arguments
  • theVehicle: The vehicle you wish to toggle the respawning of.
  • Respawn: A boolean determining if the vehicle will respawn or not.

Returns

  • bool: value

Returns true if the vehicle was found and edited.

Code Examples

shared

This example defines a console command that will disable respawning for the vehicle that the player is currently in.

function doNotRespawn ( thePlayer )
local theVehicle = getPlayerOccupiedVehicle ( thePlayer )
if ( theVehicle ) then
toggleVehicleRespawn ( theVehicle, false ) -- tell the server not to respawn this vehicle
end
end
addCommandHandler("donotrespawn", doNotRespawn)

See Also

Vehicle Functions