<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Karim+squalli</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Karim+squalli"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Karim_squalli"/>
	<updated>2026-04-23T20:41:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FadeCamera&amp;diff=41703</id>
		<title>FadeCamera</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FadeCamera&amp;diff=41703"/>
		<updated>2014-08-30T19:49:28Z</updated>

		<summary type="html">&lt;p&gt;Karim squalli: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function will fade a player's camera to a color or back to normal over a specified time period. This will also affect the sound volume for the player (50% faded = 50% volume, full fade = no sound). For clientside scripts you can perform 2 fade ins or fade outs in a row, but for serverside scripts you must use one then the other.&lt;br /&gt;
&lt;br /&gt;
''Note: The speed of the effect depends directly on the current gamespeed.''&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool fadeCamera ( player thePlayer, bool fadeIn, [ float timeToFade = 1.0, int red = 0, int green = 0, int blue = 0 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[player]]:fadeCamera||}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''thePlayer:''' The player whose camera you wish to fade.&lt;br /&gt;
* '''fadeIn:''' Should the camera be faded in or out? Pass ''true'' to fade the camera in, ''false'' to fade it out to a color.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''timeToFade:''' The number of seconds it should take to fade. Any number less than 1 makes the fade instant.&lt;br /&gt;
* '''red:''' The amount of red in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
* '''green:''' The amount of green in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
* '''blue:''' The amount of blue in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool fadeCamera ( bool fadeIn, [ float timeToFade = 1.0, int red = 0, int green = 0, int blue = 0 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''fadeIn:''' Should the camera be faded in our out? Pass ''true'' to fade the camera in, ''false'' to fade it out to a color.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''timeToFade:''' The number of seconds it should take to fade. Any number less than 1 makes the fade instant.&lt;br /&gt;
* '''red:''' The amount of red in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
* '''green:''' The amount of green in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
* '''blue:''' The amount of blue in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the camera was faded successfully, ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server example&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
When a player gets damaged, place a quick fade-to-red effect on his screen.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function addRednessOnDamage ( )&lt;br /&gt;
      fadeCamera ( source, false, 1.0, 255, 0, 0 )         -- fade the player's camera to red over a period of 1 second&lt;br /&gt;
      setTimer ( fadeCameraDelayed, 500, 1, source )   -- don't let it go to opaque red, interrupt it after half a second and fade back to normal&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerDamage&amp;quot;, getRootElement(), addRednessOnDamage )&lt;br /&gt;
&lt;br /&gt;
function fadeCameraDelayed(player) -- This function prevents debug warnings when the player disconnects while the timer is running.&lt;br /&gt;
      if (isElement(player)) then&lt;br /&gt;
            fadeCamera(player, true, 0.5)&lt;br /&gt;
      end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Camera functions}}&lt;/div&gt;</summary>
		<author><name>Karim squalli</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientKey&amp;diff=41672</id>
		<title>OnClientKey</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientKey&amp;diff=41672"/>
		<updated>2014-08-28T16:09:34Z</updated>

		<summary type="html">&lt;p&gt;Karim squalli: /* Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event triggers whenever the user presses a button on their keyboard.&lt;br /&gt;
This event can also be used to see if the client scrolls his mousewheel.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string button, bool pressOrRelease&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* '''button''':  This refers the button pressed. see [[https://wiki.multitheftauto.com/wiki/Key_names]] for list of keys string&lt;br /&gt;
* '''pressOrRelease''': This refers to whether they were pressing or releasing the key, true when pressing, false when releasing.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the client's [[root element]].&lt;br /&gt;
&lt;br /&gt;
==Cancel effect==&lt;br /&gt;
{{New items|5620|1.4|&lt;br /&gt;
If this event is [[Event system#Canceling|canceled]], then all GTA and MTA binds, bound to the canceled key, won't be triggered.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example will say in chatbox every time the user presses down a a key.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerPressedKey(button, press)&lt;br /&gt;
    if (press) then -- Only output when they press it down&lt;br /&gt;
        outputChatBox(&amp;quot;You pressed the &amp;quot;..button..&amp;quot; key!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientKey&amp;quot;, root, playerPressedKey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example outputs if the client moves his mousewheel.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, function(button,press) &lt;br /&gt;
    -- Since mouse_wheel_up and mouse_wheel_down cant return a release, we dont have to check the press.&lt;br /&gt;
    if button == &amp;quot;mouse_wheel_up&amp;quot; or button == &amp;quot;mouse_wheel_down&amp;quot; then&lt;br /&gt;
        outputDebugString( button .. &amp;quot; moved.&amp;quot; )&lt;br /&gt;
        return true&lt;br /&gt;
    end&lt;br /&gt;
    return false&lt;br /&gt;
end )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===GUI events===&lt;br /&gt;
{{GUI_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>Karim squalli</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientKey&amp;diff=41671</id>
		<title>OnClientKey</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientKey&amp;diff=41671"/>
		<updated>2014-08-28T16:07:42Z</updated>

		<summary type="html">&lt;p&gt;Karim squalli: /* Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event triggers whenever the user presses a button on their keyboard.&lt;br /&gt;
This event can also be used to see if the client scrolls his mousewheel.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string button, bool pressOrRelease&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* '''button''':  This refers the button pressed. see [[https://wiki.multitheftauto.com/wiki/Key_names]] for list of keys&lt;br /&gt;
* '''pressOrRelease''': This refers to whether they were pressing or releasing the key, true when pressing, false when releasing.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the client's [[root element]].&lt;br /&gt;
&lt;br /&gt;
==Cancel effect==&lt;br /&gt;
{{New items|5620|1.4|&lt;br /&gt;
If this event is [[Event system#Canceling|canceled]], then all GTA and MTA binds, bound to the canceled key, won't be triggered.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example will say in chatbox every time the user presses down a a key.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerPressedKey(button, press)&lt;br /&gt;
    if (press) then -- Only output when they press it down&lt;br /&gt;
        outputChatBox(&amp;quot;You pressed the &amp;quot;..button..&amp;quot; key!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientKey&amp;quot;, root, playerPressedKey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example outputs if the client moves his mousewheel.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, function(button,press) &lt;br /&gt;
    -- Since mouse_wheel_up and mouse_wheel_down cant return a release, we dont have to check the press.&lt;br /&gt;
    if button == &amp;quot;mouse_wheel_up&amp;quot; or button == &amp;quot;mouse_wheel_down&amp;quot; then&lt;br /&gt;
        outputDebugString( button .. &amp;quot; moved.&amp;quot; )&lt;br /&gt;
        return true&lt;br /&gt;
    end&lt;br /&gt;
    return false&lt;br /&gt;
end )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===GUI events===&lt;br /&gt;
{{GUI_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>Karim squalli</name></author>
	</entry>
</feed>