ToggleVehicleRespawn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(OOP)
 
(3 intermediate revisions by 3 users not shown)
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool toggleVehicleRespawn ( vehicle theVehicle, bool Respawn )</syntaxhighlight>
<syntaxhighlight lang="lua">bool toggleVehicleRespawn ( vehicle theVehicle, bool Respawn )</syntaxhighlight>
 
{{OOP||[[vehicle]]:toggleRespawn}}
===Required Arguments===
===Required Arguments===
*'''theVehicle''': The [[vehicle]] you wish to toggle the respawning of.
*'''theVehicle''': The [[vehicle]] you wish to toggle the respawning of.
Line 14: Line 14:


==Example==
==Example==
This example defines a console command that will disable respawning for the vehicle that the player is currently in.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function doNotRespawn ( player )
function doNotRespawn ( thePlayer )
     local vehicle = getPlayerOccupiedVehicle ( player )
     local theVehicle = getPlayerOccupiedVehicle ( thePlayer )
     if ( vehicle ) then
     if ( theVehicle ) then
         toggleVehicleRespawn ( vehicle, false ) -- tell the server not to respawn this vehicle
         toggleVehicleRespawn ( theVehicle, false ) -- tell the server not to respawn this vehicle
     end
     end
end
end

Latest revision as of 23:51, 17 December 2014

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

Syntax

bool toggleVehicleRespawn ( vehicle theVehicle, bool Respawn )

OOP Syntax Help! I don't understand this!

Method: vehicle:toggleRespawn(...)


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

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

Shared