SetCameraInterior: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Added example.)
mNo edit summary
 
(8 intermediate revisions by 7 users not shown)
Line 8: Line 8:
bool setCameraInterior ( player thePlayer, int interior )
bool setCameraInterior ( player thePlayer, int interior )
</syntaxhighlight>
</syntaxhighlight>
 
{{OOP||[[player]]:setCameraInterior|cameraInterior|getCameraInterior}}
===Required Arguments===
===Required Arguments===
*'''thePlayer:''' the player whose camera interior will be set.
*'''thePlayer:''' the player whose camera interior will be set.
Line 18: Line 18:
bool setCameraInterior ( int interior )
bool setCameraInterior ( int interior )
</syntaxhighlight>
</syntaxhighlight>
 
{{OOP||Camera.setInterior|interior|getCameraInterior}}
===Required Arguments===
===Required Arguments===
*'''interior:''' the interior to place the camera in.
*'''interior:''' the interior to place the camera in.
Line 33: Line 33:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function setCamInt( thePlayer, commandName, intID )
function setCamInt( thePlayer, commandName, intID )
         if( intID )then
         if( intID )then -- If there is an ID
local seted = setCameraInterior( thePlayer, intID )
local seted = setCameraInterior( thePlayer, intID ) -- set the interior to the camera
                 if( seted )then
                 if( seted )then -- If it has been changed correctly
                         outputChatBox( "Your camera's interior has been seted to "..intID, thePlayer )
                         outputChatBox( "Your camera's interior has been set to "..intID, thePlayer ) -- Tell to the player his new camera's interior
                 else
                 else -- otherwise
                         outputChatBox( "Can't change your camera's interior...", thePlayer, 255, 0, 0 )
                         outputChatBox( "Can't change your camera's interior...", thePlayer, 255, 0, 0 ) -- Tell him the change failed
                 end
                 end
else
else -- otherwise
outputChatBox( "Syntax: /caminterior [interiorID] ", thePlayer, 255, 0, 0 )
outputChatBox( "Syntax: /caminterior [interiorID] ", thePlayer, 255, 0, 0 ) -- Tell him the correct syntax
end
end
end
end
Line 50: Line 50:
<strong> This example make a command to change your cam interior to a selected one. </strong>
<strong> This example make a command to change your cam interior to a selected one. </strong>
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function setCam(thePlayer,command,int)
function setCam(command,int)
     if (int) then
     if (int) then
local setInt = setCameraInterior(thePlayer,int)
local setInt = setCameraInterior(int)
                 if (setInt) then
                 if (setInt) then
                         outputChatBox("Your camera's interior has been set to "..int,255,255,0)
                         outputChatBox("Your camera's interior has been set to "..int,255,255,0)
Line 68: Line 68:
==See Also==
==See Also==
{{Client_camera_functions}}
{{Client_camera_functions}}
[[hu:setCameraInterior]]
[[RO:setCameraInterior]]

Latest revision as of 08:17, 10 October 2020

Sets the interior of the local camera. Only the interior of the camera is changed, the local player stays in the interior he was in.

Syntax

Click to collapse [-]
Server
bool setCameraInterior ( player thePlayer, int interior )

OOP Syntax Help! I don't understand this!

Method: player:setCameraInterior(...)
Variable: .cameraInterior
Counterpart: getCameraInterior


Required Arguments

  • thePlayer: the player whose camera interior will be set.
  • interior: the interior to place the camera in.
Click to collapse [-]
Client
bool setCameraInterior ( int interior )

OOP Syntax Help! I don't understand this!

Method: Camera.setInterior(...)
Variable: .interior
Counterpart: getCameraInterior


Required Arguments

  • interior: the interior to place the camera in.

Returns

Returns true if the camera's interior was changed successfully, false otherwise.

Example

Click to collapse [-]
Server

This example make a command to change your cam interior to a selected one.

function setCamInt( thePlayer, commandName, intID )
        if( intID )then -- If there is an ID
		local seted = setCameraInterior( thePlayer, intID ) -- set the interior to the camera
                if( seted )then -- If it has been changed correctly
                        outputChatBox( "Your camera's interior has been set to "..intID, thePlayer ) -- Tell to the player his new camera's interior
                else -- otherwise
                        outputChatBox( "Can't change your camera's interior...", thePlayer, 255, 0, 0 ) -- Tell him the change failed
                end
	else -- otherwise 
		outputChatBox( "Syntax: /caminterior [interiorID] ", thePlayer, 255, 0, 0 ) -- Tell him the correct syntax
	end
end
addCommandHandler( "caminterior", setCamInt )
Click to collapse [-]
Client

This example make a command to change your cam interior to a selected one.

function setCam(command,int)
    if (int) then
		local setInt = setCameraInterior(int)
                if (setInt) then
                        outputChatBox("Your camera's interior has been set to "..int,255,255,0)
                else
                        outputChatBox("Can't change your camera's interior...",255,0,0)
                end
	else
		outputChatBox("Syntax: /camera [interiorID] ",255,0,0)
	end
end
addCommandHandler("camera",setCam)

See Also