SetObjectEditorSpeed: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
 
Line 1: Line 1:
{{Info|Function|Client|1.0}}
{{Info|Function|Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Set the object gizmo editor's speed.}}


{{FuncSyntax|SetObjectEditorSpeed(speed)}}
{{FuncSyntax|SetObjectEditorSpeed(speed)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|speed|__EDIT_ME__}}
{{FuncParam|speed|The speed in UE4 units.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|This function returns '''nil'''.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang='Lua'>
-- Server side
local function Editor_CommandObjectSpeed(player, speed)
if not IsValidPlayer(player) then return end
if speed == nil then return AddPlayerChat(player, 'Usage: /objectspeed <speed>') end
 
speed = tonumber(speed)
if (speed < 0 or speed > 200) then return AddPlayerChat(player, 'Object speed must be between 0 and 200.') end
 
AddPlayerChat(player, 'Object speed set to ' .. speed .. '.')
CallRemoteEvent(player, 'SetEditorSpeed', speed)
end
AddCommand('objectspeed', Editor_CommandObjectSpeed)
 
-- Client side
local function SetObjectEditorSpeed(speed)
SetObjectEditorSpeed(speed)
end
AddRemoteEvent('SetEditorSpeed', SetObjectEditorSpeed)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}

Latest revision as of 15:33, 9 March 2020

SetObjectEditorSpeed

Type: Function
Context: Client
Introduced: v1.0

Description

Set the object gizmo editor's speed.

Syntax

SetObjectEditorSpeed(speed)

Parameters

  • speed
    The speed in UE4 units.

Return Value

  • This function returns nil.

Example

-- Server side
local function Editor_CommandObjectSpeed(player, speed)
	if not IsValidPlayer(player) then return end
	if speed == nil then return AddPlayerChat(player, 'Usage: /objectspeed <speed>') end

	speed = tonumber(speed)
	if (speed < 0 or speed > 200) then return AddPlayerChat(player, 'Object speed must be between 0 and 200.') end

	AddPlayerChat(player, 'Object speed set to ' .. speed .. '.')
	CallRemoteEvent(player, 'SetEditorSpeed', speed)
end
AddCommand('objectspeed', Editor_CommandObjectSpeed)

-- Client side
local function SetObjectEditorSpeed(speed)
	SetObjectEditorSpeed(speed)
end
AddRemoteEvent('SetEditorSpeed', SetObjectEditorSpeed)

See also