SetWindVelocity: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
This function changes the wind velocity.
This function changes the wind velocity. The wind shakes the vegetation and makes particles fly in a direction. The intensity and direction of the effect deppends of the wind velocity in each axis.


==Syntax==
==Syntax==
Line 9: Line 9:


===Required Arguments===
===Required Arguments===
*'''velocityX''': The velocity of the wind along the x axis
*'''velocityX''': The velocity of the wind along the x axis.
*'''velocityY''': The velocity of the wind along the y axis
*'''velocityY''': The velocity of the wind along the y axis.
*'''velocityZ''': The velocity of the wind along the z axis
*'''velocityZ''': The velocity of the wind along the z axis.


===Returns===
===Returns===
Returns ''true'' if successful, ''false'' otherwise.
Returns ''true'' if successful, ''false'' if bad arguments were passed.


==Example==
==Example==

Latest revision as of 09:58, 18 May 2014

This function changes the wind velocity. The wind shakes the vegetation and makes particles fly in a direction. The intensity and direction of the effect deppends of the wind velocity in each axis.

Syntax

bool setWindVelocity ( float velocityX, float velocityY, float velocityZ )

Required Arguments

  • velocityX: The velocity of the wind along the x axis.
  • velocityY: The velocity of the wind along the y axis.
  • velocityZ: The velocity of the wind along the z axis.

Returns

Returns true if successful, false if bad arguments were passed.

Example

Click to collapse [-]
Client

This example shows how to make a simple /windVelocity command.

local function windVelocityCommand(_, x, y, z)
	-- Ensure all arguments are valid (default to 0 otherwise)
	x = tonumber(x) or 0
	y = tonumber(y) or 0
	z = tonumber(z) or 0
	
	-- Set the wind velocity, and inform the user of the change.
	setWindVelocity(x, y, z)
	outputChatBox("* Wind velocity set to ("..x..", "..y..", "..z..").", 0, 255, 0)
end
addCommandHandler("windVelocity", windVelocityCommand)

See Also