ToggleVehicleRespawn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
This function toggles whether or not the vehicle will be respawned after blown or idle.
This function toggles whether or not the vehicle will be respawned after blown or idle.


Line 10: Line 11:


==Returns==
==Returns==
Returns 'true' if the vehicle was found and edited.
Returns ''true'' if the vehicle was found and edited.


==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler ( "onPlayerConsole", root, "onPlayerConsole" )
function doNotRespawn ( player )
function onPlayerConsole ( text )
     local vehicle = getPlayerOccupiedVehicle ( player )
  command = gettok ( text, 1, 32 )
  if ( command == "doNotRespawn" ) then
     vehicle = getPlayerOccupiedVehicle ( source )
     if ( vehicle ) then
     if ( vehicle ) then
      toggleVehicleRespawn ( vehicle, false ) -- tell the server not to respawn this vehicle
        toggleVehicleRespawn ( vehicle, false ) -- tell the server not to respawn this vehicle
     end
     end
  end
end
end
addCommandHandler("donotrespawn", doNotRespawn)
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Vehicle functions}}
{{Vehicle functions}}

Revision as of 17:12, 15 August 2007

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

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

Returns true if the vehicle was found and edited.

Example

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

See Also