SetCursorAlpha: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Example added)
(Remove obsolete Requirements section)
 
(17 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{client function}}
{{client function}}
{{New feature/item|3.0132|1.4|5242|
This function is used to change alpha (transparency) from the client's cursor.
This function is used to change alpha (transparency) from the client's cursor.
}}


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setCursorAlpha( float alpha )
bool setCursorAlpha( int alpha )
</syntaxhighlight>
</syntaxhighlight>
 
[[File:SetCursorAlpha.jpg|thumb|example of cursor alpha]]
===Required Arguments===
===Required Arguments===
*'''alpha ''': The alpha value to set. Value can be 0-255, where 255 is fully opaque and 0 is fully transparent.
*'''alpha ''': The alpha value to set. Value can be 0-255, where 255 is fully opaque and 0 is fully transparent.
Line 14: Line 12:
===Returns===
===Returns===
Returns ''true'' if the new alpha value was set, or ''false'' otherwise.
Returns ''true'' if the new alpha value was set, or ''false'' otherwise.
==Requirements==
{{Requirements|n/a|1.4}}


==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- Simple command to test setCursorAlpha function
-- Simple command to test the setCursorAlpha function
addCommandHandler( "cursorAlpha",  
addCommandHandler( "cursorAlpha",  
     function ()
     function ()
         -- Show the cursor if it is not showing or hide the cursor if it is
         -- Show the cursor if it is not showing or hide the cursor if it is
         showCursor( not isCursorShowing ( ) )
         showCursor( not isCursorShowing ( ) )
         -- Set the alpha to 150
         -- Set the alpha to 100
         setCursorAlpha( 150 )
         setCursorAlpha(100)
     end
     end
)
)
Line 32: Line 27:


==See Also==
==See Also==
{{GUI_functions}}
{{Cursor_functions|client}}
 
[[hu:setCursorAlpha]]

Latest revision as of 17:11, 7 November 2024

This function is used to change alpha (transparency) from the client's cursor.

Syntax

bool setCursorAlpha( int alpha )
example of cursor alpha

Required Arguments

  • alpha : The alpha value to set. Value can be 0-255, where 255 is fully opaque and 0 is fully transparent.

Returns

Returns true if the new alpha value was set, or false otherwise.

Example

-- Simple command to test the setCursorAlpha function
addCommandHandler( "cursorAlpha", 
    function ()
        -- Show the cursor if it is not showing or hide the cursor if it is
        showCursor( not isCursorShowing ( ) )
        -- Set the alpha to 100
        setCursorAlpha(100)
    end
)

See Also