https://wiki.multitheftauto.com/api.php?action=feedcontributions&user=LordHenry&feedformat=atomMulti Theft Auto: Wiki - User contributions [en]2024-03-29T12:58:56ZUser contributionsMediaWiki 1.39.3https://wiki.multitheftauto.com/index.php?title=BindKey&diff=78900BindKey2024-03-19T19:46:49Z<p>LordHenry: </p>
<hr />
<div>{{Server client function}}<br />
__NOTOC__<br />
Binds a player's key to a handler function or command, which will be called when the key is pressed.<br />
<br />
{{Note|Using '''escape''' key or '''F8''' key will always return false. Use [[onClientKey]] event instead.}}<br />
{{Note|Handler function won't be triggered while focused in CEGUI editbox. You can use [[guiSetInputMode]] or [[onClientKey]] in order to fix that.}}<br />
<br />
==Syntax== <br />
<section name="Server - Syntax 1" class="server" show="true"><br />
<syntaxhighlight lang="lua">bool bindKey ( player thePlayer, string key, string keyState, function handlerFunction, [ var arguments, ... ] )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''thePlayer:''' The player you wish to bind the key of.<br />
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys and [[control names]] for a list of possible controls.<br />
*'''keyState:''' A string that has one of the following values:<br />
**'''"up":''' If the bound key should trigger the function when the key is released<br />
**'''"down":''' If the bound key should trigger the function when the key is pressed<br />
**'''"both":''' If the bound key should trigger the function when the key is pressed or released<br />
*'''handlerFunction:''' The function that will be triggered when the player's key is pressed. This function should have the form:<br />
:<syntaxhighlight lang="lua">function functionName ( player keyPresser, string key, string keyState, [ var arguments, ... ] )</syntaxhighlight><br />
:The values passed to this function are:<br />
:*'''keyPresser:''' The player who pressed the key<br />
:*'''key:''' The key that was pressed<br />
:*'''keyState:''' The state of the key that was pressed, ''down'' if it was pressed, ''up'' if it was released.<br />
:*'''arguments''' The optional arguments you specified when calling [[bindKey]] (see below).<br />
</section><br />
<br />
{{New feature|3|1.0|<br />
<section name="Server - Syntax 2" class="server" show="true"><br />
This alternative syntax allows you to bind a key with a command. This will also allow users to customize the control in their Settings menu. Use in conjunction with [[addCommandHandler]] to add handler functions to the keybind.<br />
<br />
<syntaxhighlight lang="lua">bool bindKey ( player thePlayer, string key, string keyState, string commandName, [ string arguments ] )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''thePlayer:''' The player you wish to bind the key of.<br />
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys.<br />
*'''keyState:''' A string that has one of the following values:<br />
**'''"up":''' If the bound key should trigger the function when the key is released<br />
**'''"down":''' If the bound key should trigger the function when the key is pressed<br />
**'''"both":''' If the bound key should trigger the function when the key is pressed or released<br />
*'''commandName:''' The name of the command that the key should be binded to. <br />
===Optional Arguments===<br />
*'''arguments''' Space delimited arguments that are entered as if one was typing the command.<br />
</section><br />
}}<br />
<br />
<section name="Client - Syntax 1" class="client" show="true"><br />
<syntaxhighlight lang="lua">bool bindKey ( string key, string keyState, function handlerFunction, [ var arguments, ... ] ) </syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys and [[control names]] for a list of possible controls.<br />
*'''keyState:''' A string that has one of the following values:<br />
**'''"up":''' If the bound key should trigger the function when the key is released<br />
**'''"down":''' If the bound key should trigger the function when the key is pressed<br />
**'''"both":''' If the bound key should trigger the function when the key is pressed or released<br />
<!--*'''bindName:''' The name for this key bind when it appears in the client's settings dialog.--><br />
*'''handlerFunction:''' The function that will be triggered when the player's key is pressed. This function should have the form:<br />
:<syntaxhighlight lang="lua">function functionName ( string key, string keyState, [ var arguments, ... ] )</syntaxhighlight><br />
:The values passed to this function are:<br />
:*'''key:''' The key that was pressed<br />
:*'''keyState:''' The state of the key that was pressed, ''down'' if it was pressed, ''up'' if it was released.<br />
:*'''arguments''' The optional arguments you specified when calling [[bindKey]] (see below).<br />
</section><br />
<br />
{{New feature|3|1.0|<br />
<section name="Client - Syntax 2" class="client" show="true"><br />
This alternative syntax allows you to bind a key with a command. This will also allow users to customize the control in their Settings menu. Use in conjunction with [[addCommandHandler]] to add handler functions to the keybind.<br />
<br />
<syntaxhighlight lang="lua">bool bindKey ( string key, string keyState, string commandName, [ string arguments ] )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''key:''' The key or control you wish to bind to the command. See [[key names]] for a list of possible keys.<br />
*'''keyState:''' A string that has one of the following values:<br />
**'''"up":''' If the bound key should trigger the function when the key is released<br />
**'''"down":''' If the bound key should trigger the function when the key is pressed<br />
**'''"both":''' If the bound key should trigger the function when the key is pressed or released<br />
*'''commandName:''' The name of the command that the key should be binded to. <br />
*'''arguments''' Space delimited arguments that are entered as if one was typing the command.<br />
</section><br />
}}<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''arguments:''' Any arguments you may want to pass to the function when the key is pressed by the user. Any number of arguments of can be specified, each being passed to the designated function. You may not pass functions.<br />
<br />
===Returns===<br />
Returns ''true'' if the key was bound, ''false'' otherwise.<br />
<br />
==Example==<br />
Example 1<br />
<section name="Server" class="server" show="true"><br />
This example will bind a player's 'F1' key and 'fire' control to 1 input function.<br />
<syntaxhighlight lang="lua"><br />
function funcInput ( player, key, keyState )<br />
outputChatBox ( getPlayerName ( player) .. " " .. (keyState == "down" and "pressed" or "released") .. " the " .. key .. " key!" )<br />
end<br />
<br />
function bindTheKeys ( player, commandName )<br />
bindKey ( player, "F1", "down", funcInput ) -- bind the player's F1 down key<br />
bindKey ( player, "F1", "up", funcInput ) -- bind the player's F1 up key<br />
bindKey ( player, "fire", "both", funcInput ) -- bind the player's fire down and up control<br />
end<br />
addCommandHandler ( "bindme", bindTheKeys )<br />
</syntaxhighlight><br />
</section><br />
<br />
Example 2<br />
<section name="Client" class="client" show="true"><br />
This example will bind a player's 'F1' key and 'fire' control to 1 input function, clientside.<br />
<syntaxhighlight lang="lua"><br />
function funcInput ( key, keyState )<br />
outputChatBox( "You " .. (keyState == "down" and "pressed" or "let go of") .. " the " .. key .. " key!" )<br />
end<br />
<br />
function bindTheKeys ( commandName )<br />
bindKey( "F1", "down", funcInput ) -- bind the player's F1 down key<br />
bindKey( "F1", "up", funcInput ) -- bind the player's F1 up key<br />
bindKey( "fire", "both", funcInput ) -- bind the player's fire down and up control<br />
end<br />
addCommandHandler ( "bindme", bindTheKeys )<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Server" class="server" show="true"><br />
This example says how cool is the MTA:SA is if players wants to move.<br />
<syntaxhighlight lang="lua"><br />
function fanFunction()<br />
bindKey (source,"forwards","down",<br />
function(player,key,state)<br />
outputChatBox (getPlayerName (player) .. "#FFFF00 thinks MTA:SA is so cool.",root,255,255,0,true)<br />
end<br />
)<br />
end<br />
addEventHandler ("onPlayerLogin",root,fanFunction)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Input functions}}<br />
[[pt-br:bindKey]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/onClientKey&diff=78899PT-BR/onClientKey2024-03-19T19:34:27Z<p>LordHenry: Exception warning.</p>
<hr />
<div>{{PT-BR/Client event}}<br />
__NOTOC__ <br />
Este evento é acionado sempre que o client pressiona um botão no teclado ou mouse.<br />
Este evento também pode ser usado para ver se o client está usando a roda do mouse.<br />
{{Aviso|Este evento não é acionado pela tecla '''F8'''.}}<br />
<br />
==Parâmetros==<br />
<syntaxhighlight lang="lua">string button, bool pressOrRelease<br />
</syntaxhighlight><br />
* '''button''': Isto se refere ao botão pressionado ou solto. Veja a [[PT-BR/Key_names|lista de nome de teclas]] para melhor base de desenvolvimento.<br />
* '''pressOrRelease''': Isso diz se o client estava pressionando ou soltando a tecla, ''true'' quando pressionando, ''false'' quando soltando.<br />
<br />
==Source==<br />
O [[PT-BR/Sistema_de_eventos|source]] deste evento é o [[root element]] do client.<br />
<br />
==Efeito de cancelamento==<br />
{{PT-BR/New items|5620|1.4|<br />
Se este evento é [[PT-BR/Sistema_de_eventos#Canceling|cancelado]], então todas as ''binds'' do MTA e GTA, que foram vinculadas nas teclas canceladas, não serão acionadas.<br />
<br />
'''Nota 1:''' A tecla '''Escape''' só pode ser cancelada uma vez. Se um usuário pressionar a tecla Escape duas vezes seguidas, o menu principal ainda será aberto.<br />
<br />
'''Nota 2:''' O evento só é cancelável quando a tecla está sendo pressionada, não quando está sendo solta.<br />
}}<br />
<br />
==Exemplo== <br />
Este exemplo vai enviar mensagens no chatbox toda vez que o client pressionar alguma tecla.<br />
<syntaxhighlight lang="lua"><br />
function playerPressedKey(button, press)<br />
if (press) then -- Only output when they press it down<br />
outputChatBox("You pressed the "..button.." key!")<br />
end<br />
end<br />
addEventHandler("onClientKey", root, playerPressedKey)<br />
</syntaxhighlight><br />
<br />
Este exemplo exibe no Debug Script uma mensagem toda vez que o client gira a roda do mouse<br />
<syntaxhighlight lang="lua"><br />
addEventHandler( "onClientKey", root, function(button,press) <br />
-- Since mouse_wheel_up and mouse_wheel_down cant return a release, we dont have to check the press.<br />
if button == "mouse_wheel_up" or button == "mouse_wheel_down" then<br />
outputDebugString( button .. " moved." )<br />
return true<br />
end<br />
return false<br />
end )<br />
</syntaxhighlight><br />
<br />
[[pl:onClientKey]]<br />
<br />
==Veja também==<br />
{{GUI_events}}<br />
===Funções de eventos client===<br />
{{Client_event_functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=OnClientKey&diff=78898OnClientKey2024-03-19T19:31:29Z<p>LordHenry: Exception warning.</p>
<hr />
<div>{{Client event}}<br />
__NOTOC__ <br />
This event triggers whenever the user presses a button on their keyboard or mouse.<br />
This event can also be used to see if the client scrolls their mouse wheel.<br />
{{Warning|This event is not triggered by the '''F8''' key.}}<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua">string button, bool pressOrRelease<br />
</syntaxhighlight><br />
* '''button''': This refers the button pressed. See [[key names]] for a list of keys.<br />
* '''pressOrRelease''': This refers to whether they were pressing or releasing the key, ''true'' when pressing, ''false'' when releasing.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the client's [[root element]].<br />
<br />
==Cancel effect==<br />
{{New items|5620|1.4|<br />
If this event is [[Event system#Canceling|canceled]], then all GTA and MTA binds, bound to the canceled key, won't be triggered.<br />
<br />
'''Note 1:''' The escape key can only be cancelled once. If a user presses the escape key twice in a row the main menu will still open.<br />
<br />
'''Note 2:''' The event is only cancellable when the key is being pressed, not when being released.<br />
}}<br />
<br />
==Example== <br />
This example will say in chatbox every time the user presses down a a key.<br />
<syntaxhighlight lang="lua"><br />
function playerPressedKey(button, press)<br />
if (press) then -- Only output when they press it down<br />
outputChatBox("You pressed the "..button.." key!")<br />
end<br />
end<br />
addEventHandler("onClientKey", root, playerPressedKey)<br />
</syntaxhighlight><br />
<br />
This example outputs if the client moves his mousewheel.<br />
<syntaxhighlight lang="lua"><br />
addEventHandler( "onClientKey", root, function(button,press) <br />
-- Since mouse_wheel_up and mouse_wheel_down cant return a release, we dont have to check the press.<br />
if button == "mouse_wheel_up" or button == "mouse_wheel_down" then<br />
outputDebugString( button .. " moved." )<br />
return true<br />
end<br />
return false<br />
end )<br />
</syntaxhighlight><br />
<br />
[[pl:onClientKey]]<br />
[[pt-br:onClientKey]]<br />
<br />
==See Also==<br />
{{GUI_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=EngineRequestModel&diff=78797EngineRequestModel2024-02-07T20:02:45Z<p>LordHenry: Limit warning.</p>
<hr />
<div>__NOTOC__<br />
{{Client function}}<br />
{{New feature/item|3.0158|1.5.7|20147|This function is used to assign the next available model ID to a certain element type.}}<br />
{{note|Before release '''1.5.8 r20716''' this must be "ped". After release '''1.5.8 r20716''' this function supports "vehicle" and "object" too.}}<br />
{{note|Vehicle unique features may be unsupported, see [https://github.com/multitheftauto/mtasa-blue/issues/1861 issue 1861] for examples and details}}<br />
{{Important Note|Unlike some other functions, the side-effects of this function aren't reverted on resource stop, so you must manually call [[engineFreeModel]] in [[onClientResourceStop]] (Just like the example below does)}}<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
int engineRequestModel ( string elementType [, int parentID ] )<br />
</syntaxhighlight><br />
===Required Arguments===<br />
*'''elementType''': "ped", "vehicle", "object", "timed-object", "clump"<br />
<br />
===Optional Arguments=== <br />
*'''parentID''': The ID of the parent model (by default this is: 1337 - objects, 400 - vehicles, 7 - peds, 3425 - clump models, 4715 - timed objects).<br />
{{Important Note|Here is the parentID limit for each element type:<br><br />
*'''ped''': 0 - 26315<br />
*'''vehicle''': 400 - 611<br />
*'''object''': 615 - 11681<br />
*'''timed-object''': 615 - 11681<br />
*'''clump''': 615 - 11681<br />
If you try to use higher values than the limit, your client may crash.}}<br />
<br />
===Returns===<br />
{{New feature/item|3.0158|1.5.7|20147| Returns an ''integer'' of the model ID that was available to be assigned to the element type, ''false'' if no free model ID available or invalid element type.}}<br />
Do not rely on the model numbers returned being consistent across multiple clients or multiple runs of resources. There is no guarantee for the order of the numbers or that the same numbers will always correspond to the same element type. Any patterns are coincidental.<br />
<br />
==Example==<br />
This example creates a ped and then gives you the opportunity to change its model. If the resource stops, then the IDs allocated will be deallocated. Use ''/cap'' for creating the ped and ''/sap'' to skin the ped. You will need some skins added to a folder and to the meta.xml for ''/sap'' to work:<br />
<syntaxhighlight lang="lua"><br />
local peds = {}<br />
function createAllocatedPed()<br />
local x, y, z = getElementPosition(localPlayer)<br />
local id = engineRequestModel("ped")<br />
peds[id] = createPed(id, x+0.5, y, z+0.5)<br />
outputChatBox("New ped with ID "..id.." created.")<br />
end<br />
addCommandHandler("cap", createAllocatedPed, false, false)<br />
<br />
function skinAllocatedPeds()<br />
local txd, dff;<br />
for id,ped in pairs(peds) do<br />
if fileExists("skins/" .. id .. ".txd") and fileExists("skins/" .. id .. ".dff") then<br />
txd = engineLoadTXD("skins/" .. id .. ".txd")<br />
engineImportTXD(txd, id)<br />
dff = engineLoadDFF("skins/" .. id .. ".dff")<br />
engineReplaceModel(dff, id)<br />
outputChatBox("Model ID "..id.." changed correctly.")<br />
else<br />
outputChatBox("Model ID "..id.." couldn't change. REASON: skins/" .. id .. ".txd or skins/" .. id .. ".dff does not exist.")<br />
end<br />
end<br />
end<br />
addCommandHandler("sap", skinAllocatedPeds, false, false)<br />
<br />
function onStop()<br />
for id,ped in pairs(peds) do<br />
engineFreeModel(id)<br />
end<br />
end<br />
addEventHandler("onClientResourceStop", resourceRoot, onStop)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.7-9.20147|}}<br />
<br />
==See Also==<br />
{{Engine functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=User:LordHenry&diff=78796User:LordHenry2024-02-04T16:14:04Z<p>LordHenry: /* External Links to Lord Henry */</p>
<hr />
<div>__NOTOC__<br />
{{Note|This page requires '''DarkVector''' theme. You can enable dark mode in your [[Special:Preferences#mw-prefsection-rendering|preferences]].<br><br />
Also, enable '''legacy DarkVector'''.}}<br />
[[file:LordHenry-Logo.png|frameless|right]]<br />
== Lord Henry MTA profiles ==<br />
[https://community.multitheftauto.com/index.php?p=profile&id=421903 MTA community profile]<br><br />
[https://forum.mtasa.com/profile/50620-lord-henry MTA forum profile]<br><br />
MTA wiki profile <font color="gray"> (you are here)</font><br />
<br />
== Pages created by Lord Henry ==<br />
[[autoAttach]]<br><br />
[[createGarageColShape]]<br><br />
[[dxDrawBorderedText]]<br><br />
[[dxDrawRing]]<br><br />
[[dxFade]]<br><br />
[[exports]] (redirect page to [[call]])<br><br />
[[getServerIP]] (redirect page to [[GetServerConfigSetting]])<br><br />
[[getWorldPositionFromMapPosition]] <br><br />
[[guiGridListSetColumnNonSortable]]<br><br />
[[isMouseOnGUICloseButton]]<br><br />
[[isVehicleReversing]]<br><br />
[[lookAt]] (redirect page to [[findRotation3D]])<br><br />
[[math.randomDiff]]<br><br />
[[playVideo]]<br><br />
[[resource:Bone_attach]]<br><br />
[[setPedArmour]] (redirect page to [[setPedArmor]])<br><br />
[[Template:PT-BR/Client_function]]<br><br />
[[Template:PT-BR/Server_function]]<br><br />
[[Template:PT-BR/Useful_function]]<br><br />
[[Template:ZoneNames]]<br />
<br />
== Wiki contributions by Lord Henry ==<br />
[[Special:Contributions/LordHenry]]<br />
<br />
== External Links to Lord Henry ==<br />
[[file:Youtube.png|32px]] [https://www.youtube.com/@LordHenry Lord Henry - Youtube Channel]<br><br />
[[file:Facebook.png|32px]] [https://www.facebook.com/LordHenryEntertainment/ Lord Henry - Facebook Page]<br><br />
[[file:Instagram.png|32px]] [https://www.instagram.com/lordhenry.entertainment/ Lord Henry - Instagram Page]<br><br />
[[file:Artstation.png|32px]] [https://www.artstation.com/lordhenry/ Lord Henry - Artstation Page]<br><br />
[[file:Sketchfab.png|32px]] [https://sketchfab.com/lordhenry Lord Henry - Sketchfab]<br><br />
[[file:Github2.png|32px]] [https://github.com/Lord-Henry Lord Henry - Github]<br />
<br />
== Friendlist ==<br />
[[User:Danilo]]<br><br />
[[User:Eficiencia]]<br><br />
[[User:HiroShi]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=OnClientPedsProcessed&diff=78795OnClientPedsProcessed2024-02-04T16:11:01Z<p>LordHenry: /* Example */</p>
<hr />
<div>__NOTOC__<br />
{{Client event}} <br />
{{Added feature/item|1.5.9|1.5.8|20704|This event is triggered after GTA updates bone transformations for all peds. This event can be used for updating bones.}}<br />
<br />
==Parameters==<br />
None.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the client's [[root element]].<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onClientPedsProcessed",root,function() -- add the event<br />
for i,v in ipairs(getElementsByType('player',root,true)) do -- loop all players<br />
<br />
-- just an exmaple anim<br />
setElementBoneRotation(v, 33, 0, 295.2, 0)<br />
setElementBoneRotation(v, 23, 0, 298.8, 0)<br />
setElementBoneRotation(v, 4, 0, 46.8, 0)<br />
setElementBoneRotation(v, 2, 0, 0, 32.4)<br />
<br />
updateElementRpHAnim(v) -- Update ped bones animations<br />
<br />
end <br />
end)<br />
</syntaxhighlight><br />
This example makes the localPlayer handcuffed. The player can still run/walk/jump/crouch/shoot, use [[toggleControl]] to disable them.<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onClientPedsProcessed", root, function()<br />
-- Left<br />
setElementBoneRotation(localPlayer, 32, 26.574, 61.3375, 59.2065)<br />
setElementBoneRotation(localPlayer, 33, 27.844, 15.364, 46.406)<br />
setElementBoneRotation(localPlayer, 34, -81.0185, 342.875, 326.118)<br />
-- Right<br />
setElementBoneRotation(localPlayer, 22, 338.839, 53.4935, 298.452)<br />
setElementBoneRotation(localPlayer, 23, 307.687, 22.11, 313.594)<br />
setElementBoneRotation(localPlayer, 24, 96.0475, 357.883, 56.739)<br />
<br />
updateElementRpHAnim(localPlayer)<br />
end)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.8-9.20704}}<br />
<br />
==Warning==<br />
This event will trigger whatever function it is attached to with every frame. Depending on the server's maximum FPS and what your computer might handle - you might end up triggering the function 30-60 times '''per second'''.<br />
<br />
As a result, this event may cause severe lag and/or even crashes if not used cautiously.<br />
<br />
==See Also==<br />
===[[Game_Processing_Order|Game Processing Order]]===<br />
===Other client events===<br />
{{Client_other_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=OnClientPedsProcessed&diff=78794OnClientPedsProcessed2024-02-04T15:31:07Z<p>LordHenry: /* Example */</p>
<hr />
<div>__NOTOC__<br />
{{Client event}} <br />
{{Added feature/item|1.5.9|1.5.8|20704|This event is triggered after GTA updates bone transformations for all peds. This event can be used for updating bones.}}<br />
<br />
==Parameters==<br />
None.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the client's [[root element]].<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onClientPedsProcessed",root,function() -- add the event<br />
for i,v in ipairs(getElementsByType('player',root,true)) do -- loop all players<br />
<br />
-- just an exmaple anim<br />
setElementBoneRotation(v, 33, 0, 295.2, 0)<br />
setElementBoneRotation(v, 23, 0, 298.8, 0)<br />
setElementBoneRotation(v, 4, 0, 46.8, 0)<br />
setElementBoneRotation(v, 2, 0, 0, 32.4)<br />
<br />
updateElementRpHAnim(v) -- Update ped bones animations<br />
<br />
end <br />
end)<br />
</syntaxhighlight><br />
This example makes the localPlayer handcuffed. The player can still run/walk/jump/crouch.<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onClientPedsProcessed", root, function()<br />
-- Left<br />
setElementBoneRotation(localPlayer, 32, 26.57374382019, 61.337575733622, 59.206573486328)<br />
setElementBoneRotation(localPlayer, 33, 27.843754291534, 15.3639249801636, 46.40625)<br />
setElementBoneRotation(localPlayer, 34, -81.018516340527, 342.87482380867, 326.11833715439)<br />
-- Right<br />
setElementBoneRotation(localPlayer, 22, 338.839179039, 53.49357098341, 298.45233917236)<br />
setElementBoneRotation(localPlayer, 23, 307.68748283386, 22.110015869141, 313.59375)<br />
setElementBoneRotation(localPlayer, 24, 96.047592163086, 357.88313293457, 56.739406585693)<br />
<br />
updateElementRpHAnim(localPlayer)<br />
end)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.8-9.20704}}<br />
<br />
==Warning==<br />
This event will trigger whatever function it is attached to with every frame. Depending on the server's maximum FPS and what your computer might handle - you might end up triggering the function 30-60 times '''per second'''.<br />
<br />
As a result, this event may cause severe lag and/or even crashes if not used cautiously.<br />
<br />
==See Also==<br />
===[[Game_Processing_Order|Game Processing Order]]===<br />
===Other client events===<br />
{{Client_other_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=OnPlayerQuit&diff=78786OnPlayerQuit2024-01-25T13:14:11Z<p>LordHenry: /* Example */</p>
<hr />
<div>__NOTOC__<br />
{{Server event}}<br />
This event is triggered when a player disconnects from the server.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
string quitType, string reason, element responsibleElement<br />
</syntaxhighlight> <br />
<br />
*'''quitType''': How the player left. Possible values:<br />
**''"Unknown"''<br />
**''"Quit"''<br />
**''"Kicked"''<br />
**''"Banned"''<br />
**''"Bad Connection"''<br />
**''"Timed out"''<br />
<br />
*'''reason''': If the player was kicked or banned, the reason given goes here. If the player was '''not''' kicked or banned, this will be false.<br />
*'''responsibleElement''': The element that was responsible for kicking or banning the player. This is commonly another player, but can also be the console element.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[player]] that left the server.<br />
<br />
==Cancel effect==<br />
This event cannot be canceled.<br />
<br />
==Example==<br />
This example gets a quitting player's name and outputs that they left the server.<br />
<br />
<syntaxhighlight lang="lua"><br />
-- we register quitPlayer as a handler for the event<br />
addEventHandler("onPlayerQuit", root,<br />
function(quitType)<br />
outputChatBox(getPlayerName(source).." has left the server ("..quitType..")")<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
{{See also/Server event|Player events}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=OnPlayerQuit&diff=78785OnPlayerQuit2024-01-25T13:13:22Z<p>LordHenry: /* Example */</p>
<hr />
<div>__NOTOC__<br />
{{Server event}}<br />
This event is triggered when a player disconnects from the server.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
string quitType, string reason, element responsibleElement<br />
</syntaxhighlight> <br />
<br />
*'''quitType''': How the player left. Possible values:<br />
**''"Unknown"''<br />
**''"Quit"''<br />
**''"Kicked"''<br />
**''"Banned"''<br />
**''"Bad Connection"''<br />
**''"Timed out"''<br />
<br />
*'''reason''': If the player was kicked or banned, the reason given goes here. If the player was '''not''' kicked or banned, this will be false.<br />
*'''responsibleElement''': The element that was responsible for kicking or banning the player. This is commonly another player, but can also be the console element.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[player]] that left the server.<br />
<br />
==Cancel effect==<br />
This event cannot be canceled.<br />
<br />
==Example==<br />
This example gets a quitting player's name and outputs that they left the server.<br />
<br />
<syntaxhighlight lang="lua"><br />
-- we register quitPlayer as a handler for the event<br />
addEventHandler("onPlayerQuit", getRootElement(),<br />
function(quitType)<br />
outputChatBox(getPlayerName(source).." has left the server ("..quitType..")")<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
{{See also/Server event|Player events}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=OnPlayerBan&diff=78644OnPlayerBan2023-12-06T17:11:41Z<p>LordHenry: Cancel Effect</p>
<hr />
<div>__NOTOC__<br />
{{Server event}}<br />
This event is triggered when a player added a [[ban]] (like [[onBan]]).<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
ban banPointer, player responsibleElement<br />
</syntaxhighlight> <br />
<br />
*'''banPointer''': the [[ban]] pointer which was added.<br />
*'''responsibleElement''': the [[player]] who added the ban.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[player]] who was banned.<br />
<br />
==Cancel effect==<br />
This event cannot be canceled.<br />
<br />
==Example== <br />
This example outputs the responsible element and the banned player's name when a ban takes place.<br />
<syntaxhighlight lang="lua"><br />
function outputBan ( banPointer, responsibleElement ) -- Define the banner and the ban pointer in the function.<br />
local banner = getPlayerName( responsibleElement ) or "Console" -- Get the banner's name.<br />
<br />
outputChatBox ( banner .." has banned ".. getPlayerName( source ) ..".", root, 255, 0, 0 ) -- Output the ban.<br />
end<br />
addEventHandler ( "onPlayerBan", root, outputBan ) -- Trigger the function when there is a ban.<br />
</syntaxhighlight><br />
<br />
==Changelog==<br />
{{ChangelogHeader}}<br />
{{ChangelogItem|1.3.0-9.03908|Fixed responsible element parameter}}<br />
<br />
{{See also/Server event|Player events}}<br />
<br />
[[ru:onPlayerBan]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=RemoveBan&diff=78643RemoveBan2023-12-06T17:09:34Z<p>LordHenry: Admin rights required.</p>
<hr />
<div>__NOTOC__ <br />
{{Server function}}<br />
This function will remove a specific [[ban]].<br />
{{note| Don't forget to give admin rights to the resource, in which you are using removeBan function or it won't work.}}<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool removeBan ( ban theBan [, player responsibleElement = nil ] )<br />
</syntaxhighlight><br />
<br />
{{OOP||[[ban]]:remove}}<br />
<br />
===Required Arguments=== <br />
*'''theBan:''' The [[ban]] to be removed.<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''responsibleElement:''' The element that is responsible for removing the [[ban]] element. This can be a player or the root ([[getRootElement]]()).<br />
<br />
===Returns===<br />
Returns ''true'' if the [[ban]] was removed succesfully, ''false'' if invalid arguments are specified.<br />
<br />
==Example==<br />
This example removes all the bans when the resource is started and outputs to everyone the players.<br />
<syntaxhighlight lang="lua">addEventHandler("onResourceStart",resourceRoot,function()<br />
bans = getBans()<br />
for i,d in ipairs(bans)do<br />
nick = getBanNick(d)<br />
if(removeBan(d))then<br />
outputChatBox(nick.."has been removed from ban",root)<br />
end<br />
end<br />
end)<br />
</syntaxhighlight><br />
This example removes the ban for IP 1.2.3.4<br />
<syntaxhighlight lang="lua"><br />
for _,ban in ipairs(getBans())do<br />
if getBanIP(ban) == "1.2.3.4" then<br />
removeBan(ban)<br />
end<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Admin functions}}<br />
[[ru:removeBan]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=AddBan&diff=78642AddBan2023-12-06T17:08:59Z<p>LordHenry: Admin rights required.</p>
<hr />
<div>__NOTOC__ <br />
{{Server function}}<br />
This function will add a [[ban]] for the specified IP/username/serial to the server.<br />
{{Note|One of the three: IP, Username or Serial have to be specified.}}<br />
{{note| Don't forget to give admin rights to the resource, in which you are using addBan function or it won't work.}}<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
ban addBan ( [ string IP, string Username, string Serial, player responsibleElement, string reason, int seconds = 0 ] ) <br />
</syntaxhighlight><br />
<br />
{{OOP||[[Ban]]}}<br />
<br />
===Required Arguments=== <br />
*'''IP:''' The IP to be banned. If you don't want to ban by IP, set this to ''nil''.<br />
'''or'''<br />
*'''Username:''' The [http://community.mtasa.com/ MTA Community] username to be banned (now obsolete). If you don't want to ban by username, set this to ''nil''.<br />
'''or'''<br />
*'''Serial:''' The serial to be banned. If you don't want to ban by serial, set this to ''nil''.<br />
''' or any combination.'''<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''responsibleElement:''' The element that is responsible for banning the IP/username/serial. This can be a player or the root ([[getRootElement]]()).<br />
*'''reason:''' The reason the IP/username/serial will be banned from the server.<br />
*'''seconds:''' The amount of seconds the player will be banned from the server for. This can be 0 for an infinite amount of time.<br />
<br />
===Returns===<br />
Returns the new [[ban]] if the IP/username/serial was banned successfully, ''false'' if invalid arguments are specified.<br />
<br />
==Example==<br />
This example bans a player's IP with the reason "Requested" when they type "/ban-me".<br />
<syntaxhighlight lang="lua"><br />
function banMe ( source, command ) -- The function header and where source is defined<br />
local ipToBan = getPlayerIP ( source ) -- Get the player's IP<br />
addBan ( ipToBan, nil, nil, source, "Requested" ) -- Ban him with the reason; Requested<br />
end<br />
addCommandHandler ( "ban-me", banMe ) -- Make it trigger when a player types "/ban-me"<br />
</syntaxhighlight><br />
<br />
==Example 2==<br />
This example add command to ban player serial.<br />
<syntaxhighlight lang="lua"><br />
function banSerial( source, command, noob, reason )<br />
if ( noob ) then<br />
local theNoob = getPlayerFromName( noob )<br />
if ( theNoob ) then<br />
local theNoobSerial = getPlayerSerial( theNoob )<br />
addBan( nil, nil, theNoobSerial, source, reason )<br />
end<br />
end<br />
end<br />
addCommandHandler( "ban-serial", banSerial )<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Admin functions}}<br />
[[ru:addBan]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=OnPlayerQuit&diff=78641OnPlayerQuit2023-12-06T17:00:17Z<p>LordHenry: Cancel Effect</p>
<hr />
<div>__NOTOC__<br />
{{Server event}}<br />
This event is triggered when a player disconnects from the server.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
string quitType, string reason, element responsibleElement<br />
</syntaxhighlight> <br />
<br />
*'''quitType''': How the player left. Possible values:<br />
**''"Unknown"''<br />
**''"Quit"''<br />
**''"Kicked"''<br />
**''"Banned"''<br />
**''"Bad Connection"''<br />
**''"Timed out"''<br />
<br />
*'''reason''': If the player was kicked or banned, the reason given goes here. If the player was '''not''' kicked or banned, this will be false.<br />
*'''responsibleElement''': The element that was responsible for kicking or banning the player. This is commonly another player, but can also be the console element.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[player]] that left the server.<br />
<br />
==Cancel effect==<br />
This event cannot be canceled.<br />
<br />
==Example==<br />
This example gets a quitting player's name and outputs that they left the server.<br />
<br />
<syntaxhighlight lang="lua"><br />
-- we register quitPlayer as a handler for the event<br />
function quitPlayer ( quitType )<br />
-- send the message to the server telling players that the player has left.<br />
outputChatBox ( getPlayerName(source).. " has left the server (" .. quitType .. ")" )<br />
end<br />
addEventHandler ( "onPlayerQuit", root, quitPlayer )<br />
</syntaxhighlight><br />
<br />
{{See also/Server event|Player events}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=Talk:GetGarageSize&diff=78639Talk:GetGarageSize2023-11-29T01:36:59Z<p>LordHenry: /* How to use this function */ new section</p>
<hr />
<div>The first value returned by this (the X size/width) is way too big... 20 units and beyond. The Y size and height seem fine. --[[User:Erorr404|Erorr404]] 08:38, 29 July 2009 (UTC)<br />
<br />
Most of the values are messed up. I've reported it when these functions were added but I guess I was ignored (as usually) -_- Try to get size of air plane hangars, they are huge, and you get even greater values then you'd expect. --[[User:50p|50p]] 19:33, 29 July 2009 (UTC)<br />
<br />
== How to use this function ==<br />
<br />
# Change the variables order to: sizeZ, sizeX, sizeY.<br />
# Use [[getGaragePosition]] to get the garage Z position (3rd value).<br />
# sizeZ = sizeZ - posZ<br />
<br />
Done.<br />
<br />
You can check issue details [https://github.com/multitheftauto/mtasa-blue/issues/2680 here].</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=Modern-Library&diff=78611Modern-Library2023-11-21T01:00:10Z<p>LordHenry: /* Examples */</p>
<hr />
<div>{{Resource page}}<br />
__NOTOC__<br />
<br />
== Modern DX Library ==<br />
<br />
This resource is designed to allow you to create directX GUI's as an alternative to the original MTA:SA GUI functions.<br />
{{note|This wiki is always for the latest Modern DX Library version!}}<br />
<br />
'''Full Name''': Modern DX Library for User Interface<br />
<br />
'''Developer Team''': [[User:ClawSuit|ClawSuit]], [[User:PandFort|PandFort]]<br />
<br />
'''GitHub Repo''': ''https://github.com/clawsuit/dxLibrary''<br />
<br />
'''Current Version''': 1.0 Estable<br />
<br />
=Features=<br />
<br />
[[Image:Demo.PNG|350px|thumb|right| Demo Window]]<br />
<br />
'''How does it work?'''<br />
*Modern DX Library is based on [[element]] system, which just likes the cegui system. To make Modern DX Library easier to use and understand, I choose to follow the usage of cegui's.<br />
*Modern DX Library elements are rendered in the event "onClientRender". When "onClientRender" is called, every Modern DX Library elements will be looped and calculated.<br />
<br />
'''What's different from cegui?'''<br />
*This resource is based on dx* functions, so its style will be more flexible than cegui, which means you can define the style by yourself.<br />
<br />
'''You Should Know'''<br />
*Some of Modern DX Library elements use '''Render Target''', which means if you don't have enough video memory, '''Render Target won't be created''', and therefore those Modern DX Library elements won't be shown.<br />
<br />
=Examples=<br />
'''Demonstration''': https://www.youtube.com/watch?v=qakLp6Znws0<br />
<br />
'''Notice'''<br />
*It is recommended to change the resource name to 'dxLibrary'.<br />
*This is a resource, if you want to use the functions exported by this resource, you should use an exported function prefix (''' exports[ "dxLibrary" ]: ''') call in your code, such as<br />
<br />
<syntaxhighlight lang="lua"><br />
button = exports[ "dxLibrary" ]:dxButton( 50, 50, 40, 20, "Button Test" )<br />
</syntaxhighlight><br />
<br />
*Here is a feasible way to shorten the name of an exported function:<br />
<syntaxhighlight lang="lua"><br />
dxLib = exports[ "dxLibrary" ] -- shorten the export function prefix<br />
<br />
button = dxLib:dxButton( 50, 50, 40, 20, "Button Test" ) -- create a button<br />
</syntaxhighlight><br />
<br />
='''Client Functions'''=<br />
{{DXLIB_FUNCTIONS}}<br />
<br />
='''Client Events'''=<br />
{{DXLIB_EVENTS}}<br />
<br />
=Last=<br />
'''Everyone is welcome to make suggestions, test the script, help make adjustments/finish the wiki, etc.'''<br />
[[Category:Resource]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=Modern-Library&diff=78610Modern-Library2023-11-21T00:56:44Z<p>LordHenry: Following wiki formatting.</p>
<hr />
<div>{{Resource page}}<br />
__NOTOC__<br />
<br />
== Modern DX Library ==<br />
<br />
This resource is designed to allow you to create directX GUI's as an alternative to the original MTA:SA GUI functions.<br />
{{note|This wiki is always for the latest Modern DX Library version!}}<br />
<br />
'''Full Name''': Modern DX Library for User Interface<br />
<br />
'''Developer Team''': [[User:ClawSuit|ClawSuit]], [[User:PandFort|PandFort]]<br />
<br />
'''GitHub Repo''': ''https://github.com/clawsuit/dxLibrary''<br />
<br />
'''Current Version''': 1.0 Estable<br />
<br />
=Features=<br />
<br />
[[Image:Demo.PNG|350px|thumb|right| Demo Window]]<br />
<br />
'''How does it work?'''<br />
*Modern DX Library is based on [[element]] system, which just likes the cegui system. To make Modern DX Library easier to use and understand, I choose to follow the usage of cegui's.<br />
*Modern DX Library elements are rendered in the event "onClientRender". When "onClientRender" is called, every Modern DX Library elements will be looped and calculated.<br />
<br />
'''What's different from cegui?'''<br />
*This resource is based on dx* functions, so its style will be more flexible than cegui, which means you can define the style by yourself.<br />
<br />
'''You Should Know'''<br />
*Some of Modern DX Library elements use '''Render Target''', which means if you don't have enough video memory, '''Render Target won't be created''', and therefore those Modern DX Library elements won't be shown.<br />
<br />
=Examples=<br />
; Player Rename : https://youtube.com<br />
<br />
'''Notice'''<br />
*It is recommended to change the resource name to 'dxLibrary'.<br />
*This is a resource, if you want to use the functions exported by this resource, you should use an exported function prefix (''' exports[ "dxLibrary" ]: ''') call in your code, such as<br />
<br />
<syntaxhighlight lang="lua"><br />
button = exports[ "dxLibrary" ]:dxButton( 50, 50, 40, 20, "Button Test" )<br />
</syntaxhighlight><br />
<br />
*Here is a feasible way to shorten the name of an exported function:<br />
<syntaxhighlight lang="lua"><br />
dxLib = exports[ "dxLibrary" ] -- shorten the export function prefix<br />
<br />
button = dxLib:dxButton( 50, 50, 40, 20, "Button Test" ) -- create a button<br />
</syntaxhighlight><br />
<br />
='''Client Functions'''=<br />
{{DXLIB_FUNCTIONS}}<br />
<br />
='''Client Events'''=<br />
{{DXLIB_EVENTS}}<br />
<br />
=Last=<br />
'''Everyone is welcome to make suggestions, test the script, help make adjustments/finish the wiki, etc.'''<br />
[[Category:Resource]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=Modern-Library&diff=78609Modern-Library2023-11-21T00:42:20Z<p>LordHenry: For security reasons, loadstring should not be used.</p>
<hr />
<div><pageclass class="resource" subcaption="Resource"></pageclass><br />
<br />
__NOTOC__<br />
<br />
== Modern DX Library ==<br />
<br />
This resource is designed to allow you to create directX GUI's as an alternative to the original MTA:SA GUI functions.<br />
<br />
<span style="color:#332170; text-shadow:blue 0em 0em 0.3em;">This wiki is always for the latest Modern DX Library version!</span><br />
<br />
<div style="padding:10px; border-radius:2px;font-size:14px;"><br />
'''Full Name''': Modern DX Library for User Interface<br />
<br />
'''Developer Team''': [[User:ClawSuit|ClawSuit]], [[User:PandFort|PandFort]]<br />
<br />
'''GitHub Repo''': ''https://github.com/clawsuit/dxLibrary''<br />
<br />
'''Current Version''': 1.0 Estable<br />
<br />
=Features=<br />
<br />
[[Image:Demo.PNG|350px|thumb|right| Demo Window]]<br />
<br />
'''How does it work?'''<br />
*Modern DX Library is based on [[element]] system, which just likes the cegui system. To make Modern DX Library easier to use and understand, I choose to follow the usage of cegui's.<br />
*Modern DX Library elements are rendered in the event "onClientRender". When "onClientRender" is called, every Modern DX Library elements will be looped and calculated.<br />
<br />
'''What's different from cegui?'''<br />
*This resource is based on dx* functions, so its style will be more flexible than cegui, which means you can define the style by yourself.<br />
<br />
'''You Should Know'''<br />
*Some of Modern DX Library elements use '''Render Target''', which means if you don't have enough video memory, '''Render Target won't be created''', and therefore those Modern DX Library elements won't be shown.<br />
<br />
=Examples=<br />
; Player Rename : https://youtube.com<br />
<br />
'''Notice'''<br />
*It is recommended to change the resource name to 'dxLibrary'.<br />
*This is a resource, if you want to use the functions exported by this resource, you should use an exported function prefix (''' exports[ "dxLibrary" ]: ''') call in your code, such as<br />
<br />
<syntaxhighlight lang="lua"><br />
button = exports[ "dxLibrary" ]:dxButton( 50, 50, 40, 20, "Button Test" )<br />
</syntaxhighlight><br />
<br />
*Here is a feasible way to shorten the name of an exported function:<br />
<syntaxhighlight lang="lua"><br />
dxLib = exports[ "dxLibrary" ] -- shorten the export function prefix<br />
<br />
button = dxLib:dxButton( 50, 50, 40, 20, "Button Test" ) -- create a button<br />
</syntaxhighlight><br />
<br />
='''Client Functions'''=<br />
{{DXLIB_FUNCTIONS}}<br />
<br />
='''Client Events'''=<br />
{{DXLIB_EVENTS}}<br />
<br />
=Last=<br />
'''Everyone is welcome to make suggestions, test the script, help make adjustments/finish the wiki, etc.'''<br />
[[Category:Resource]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=DxFade&diff=78230DxFade2023-10-14T03:55:10Z<p>LordHenry: /* Example */</p>
<hr />
<div>{{Useful Function}}<br />
<lowercasetitle></lowercasetitle><br />
__NOTOC__<br />
This function allows you to fade-in or fade-out any dxDraw by gradually changing its alpha value.<br><br />
{{Note|You can fade up to 3 values at the same time, as long as they are properly declared together on the same [[interpolateBetween]] function and on the ''dxFade'' function parameters.}}<br />
{{Note|If you need to start another fade while this function is already fading something, you will need another ''dxFade'' function.}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">bool dxFade (bool showing, int maxAlpha, float theDuration, string strEasingType, [float period, float amplitude, float overshoot])</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''showing:''' A boolean to fade-in (true) or fade-out (false).<br />
*'''maxAlpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] the DX will use while visible (1-255).<br />
*'''theDuration:''' The number of milliseconds that the fade will elapse (1000 milliseconds = 1 second).<br />
*'''strEasingType:''' The [[Easing|easing function]] to use for the interpolation.<br />
<br />
===Optional Arguments===<br />
*'''period:''' The period of the [[Easing|easing function]] (only some easing functions use this parameter).<br />
*'''amplitude:''' The amplitude of the [[Easing|easing function]] (only some easing functions use this parameter).<br />
*'''overshoot:''' The overshoot of the [[Easing|easing function]] (only some easing functions use this parameter).<br />
<br />
==Code==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
function dxFade(showing, maxAlpha, theDuration, strEasingType, period, amplitude, overshoot)<br />
local start = getTickCount()<br />
if showing then<br />
currentAlpha = 0<br />
function renderIn()<br />
local now = getTickCount()<br />
local endTime = start + theDuration<br />
local elapsedTime = now - start<br />
local duration = endTime - start<br />
local progress = elapsedTime / duration<br />
currentAlpha = interpolateBetween (0, 0, 0, maxAlpha, 0, 0, progress, strEasingType, period, amplitude, overshoot)<br />
<br />
if currentAlpha >= maxAlpha then<br />
removeEventHandler("onClientRender", root, renderIn)<br />
end<br />
end<br />
addEventHandler("onClientRender", root, renderIn)<br />
else<br />
currentAlpha = maxAlpha<br />
function renderOut()<br />
local now = getTickCount()<br />
local endTime = start + theDuration<br />
local elapsedTime = now - start<br />
local duration = endTime - start<br />
local progress = elapsedTime / duration<br />
currentAlpha = interpolateBetween (maxAlpha, 0, 0, 0, 0, 0, progress, strEasingType, period, amplitude, overshoot)<br />
<br />
if currentAlpha <= 0 then<br />
removeEventHandler("onClientRender", root, renderOut)<br />
end<br />
end<br />
addEventHandler("onClientRender", root, renderOut)<br />
end<br />
end<br />
</syntaxhighlight><br />
</section><br />
'''Author:''' [[User:LordHenry|LordHenry]]<br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This example shows an image on the screen that fade-in during 1 second and after 3 seconds, it fade-out during 1 second.<br />
<syntaxhighlight lang="lua"><br />
local screen = Vector2 (guiGetScreenSize())<br />
<br />
function drawSomething()<br />
dxDrawImage (0, 0, screen.x, screen.y, "image.png", 0, 0, 0, tocolor (255, 255, 255, currentAlpha or 0)) -- You need to provide the image.<br />
end<br />
addEventHandler ("onClientRender", root, drawSomething)<br />
<br />
addEventHandler ("onClientResourceStart", resourceRoot, function ()<br />
dxFade (true, 255, 1000, "Linear")<br />
<br />
setTimer (function()<br />
dxFade (false, 255, 1000, "Linear")<br />
end, 3000, 1)<br />
end)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=78229Template:Useful Functions2023-10-14T03:50:33Z<p>LordHenry: /* Drawing functions */</p>
<hr />
<div>__NOTOC__<br />
=== Table functions ===<br />
*[[addTableChangeHandler]] <span style="color:gray; font-size:smaller;">» This function monitors the changes of a table.</span><br />
*[[getTableFromSql]] <span style="color:gray; font-size:smaller;">» This functionality is used to obtain saved tables using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql ]).</span><br />
*[[isValueInTable]] <span style="color:gray; font-size:smaller;">» This function returns true if the value exists in the table, false if the value does not exist in the table.</span><br />
*[[pairsByKeys]] <span style="color:gray; font-size:smaller;">» This function sort pairs table.</span><br />
*[[rangeToTable]] <span style="color:gray; font-size:smaller;">» This function converts a string range to a table containing number values.</span><br />
*[[setTableProtected]] <span style="color:gray; font-size:smaller;">» This function protects a table and makes it read-only.</span><br />
*[[setTableToSql]] <span style="color:gray; font-size:smaller;">» This function is used to save the table in the database (sql).</span><br />
*[[Sort_Functions]] <span style="color:gray; font-size:smaller;">» These functions are able to sort your tables by a key.</span><br />
*[[table.compare]] <span style="color:gray; font-size:smaller;">» This function checks whether two given tables are equal.</span><br />
*[[table.copy]] <span style="color:gray; font-size:smaller;">» This function copies a whole table and all the tables in that table.</span><br />
*[[table.deepmerge]] <span style="color:gray; font-size:smaller;">» This function deep merges two tables. Every nested table will be correspondingly merged.</span><br />
*[[table.element]] <span style="color:gray; font-size:smaller;">» This function returns a new table with only userdata content.</span><br />
*[[table.flip]] <span style="color:gray; font-size:smaller;">» This function returns the table from the last value to the first value, such as reflection.</span><br />
*[[table.fromString]] <span style="color:gray; font-size:smaller;">» This function converts string to a table.</span><br />
*[[table.getRandomRows]] <span style="color:gray; font-size:smaller;">» This function returns random rows from table.</span><br />
*[[table.map]] <span style="color:gray; font-size:smaller;">» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.</span><br />
*[[table.merge]] <span style="color:gray; font-size:smaller;">» This function merges two or more tables together.</span><br />
*[[table.random]] <span style="color:gray; font-size:smaller;">» This function retrieves a random value from a table.</span><br />
*[[table.removeValue]] <span style="color:gray; font-size:smaller;">» This function removes a specified value from a table.</span><br />
*[[table.size]] <span style="color:gray; font-size:smaller;">» This function returns the absolute size of a table.</span><br />
<br />
=== ACL functions ===<br />
*[[aclGroupClone]] <span style="color:gray; font-size:smaller;">» This function clone a group to another group with/without ACLs and/or objects.</span><br />
*[[getAccountRanks]] <span style="color:gray; font-size:smaller;">» This function is used to detect the account name groups and put them in the chat.</span><br />
*[[getPlayerAcls]] <span style="color:gray; font-size:smaller;">» This function returns a table of all ACL groups on a player.</span><br />
*[[getPlayersInACLGroup]] <span style="color:gray; font-size:smaller;">» This function returns all players in an ACL group.</span><br />
*[[isPlayerInACL]] <span style="color:gray; font-size:smaller;">» This function checks if a player element is in an ACL group.</span><br />
*[[renameAclGroup]] <span style="color:gray; font-size:smaller;">» This function gives an existing ACL group a new name.</span><br />
*[[isPlayerACLAdmin]] <span style="color:gray; font-size:smaller;">» This function checks if a player element belong to Admin group in ACL</span><br />
<br />
=== Account functions ===<br />
*[[getPlayerFromAccountName]] <span style="color:gray; font-size:smaller;">» This function is used to obtain a player by the name of his account.</span><br />
<br />
=== Camera functions ===<br />
*[[smoothMoveCamera]] <span style="color:gray; font-size:smaller;">» This function allows you to create a cinematic camera flight.</span><br />
<br />
=== Colshape functions ===<br />
*[[createGarageColShape]] <span style="color:gray; font-size:smaller;">» This function creates a collision shape from the specified garage.</span><br />
<br />
=== Cursor functions ===<br />
*[[getCursorMovedOn]] <span style="color:gray; font-size:smaller;">» This function checks in which way the cursor is currently moving.</span><br />
*[[setCursorCenteredOnRectangle]] <span style="color:gray; font-size:smaller;">» This functions will center the cursor inside a rectangle.</span><br />
<br />
=== Drawing functions ===<br />
*[[dxDrawAnimWindow]] <span style="color:gray; font-size:smaller;">» This function draws an animated 2D window on the screen.</span><br />
*[[dxDrawBorderedRectangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a bordered rectangle.</span><br />
*[[dxDrawBorderedText]] <span style="color:gray; font-size:smaller;">» This is a function that will create a bordered text.</span><br />
*[[dxDrawDashedLine]] <span style="color:gray; font-size:smaller;">» This function draws a line with dashes.</span><br />
*[[dxDrawGifImage]] <span style="color:gray; font-size:smaller;">» This function simulates the effect of a GIF image by using image sprites in 2D.</span><br />
*[[dxDrawImage3D]] <span style="color:gray; font-size:smaller;">» This function draws a 3D image in GTA world.</span><br />
*[[dxDrawImageOnElement]] <span style="color:gray; font-size:smaller;">» This function draws an image on any element.</span><br />
*[[dxDrawLinedRectangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a rectangle outline with dx lines.</span><br />
*[[dxDrawLoading]] <span style="color:gray; font-size:smaller;">» This function draws a loading bar on the screen.</span><br />
*[[dxDrawOctagon3D]] <span style="color:gray; font-size:smaller;">» This function creates a 3D Octagon</span><br />
*[[dxDrawPolygon]] <span style="color:gray; font-size:smaller;">» This function draws a custom polygon on the screen.</span><br />
*[[dxDrawProgressBar]] <span style="color:gray; font-size:smaller;">» This function simulates a progress bar drawed using DirectDraw.</span><br />
*[[dxDrawRectangle3D]] <span style="color:gray; font-size:smaller;">» This function draws a 3D rectangle in GTA world.</span><br />
*[[dxDrawRectangleOnPlayer]] <span style="color:gray; font-size:smaller;">» This function draws a 3D rectangle above the player.</span><br />
*[[dxDrawRing]] <span style="color:gray; font-size:smaller;">» This function draws a ring with dx lines.</span><br />
*[[dxDrawRombo]] <span style="color:gray; font-size:smaller;">» This function creates a Rhombus.</span><br />
*[[dxDrawSprite]] <span style="color:gray; font-size:smaller;">» This function draw a sprite in the 3D world.</span><br />
*[[dxDrawTextOnElement]] <span style="color:gray; font-size:smaller;">» This function draws a text on any element.</span><br />
*[[dxDrawTextOnRectangle]] <span style="color:gray; font-size:smaller;">» Esta funcion crea un rectangle con un texto dentro.</span><br />
*[[dxDrawTriangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a triangle with dx lines.</span><br />
*[[dxFade]] <span style="color:gray; font-size:smaller;">» This function fade-in or fade-out any dxDraw by gradually changing its alpha value.</span><br />
*[[dxGetFontSizeFromHeight]] <span style="color:gray; font-size:smaller;">» This function calculates the font size from given height.</span><br />
*[[dxGetRealFontHeight]] <span style="color:gray; font-size:smaller;">» This function calculates the height of a font.</span><br />
*[[getScreenStartPositionFromBox]] <span style="color:gray; font-size:smaller;">» This function helps with getting the correct position for your dx-effects.</span><br />
*[[wordWrap]] <span style="color:gray; font-size:smaller;">» This function breaks a long string into a table of separate lines limited to a specific length in pixels, for drawing separately.</span><br />
*[[CreateRectangle3D]] <span style="color:gray; font-size:smaller;">» This is a function that will create a 3d rectangle on the player screen.</span><br />
*[[DxDrawBordered3DLine]] <span style="color:gray; font-size:smaller;">»This function creates a bordered area with 3D dx lines.</span><br />
<br />
=== Effects functions ===<br />
*[[attachEffect]] <span style="color:gray; font-size:smaller;">» This function allows you attach an effect to an element.</span><br />
*[[setScreenFlash]] <span style="color:gray; font-size:smaller;">» This function will make the screen flash(like a screenshot).</span><br />
<br />
=== Element functions === <br />
*[[autoAttach]] <span style="color:gray; font-size:smaller;">» This function attaches one element into another at the same position and rotation they are.</span><br />
*[[attachElementToBone]] <span style="color:gray; font-size:smaller;">» This function allows you to attach an element to ped bone accurately using new bone functions.</span><br />
*[[getElementDirectionCardialPoint]] <span style="color:gray; font-size:smaller;">» This function returns the direction of the element according to the ''wind rose''.</span><br />
*[[getElementSpeed]] <span style="color:gray; font-size:smaller;">» This function returns the specified element's speed in m/s, km/h or mph.</span><br />
*[[getElementUsingData]] <span style="color:gray; font-size:smaller;">» This function returns table elements that contains the elements data with the given key and value.</span><br />
*[[getElementZoneFullName]] <span style="color:gray; font-size:smaller;">» This function allows you to retrieve the zone full name of a element.</span><br />
*[[getElementsInDimension]] <span style="color:gray; font-size:smaller;">» This function returns a table of elements that are in the specified dimension.</span><br />
*[[getElementsWithinMarker]] <span style="color:gray; font-size:smaller;">» This function returns a table of elements that are within a marker's collision shape.</span><br />
*[[getNearestElement]] <span style="color:gray; font-size:smaller;">» This function returns the nearest element (of a specific type) to a player.</span><br />
*[[isElementInAir]] <span style="color:gray; font-size:smaller;">» This function checks if an element is in air or not.</span><br />
*[[isElementInPhotograph]] <span style="color:gray; font-size:smaller;">» This function checks if an element is in the player's camera picture area.</span><br />
*[[isElementInRange]] <span style="color:gray; font-size:smaller;">» This function allows you to check if an element's range to a main point is within the maximum range.</span><br />
*[[isElementMoving]] <span style="color:gray; font-size:smaller;">» This function checks if an element is moving.</span><br />
*[[isElementPlayer]] <span style="color:gray; font-size:smaller;">» This function checks whether the element is a player or not.</span><br />
*[[isElementWithinAColShape]] <span style="color:gray; font-size:smaller;">» This function checks if an element is within a collision shape element.</span><br />
*[[multi_check]] <span style="color:gray; font-size:smaller;">» This function checks one element to many, handy and clean.</span><br />
*[[setElementSpeed]] <span style="color:gray; font-size:smaller;">» This function allows you to set the speed of an element in kph or mph units.</span><br />
<br />
=== Events ===<br />
*[[onClientPlayerTimeChange]] <span style="color:gray; font-size:smaller;">» This code implements an event that is triggered when the player's real time change.</span><br />
*[[onPlayerZoneChange]] <span style="color:gray; font-size:smaller;">» This code implements an event that is triggered when the player enters a new area on the map.</span><br />
*[[onVehicleWeaponFire]] <span style="color:gray; font-size:smaller;">» This code implements an event that is triggered when a player in a vehicle fires a vehicle's weapon.</span><br />
<br />
=== Input functions ===<br />
*[[bindControlKeys]] <span style="color:gray; font-size:smaller;">» This function allows you to bind each key bound to a control individually. Doing this bypasses a little MTA restriction.</span><br />
*[[getBoundControls]] <span style="color:gray; font-size:smaller;">» This function returns a table of control names that are bound to the specified key.</span><br />
*[[unbindControlKeys]] <span style="color:gray; font-size:smaller;">» This function allows you to unbind each key bound to a control individually. Use this function with [[bindControlKeys]].</span><br />
*[[isCommandHandlerAdded]] <span style="color:gray; font-size:smaller;">» This function allows you to check if a command is added or not in the respective resource.</span><br />
<br />
=== Data functions === <br />
*[[byte2human]] <span style="color:gray; font-size:smaller;">» This function converts an integer (number of bytes) into a human-readable unit.</span><br />
*[[capitalize]] <span style="color:gray; font-size:smaller;">» This function capitalizes a given string.</span><br />
*[[convertDate]] <span style="color:gray; font-size:smaller;">» This function converts date to another look.</span><br />
*[[convertServerTickToTimeStamp]] <span style="color:gray; font-size:smaller;">» This function converts server ticks to a unix timestamp.</span><br />
*[[convertTextToSpeech]] <span style="color:gray; font-size:smaller;">» This function converts the provided text to a speech in the provided language which players can hear.</span><br />
*[[findRotation3D]] <span style="color:gray; font-size:smaller;">» This function takes two sets of XYZ coordinates. It returns the 3D direction from point A to point B.</span><br />
*[[findRotation]] <span style="color:gray; font-size:smaller;">» This function takes two points and returns the direction from point A to point B.</span><br />
*[[formatDate]] <span style="color:gray; font-size:smaller;">» This function formats a date on the basis of a format string and returns it.</span><br />
*[[formatNumber]] <span style="color:gray; font-size:smaller;">» This function formats large numbers by adding commas.</span><br />
*[[generateRandomASCIIString]] <span style="color:gray; font-size:smaller;">» This function returns a random string which uses ASCII characters. </span><br />
*[[generateString]] <span style="color:gray; font-size:smaller;">» This function generates a random string with any characters.</span><br />
*[[getAge]] <span style="color:gray; font-size:smaller;">» This function calculates the age of a given birthday.</span><br />
*[[getDistanceBetweenElements]] <span style="color:gray; font-size:smaller;">» Returns the distance between two elements.</span><br />
*[[getDistanceBetweenPointAndSegment2D]] <span style="color:gray; font-size:smaller;">» This function takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.</span><br />
*[[getEasterDate]] <span style="color:gray; font-size:smaller;">» This function returns easter date monthday and month for a given year.</span><br />
*[[getElementRelatedAngle]] <span style="color:gray; font-size:smaller;">» This function returns the related angle between one element to another. This is useful to check which side an element is to another.</span><br />
*[[getFreeDimension]] <span style="color:gray; font-size:smaller;">» This function get free dimension.</span><br />
*[[getKeyFromValueInTable]] <span style="color:gray; font-size:smaller;">» This function returns the key of the specified value in a table.</span><br />
*[[getOffsetFromXYZ]] <span style="color:gray; font-size:smaller;">» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.</span><br />
*[[getPointFromDistanceRotation]] <span style="color:gray; font-size:smaller;">» This function finds a point based on a starting point, direction and distance.</span><br />
*[[getRealMonth]] <span style="color:gray; font-size:smaller;">» This function returns the current month name</span><br />
*[[getRGColorFromPercentage]] <span style="color:gray; font-family:'Georgia', sans-serif; font-size:smaller;">»This function returns two integers representing red and green colors according to the specified percentage.</span><br />
*[[getScreenRotationFromWorldPosition]] <span style="color:gray; font-size:smaller;">» This function returns a screen relative rotation to a world position.</span><br />
*[[getTimestamp]] <span style="color:gray; font-size:smaller;">» This function returns the UNIX timestamp of a specified date and time.</span><br />
*[[gradientString]] <span style="color:gray; font-size:smaller;">» This function transforms a string in a new coloured gradient string.</span><br />
*[[hex2rgb]] <span style="color:gray; font-size:smaller;">» This function convert hex to rgb.</span><br />
*[[hexColorToRGB]] <span style="color:gray; font-size:smaller;">» This function convert hex string/number to RGBA values.</span><br />
*[[isLeapYear]] <span style="color:gray; font-size:smaller;">» This function returns a boolean representing if a given year is a leap year.</span><br />
*[[isValidMail]] <span style="color:gray; font-size:smaller;">» This function checks whether a provided e-mail string is valid.</span><br />
*[[removeHex]] <span style="color:gray; font-size:smaller;">» This function is used to remove hexadecimal numbers (colors, for example) from strings.<br />
*[[RGBToHex]] <span style="color:gray; font-size:smaller;">» This function returns a string representing the color in hexadecimal.</span><br />
*[[RGBToHSV]] <span style="color:gray; font-size:smaller;">» This function convert RGB to HSV color space.</span><br />
*[[RGBToDecimal]] <span style="color:gray; font-size:smaller;">» This function convert RGB to Decimal color.</span><br />
*[[secondsToTimeDesc]] <span style="color:gray; font-size:smaller;">» This function converts a plain seconds-integer into a user-friendly time description.</span><br />
*[[string.count]] <span style="color:gray; font-size:smaller;">» This function counts the amount of occurences of a string in a string.</span><br />
*[[string.explode]] <span style="color:gray; font-size:smaller;">» This function splits a string at a given separator pattern and returns a table with the pieces.</span><br />
*[[string.insert]] <span style="color:gray; font-size:smaller;">» This function inserts a string within another string at a given position.</span><br />
*[[switch]] <span style="color:gray; font-size:smaller;">» This function allows the value of a variable or expression to control the flow of program execution via a multiway branch.</span><br />
*[[tocolor2rgba]] <span style="color:gray; font-size:smaller;">» This function convert tocolor to rgba.</span><br />
*[[toHex]] <span style="color:gray; font-size:smaller;">» This function converts a decimal number to a hexadecimal number, as a fix to be used client-side.</span><br />
*[[var dump]] <span style="color:gray; font-size:smaller;">» This function outputs information about one or more variables using outputConsole.</span><br />
*[[wavelengthToRGBA]] <span style="color:gray; font-size:smaller;">» This function converts a physical wavelength of light to a RGBA color.</span><br />
<br />
=== GUI functions === <br />
*[[centerWindow]] <span style="color:gray; font-size:smaller;">» This function centers a CEGUI window element responsively in any resolution.</span><br />
*[[guiMoveElement]] <span style="color:gray; font-size:smaller;">» This function moves guiElement by/like using moveObject.</span><br />
*[[guiSetStaticImageMovable]] <span style="color:gray; font-size:smaller;">» This function allows you to move a static image like a gui window.</span><br />
*[[isMouseOnGUICloseButton]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether the mouse cursor/pointer is within a gui-window's native close button.</span><br />
*[[isMouseOnGuiElement]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether or not your mouse is over a specific gui element, this is especially useful if the gui element has a parent. </span><br />
=====Comboboxes=====<br />
*[[guiComboBoxAdjustHeight]] <span style="color:gray; font-size:smaller;">» This function adjusts a CEGUI combobox element to have the correct height.</span><br />
<br />
=====Gridlists=====<br />
*[[convertGridListToText]] <span style="color:gray; font-size:smaller;">» This function converts grid list contents to text.</span><br />
*[[getGridListRowIndexFromText]] <span style="color:gray; font-size:smaller;">» This function returns the GridList row index from the specified text.</span><br />
*[[guiGridListAddPlayers]] <span style="color:gray; font-size:smaller;">» This function add all online players to a grid list.</span><br />
*[[guiGridListGetColumnIDFromTitle]] <span style="color:gray; font-size:smaller;">» This function gets a gridlist's column ID from the column title.</span><br />
*[[guiGridListGetSelectedText]] <span style="color:gray; font-size:smaller;">» This function returns a string containing the inner text of a selected gridlist item.</span><br />
*[[guiGridListSetColumnNonSortable]] <span style="color:gray; font-size:smaller;">» This function makes a gridlist column become non-sortable.</span><br />
*[[isTextInGridList]] <span style="color:gray; font-size:smaller;">» This function checks if some text exist or not in the GridList.</span><br />
<br />
=====Labels=====<br />
*[[guiLabelAddEffect]] <span style="color:gray; font-size:smaller;">» This function add an effects to the gui-label like (shadow, outline).</span><br />
<br />
=== Marker functions ===<br />
*[[createMarkerAttachedTo]] <span style="color:gray; font-size:smaller;">» This function creates a marker that is attached to an element.</span><br />
<br />
=== Math functions ===<br />
*[[math.clamp]] <span style="color:gray; font-size:smaller;">» This function returns the number between range of numbers or it's minimum or maximum.</span><br />
*[[math.getBezierPoint]] <span style="color:gray; font-size:smaller;">» Get N-th order bezier point.</span><br />
*[[math.hypot]] <span style="color:gray; font-size:smaller;">» This function returns the Hypotenuse of the triangle given by sides x and y.</span><br />
*[[math.isPointInPolygon]] <span style="color:gray; font-size:smaller;">» Check if point is inside polygon or not.</span><br />
*[[math.lerp]] <span style="color:gray; font-size:smaller;">» Get val between two integer.</span><br />
*[[math.percent]] <span style="color:gray; font-size:smaller;">» This function returns a percentage from two number values.</span><br />
*[[math.polygonArea]] <span style="color:gray; font-size:smaller;">» Compute area of any polygon.</span><br />
*[[math.randomDiff]] <span style="color:gray; font-size:smaller;">» Generates a pseudo-random integer that's always different from the last random number generated.</span><br />
*[[math.rotVecToEulerAngle]] <span style="color:gray; font-size:smaller;">» Rotation Vector To Euler Angle</span><br />
*[[math.round]] <span style="color:gray; font-size:smaller;">» Rounds a number whereas the number of decimals to keep and the method may be set.</span><br />
*[[mathNumber]] <span style="color:gray; font-size:smaller;">» This function is a workaround for the client-side floating-point precision of 24-bits.</span><br />
*[[reMap]] <span style="color:gray; font-size:smaller;">» Re-maps a number from one range to another.</span><br />
*[[Math.percentProgress|math.percentProgress]] <span style="color:gray; font-size:smaller;">» Returns a percentage progress from two specific values.</span><br />
*[[math.average]] <span style="color:gray; font-size:smaller;">» This function returns the simple arithmetic mean of multiple numbers.</span><br />
<br />
=== Map functions ===<br />
*[[assignLod]] <span style="color:gray; font-size:smaller;">» This function lets you conveniently generate and apply a LOD model to a mapping object.</span><br />
*[[getWorldPositionFromMapPosition]] <span style="color:gray; font-size:smaller;">» This function converts an F11 map position to world position.</span><br />
<br />
=== Ped functions ===<br />
*[[getAlivePlayers (Client)|getAlivePlayers]] <span style="color:gray; font-size:smaller;">» This function returns a table of the alive players client-side.</span><br />
*[[getAlivePlayersInTeam]] <span style="color:gray; font-size:smaller;">» This function returns a table of the alive players in a team.</span><br />
*[[getGuestPlayers]] <span style="color:gray; font-size:smaller;">» This function gets a players not login or players Guest .</span><br />
*[[getOnlineAdmins]] <span style="color:gray; font-size:smaller;">» This function returns a table of all logged-in administrators.</span><br />
*[[getPedEyesPosition]] <span style="color:gray; font-size:smaller;">» This function allows you to get peds eyes position.</span><br />
*[[getPedGender]] <span style="color:gray; font-size:smaller;">» This function allows you to get peds their gender.</span><br />
*[[getPedMaxHealth]] <span style="color:gray; font-size:smaller;">» This function returns a pedestrians's maximum health by converting it from their maximum health stat.</span><br />
*[[getPedMaxOxygenLevel]] <span style="color:gray; font-size:smaller;">» This function returns a ped's maximum oxygen level by converting it from their maximum underwater stamina stat.</span><br />
*[[getPedWeaponSkill]] <span style="color:gray; font-size:smaller;">» This function returns a ped's corresponding weapon skill level name.</span><br />
*[[getPedHitBone]] <span style="color:gray; font-size:smaller;">» This function gets the approximate number of the bone where the ped is hit.</span><br />
*[[getPlayerFromNamePart]] <span style="color:gray; font-size:smaller;">» This function returns a player from partial name.</span><br />
*[[getPlayerFromSerial]] <span style="color:gray; font-size:smaller;">» This function returns a player from their serial.</span><br />
*[[getPlayersByData]] <span style="color:gray; font-size:smaller;">» This function returns a table of players that have the specified data name.</span><br />
*[[getPlayersInPhotograph]] <span style="color:gray; font-size:smaller;">» This function returns a table of all players in photograph.</span><br />
*[[getPlayersInVehicles]] <span style="color:gray; font-size:smaller;">» This function returns a table of the players insides vehicles from a specified dimension.</span><br />
*[[isPedAiming]]<span style="color:gray; font-size:smaller;">» This function checks if a pedestrian is aiming their weapon.</span><br />
*[[isPedAimingNearPed]] <span style="color:gray; font-size:smaller;">» This is similar to isPedAiming but uses a colshape to be more precise.</span><br />
*[[isPedDiving]] <span style="color:gray; font-size:smaller;">» This feature checks that pedestrian is diving in the water.</span><br />
*[[isPedDrivingVehicle]] <span style="color:gray; font-size:smaller;">» This function checks if a specified pedestrian is driving a vehicle.</span><br />
*[[isPlayerInTeam]] <span style="color:gray; font-size:smaller;">» This function checks if a player is in a specified team.</span><br />
*[[setPedAttack]] <span style="color:gray; font-size:smaller;">» This function will make a ped attack a specified target.</span><br />
*[[setPedFollow]] <span style="color:gray; font-size:smaller;">» This function will make a ped follow a specified target.</span><br />
*[[getPlayerNameFromID]] <span style="color:gray; font-size:smaller;">» This function will get the player name from the ID element data.</span><br />
<br />
=== Player functions ===<br />
*[[countPlayersInRange]] <span style="color:gray; font-size:smaller;">» This function returns the number of players that are within a certain range of the specified coordinates.</span><br />
*[[getPlayerPreviousAndNextWeapon]] <span style="color:gray; font-size:smaller;">» This function returns the player previous and next weapon.</span><br />
*[[getPlayersInRange]] <span style="color:gray; font-size:smaller;">» This function make a table of players within certain range.</span><br />
*[[isPlayerActuallyInVehicle]] <span style="color:gray; font-size:smaller;">» This function checks if a player is actually in a vehicle instead of just in the process of entering.</span><br />
*[[isPlayerHitByVehicle]] <span style="color:gray; font-size:smaller;">» This function cancels event when a element is hit by a vehicle.</span><br />
<br />
=== Resource functions ===<br />
*[[getFilesInResourceFolder]] <span style="color:gray; font-size:smaller;">» This function gets a list of files that are inside a folder of a resource.</span><br />
*[[getResourceScripts]] <span style="color:gray; font-size:smaller;">» This function returns a table of the resource scripts.</span><br />
*[[getResourceSettings]] <span style="color:gray; font-size:smaller;">» This function returns a table of the resource settings.</span><br />
*[[getResourceSize]] <span style="color:gray; font-size:smaller;">» This function returns the size of a specified resource in kB(kilobyte)</span><br />
*[[refreshResource]] <span style="color:gray; font-size:smaller;">» This function refreshes your resource if you changed any of the files<br />
*[[setResourcePriority]] <span style="color:gray; font-size:smaller;">» This function set resource download priority group.</span><br />
<br />
=== Sound functions ===<br />
*[[isSoundFinished]] <span style="color:gray; font-size:smaller;">» This function checks if a sound element has finished.</span><br />
*[[isSoundPlaying]] <span style="color:gray; font-size:smaller;">» This function checks if a sound element is playing or not.</span><br />
*[[stopSoundSlowly]] <span style="color:gray; font-size:smaller;">» This function stop your sound element slowly.</span><br />
<br />
=== Browser functions ===<br />
*[[playVideo]] <span style="color:gray; font-size:smaller;">» This function plays a video on the screen.</span><br />
<br />
=== Team functions ===<br />
*[[getTeamFromColor]] <span style="color:gray; font-size:smaller;">» This function returns a team element by the specified color.</span><br />
*[[getTeamWithFewestPlayers]] <span style="color:gray; font-size:smaller;">» This function returns a team element with least players of all the specified teams.</span><br />
<br />
=== Vehicle functions ===<br />
*[[findEmptyCarSeat]] <span style="color:gray; font-size:smaller;">» This function finds you the first empty seat in a vehicle.</span><br />
*[[getNearestVehicle]] <span style="color:gray; font-size:smaller;">» This function gets the nearest vehicle to the specified player in a specified distance.</span><br />
*[[getRandomVehicle]] <span style="color:gray; font-size:smaller;">» This function gets a random vehicle.</span><br />
*[[getValidVehicleModels]] <span style="color:gray; font-size:smaller;">» This function returns a table of all valid vehicle models.</span><br />
*[[getVehiclesCountByType]] <span style="color:gray; font-size:smaller;">» This function returns the amount of vehicles by the given type as an integer value.</span><br />
*[[getVehicleTurnVelocityCenterOfMass]]<span style="color:gray; font-size:smaller;">» This function gets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
*[[isVehicleDoubleExhaust]] <span style="color:gray; font-size:smaller;">» This function checks is exhaust vehicle double.</span><br />
*[[isVehicleEmpty]] <span style="color:gray; font-size:smaller;">» This function checks whether a vehicle is empty.</span><br />
*[[isVehicleOccupied]] <span style="color:gray; font-size:smaller;">» This function checks if a specified vehicle is occupied.</span><br />
*[[isVehicleOnRoof]] <span style="color:gray; font-size:smaller;">» This function checks whether vehicle is on roof.</span><br />
*[[isVehicleOnFire]] <span style="color:gray; font-size:smaller;">» This function checks if the vehicle is on fire or not.</span><br />
*[[isVehicleReversing]] <span style="color:gray; font-size:smaller;">» This function checks if a specified vehicle is moving backwards.</span><br />
*[[isVehicleUpgraded]] <span style="color:gray; font-size:smaller;">» This function checks is vehicle upgraded by upgrade ID.</span><br />
*[[setVehicleGravityPoint]] <span style="color:gray; font-size:smaller;">» This function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.</span><br />
*[[setVehicleTurnVelocityCenterOfMass]] <span style="color:gray; font-size:smaller;">» This function sets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
*[[setVehicleHandlingFromText]] <span style="color:gray; font-size:smaller;">» This function sets a vehicle's handling from text.</span><br />
*[[setVehicleWheelModel]] <span style="color:gray; font-size:smaller;">» This function changes the wheel model of the informed vehicle.</span><br />
<br />
=== Weapon functions === <br />
*[[getJetpackWeaponsEnabled]] <span style="color:gray; font-size:smaller;">» This function returns a table of enabled weapons usable on a jetpack.</span><br />
<br />
=== Object functions ===<br />
*[[getDynamicDoorObjectOpenRatio]] <span style="color:gray; font-size:smaller;">» This function tells you how open a dynamic door is in a range from 0 to 1.</span><br />
*[[isElementObject]] <span style="color:gray; font-size:smaller;">» This function tells you if an element is an object or no.</span><br />
<br />
=== XML functions ===<br />
*[[getXMLNodes]] <span style="color:gray; font-size:smaller;">» This function returns all children of a XML node.</span><br />
<br />
=== Engine functions ===<br />
*[[engineGetCOLsFromLibrary]] <span style="color:gray; font-size:smaller;">» This function gets the collision data from the col library.</span><br />
*[[engineLoadIMGContainer]] <span style="color:gray; font-size:smaller;">» This function loads the IMG container.</span><br />
<br />
=== Utility ===<br />
*[[animate]] <span style="color:gray; font-size:smaller;">» This function allows you to use interpolateBetween without render event and easily used.</span><br />
*[[callClientFunction]] <span style="color:gray; font-size:smaller;">» This function allows you to call any client-side function from the server's side.</span><br />
*[[callServerFunction]] <span style="color:gray; font-size:smaller;">» This function allows you to call any server-side function from the client's side.</span><br />
*[[check]] <span style="color:gray; font-size:smaller;">» This function checks if its arguments are of the right type and calls the error-function if one is not.</span><br />
*[[checkPassiveTimer]] <span style="color:gray; font-size:smaller;">» This function allows you to use passive timers in your conditions. For example you want to prevent players repeatedly using a command.</span><br />
*[[coroutine.resume]] <span style="color:gray; font-size:smaller;">» This function applies a fix for hidden coroutine error messages.</span><br />
*[[compact]] <span style="color:gray; font-size:smaller;">» This function create table containing variables and their values.</span><br />
*[[getBanFromName]] <span style="color:gray; font-size:smaller;">» This functions returns the ban of the given playername.</span><br />
*[[getCurrentFPS]] <span style="color:gray; font-size:smaller;">» This function returns the frames per second at which GTA: SA is running.</span><br />
*[[getSkinNameFromID]] <span style="color:gray; font-size:smaller;">» This function returns the name of the skin from the given id.</span><br />
*[[IfElse]] <span style="color:gray; font-size:smaller;">» This function returns one of two values based on a boolean expression.</span><br />
*[[isCharInString]] <span style="color:gray; font-size:smaller;">» This shared function allows you to check if a char specified is in a string value.</span><br />
*[[isLastExecuteInTimer]] <span style="color:gray; font-size:smaller;">» This function check if the execute is the last execute in the timer.</span><br />
*[[isMouseInCircle]] <span style="color:gray; font-size:smaller;">» This function checks if a cursor position is in circular area or not.</span><br />
*[[isMouseInPosition]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether the mouse cursor/pointer is within a rectangular position.</span><br />
*[[iterElements]] <span style="color:gray; font-size:smaller;">» This function returns ''a time-saving'' iterator for your for-loops.</span><br />
*[[PlotTrajectoryAtTime]] <span style="color:gray; font-size:smaller;">» Calculate projectile/water trajectory.</span><br />
*[[preprocessor]] <span style="color:gray; font-size:smaller;">» This function allow you to use gcc macros.</span><br />
*[[vector3:compare]] <span style="color:gray; font-size:smaller;">» This method checks whether two vectors match, with optional precision.</span><br />
*[[svgCreateRoundedRectangle]] <span style="color:gray; font-size:smaller;">» This function creates a rectangle with rounded edges.</span><br />
*[[debounce]] <span style="color:gray; font-size:smaller;">» This function is removing unwanted input noise.</span><br />
<br />
<noinclude>[[Category:Useful Functions]]</noinclude></div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=User:LordHenry&diff=78228User:LordHenry2023-10-14T03:47:04Z<p>LordHenry: /* Pages created by Lord Henry */</p>
<hr />
<div>__NOTOC__<br />
{{Note|This page requires '''DarkVector''' theme. You can enable dark mode in your [[Special:Preferences#mw-prefsection-rendering|preferences]].<br><br />
Also, enable '''legacy DarkVector'''.}}<br />
[[file:LordHenry-Logo.png|frameless|right]]<br />
== Lord Henry MTA profiles ==<br />
[https://community.multitheftauto.com/index.php?p=profile&id=421903 MTA community profile]<br><br />
[https://forum.mtasa.com/profile/50620-lord-henry MTA forum profile]<br><br />
MTA wiki profile <font color="gray"> (you are here)</font><br />
<br />
== Pages created by Lord Henry ==<br />
[[autoAttach]]<br><br />
[[createGarageColShape]]<br><br />
[[dxDrawBorderedText]]<br><br />
[[dxDrawRing]]<br><br />
[[dxFade]]<br><br />
[[exports]] (redirect page to [[call]])<br><br />
[[getServerIP]] (redirect page to [[GetServerConfigSetting]])<br><br />
[[getWorldPositionFromMapPosition]] <br><br />
[[guiGridListSetColumnNonSortable]]<br><br />
[[isMouseOnGUICloseButton]]<br><br />
[[isVehicleReversing]]<br><br />
[[lookAt]] (redirect page to [[findRotation3D]])<br><br />
[[math.randomDiff]]<br><br />
[[playVideo]]<br><br />
[[resource:Bone_attach]]<br><br />
[[setPedArmour]] (redirect page to [[setPedArmor]])<br><br />
[[Template:PT-BR/Client_function]]<br><br />
[[Template:PT-BR/Server_function]]<br><br />
[[Template:PT-BR/Useful_function]]<br><br />
[[Template:ZoneNames]]<br />
<br />
== Wiki contributions by Lord Henry ==<br />
[[Special:Contributions/LordHenry]]<br />
<br />
== External Links to Lord Henry ==<br />
[[file:Youtube.png|32px]] [https://www.youtube.com/c/LordHenry Lord Henry - Youtube Channel]<br><br />
[[file:Facebook.png|32px]] [https://www.facebook.com/LordHenryEntertainment/ Lord Henry - Facebook Page]<br><br />
[[file:Instagram.png|32px]] [https://www.instagram.com/lordhenry.games/ Lord Henry - Instagram Page]<br><br />
[[file:Artstation.png|32px]] [https://www.artstation.com/lordhenry/ Lord Henry - Artstation Page]<br><br />
[[file:Sketchfab.png|32px]] [https://sketchfab.com/lordhenry Lord Henry - Sketchfab]<br><br />
[[file:Github2.png|32px]] [https://github.com/Lord-Henry Lord Henry - Github]<br />
<br />
== Friendlist ==<br />
[[User:Danilo]]<br><br />
[[User:Eficiencia]]<br><br />
[[User:HiroShi]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=User:LordHenry&diff=78226User:LordHenry2023-10-14T03:32:12Z<p>LordHenry: /* Pages created by Lord Henry */</p>
<hr />
<div>__NOTOC__<br />
{{Note|This page requires '''DarkVector''' theme. You can enable dark mode in your [[Special:Preferences#mw-prefsection-rendering|preferences]].<br><br />
Also, enable '''legacy DarkVector'''.}}<br />
[[file:LordHenry-Logo.png|frameless|right]]<br />
== Lord Henry MTA profiles ==<br />
[https://community.multitheftauto.com/index.php?p=profile&id=421903 MTA community profile]<br><br />
[https://forum.mtasa.com/profile/50620-lord-henry MTA forum profile]<br><br />
MTA wiki profile <font color="gray"> (you are here)</font><br />
<br />
== Pages created by Lord Henry ==<br />
[[autoAttach]]<br><br />
[[createGarageColShape]]<br><br />
[[dxDrawBorderedText]]<br><br />
[[dxDrawRing]]<br><br />
[[dxFade]]<br><br />
[[exports]] (redirect page to [[call]])<br><br />
[[fadeInText]] (redirect page to [[dxFade]])<br><br />
[[getServerIP]] (redirect page to [[GetServerConfigSetting]])<br><br />
[[getWorldPositionFromMapPosition]] <br><br />
[[guiGridListSetColumnNonSortable]]<br><br />
[[isMouseOnGUICloseButton]]<br><br />
[[isVehicleReversing]]<br><br />
[[lookAt]] (redirect page to [[findRotation3D]])<br><br />
[[math.randomDiff]]<br><br />
[[playVideo]]<br><br />
[[resource:Bone_attach]]<br><br />
[[setPedArmour]] (redirect page to [[setPedArmor]])<br><br />
[[Template:PT-BR/Client_function]]<br><br />
[[Template:PT-BR/Server_function]]<br><br />
[[Template:PT-BR/Useful_function]]<br><br />
[[Template:ZoneNames]]<br />
<br />
== Wiki contributions by Lord Henry ==<br />
[[Special:Contributions/LordHenry]]<br />
<br />
== External Links to Lord Henry ==<br />
[[file:Youtube.png|32px]] [https://www.youtube.com/c/LordHenry Lord Henry - Youtube Channel]<br><br />
[[file:Facebook.png|32px]] [https://www.facebook.com/LordHenryEntertainment/ Lord Henry - Facebook Page]<br><br />
[[file:Instagram.png|32px]] [https://www.instagram.com/lordhenry.games/ Lord Henry - Instagram Page]<br><br />
[[file:Artstation.png|32px]] [https://www.artstation.com/lordhenry/ Lord Henry - Artstation Page]<br><br />
[[file:Sketchfab.png|32px]] [https://sketchfab.com/lordhenry Lord Henry - Sketchfab]<br><br />
[[file:Github2.png|32px]] [https://github.com/Lord-Henry Lord Henry - Github]<br />
<br />
== Friendlist ==<br />
[[User:Danilo]]<br><br />
[[User:Eficiencia]]<br><br />
[[User:HiroShi]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=DxFade&diff=78225DxFade2023-10-14T03:28:33Z<p>LordHenry: Created page with "{{Useful Function}} <lowercasetitle></lowercasetitle> __NOTOC__ This function allows you to fade-in or fade-out any dxDraw by gradually changing its alpha value.<br> {{Note|You can fade up to 3 values at the same time, as long as they are properly declared together on the same interpolateBetween function and on the ''dxFade'' function parameters.}} {{Note|If you need to start another fade while this function is already fading something, you will need another ''dxFade..."</p>
<hr />
<div>{{Useful Function}}<br />
<lowercasetitle></lowercasetitle><br />
__NOTOC__<br />
This function allows you to fade-in or fade-out any dxDraw by gradually changing its alpha value.<br><br />
{{Note|You can fade up to 3 values at the same time, as long as they are properly declared together on the same [[interpolateBetween]] function and on the ''dxFade'' function parameters.}}<br />
{{Note|If you need to start another fade while this function is already fading something, you will need another ''dxFade'' function.}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">bool dxFade (bool showing, int maxAlpha, float theDuration, string strEasingType, [float period, float amplitude, float overshoot])</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''showing:''' A boolean to fade-in (true) or fade-out (false).<br />
*'''maxAlpha:''' The amount of [http://en.wikipedia.org/wiki/RGBA_color_space alpha] the DX will use while visible (1-255).<br />
*'''theDuration:''' The number of milliseconds that the fade will elapse (1000 milliseconds = 1 second).<br />
*'''strEasingType:''' The [[Easing|easing function]] to use for the interpolation.<br />
<br />
===Optional Arguments===<br />
*'''period:''' The period of the [[Easing|easing function]] (only some easing functions use this parameter).<br />
*'''amplitude:''' The amplitude of the [[Easing|easing function]] (only some easing functions use this parameter).<br />
*'''overshoot:''' The overshoot of the [[Easing|easing function]] (only some easing functions use this parameter).<br />
<br />
==Code==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
function dxFade(showing, maxAlpha, theDuration, strEasingType, period, amplitude, overshoot)<br />
local start = getTickCount()<br />
if showing then<br />
currentAlpha = 0<br />
function renderIn()<br />
local now = getTickCount()<br />
local endTime = start + theDuration<br />
local elapsedTime = now - start<br />
local duration = endTime - start<br />
local progress = elapsedTime / duration<br />
currentAlpha = interpolateBetween (0, 0, 0, maxAlpha, 0, 0, progress, strEasingType, period, amplitude, overshoot)<br />
<br />
if currentAlpha >= maxAlpha then<br />
removeEventHandler("onClientRender", root, renderIn)<br />
end<br />
end<br />
addEventHandler("onClientRender", root, renderIn)<br />
else<br />
currentAlpha = maxAlpha<br />
function renderOut()<br />
local now = getTickCount()<br />
local endTime = start + theDuration<br />
local elapsedTime = now - start<br />
local duration = endTime - start<br />
local progress = elapsedTime / duration<br />
currentAlpha = interpolateBetween (maxAlpha, 0, 0, 0, 0, 0, progress, strEasingType, period, amplitude, overshoot)<br />
<br />
if currentAlpha <= 0 then<br />
removeEventHandler("onClientRender", root, renderOut)<br />
end<br />
end<br />
addEventHandler("onClientRender", root, renderOut)<br />
end<br />
end<br />
</syntaxhighlight><br />
</section><br />
'''Author:''' [[User:LordHenry|LordHenry]]<br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This example shows an image on the screen that fade-in during 1 second and after 3 seconds, it fade-out during 1 second.<br />
<syntaxhighlight lang="lua"><br />
local screen = Vector2 (guiGetScreenSize())<br />
local x, y = (screen.x / 1920), (screen.y / 1080)<br />
<br />
function drawSomething()<br />
dxDrawImage (0, 0, x*1920, y*1080, "image.png", 0, 0, 0, tocolor (255, 255, 255, currentAlpha or 0)) -- You need to provide the image.<br />
end<br />
addEventHandler ("onClientRender", root, drawSomething)<br />
<br />
addEventHandler ("onClientResourceStart", resourceRoot, function ()<br />
dxFade (true, 255, 1000, "Linear")<br />
<br />
setTimer (function()<br />
dxFade (false, 255, 1000, "Linear")<br />
end, 3000, 1)<br />
end)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=IsObjectInACLGroup&diff=77659IsObjectInACLGroup2023-09-21T16:49:08Z<p>LordHenry: /* Required Arguments */</p>
<hr />
<div>__NOTOC__ <br />
{{Server function}} <br />
{{Important Note|You must '''NOT''' to use this function to limit features to users that belong to specific groups. Instead you '''MUST''' use [[hasObjectPermissionTo]]. Using this function forces the server owner to name their group a certain way, whereas using hasObjectPermissionTo allows the owner to give permission for whatever features you restrict to whatever groups they have set up in their ACL.}}<br />
This function is used to determine if an object is in a group.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool isObjectInACLGroup ( string theObjectName, aclgroup theGroup )<br />
</syntaxhighlight> <br />
{{New feature/item|3.0141|1.4.0|6994|{{OOP||[[aclgroup]]:doesContainObject||}}}}<br />
===Required Arguments=== <br />
*'''theObjectName:''' the name of the object to check. Examples: "resource.ctf", "user.Jim".<br />
*'''theGroup:''' the [[AclGroup|ACL group]] pointer of the group from which the object should be found.<br />
<br />
===Returns===<br />
Returns ''true'' if the object is in the specified group, ''false'' otherwise.<br />
<br />
==Example== <br />
''' Example 1:''' This example adds a ''jetpack'' command that is only available to admins. When entering the command, it will toggle the player's jetpack.<br />
<syntaxhighlight lang="lua"><br />
addCommandHandler ( "jetpack",<br />
function ( thePlayer )<br />
if doesPedHaveJetPack ( thePlayer ) then -- If the player have a jetpack already, remove it<br />
removePedJetPack ( thePlayer ) -- Remove the jetpack<br />
return -- And stop the function here<br />
end<br />
<br />
-- Otherwise, give him one if he has access<br />
<br />
local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name<br />
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then -- Does he have access to Admin functions?<br />
if not doesPedHaveJetPack ( thePlayer ) then -- If the player doesn't have a jetpack give it.<br />
givePedJetPack ( thePlayer ) -- Give the jetpack<br />
end<br />
end<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
'''Example 2:''' This example displays a list of all the online admins in the chat box (assuming your administrator's group in your ACL is called 'admin'):<br />
<syntaxhighlight lang="lua"><br />
players = getElementsByType ( "player" )<br />
admins = ""<br />
for k,v in ipairs(players) do<br />
local accountname = ""<br />
if (isGuestAccount(getPlayerAccount(v)) == false) then<br />
accountname = getAccountName (getPlayerAccount(v))<br />
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "admin" ) ) then<br />
if (admins == "") then<br />
admins = getPlayerName(v)<br />
else<br />
admins = admins .. ", " .. getPlayerName(v)<br />
end<br />
end<br />
end<br />
end<br />
outputChatBox( "Online Admins:", getRootElement(), 255, 255, 0)<br />
outputChatBox( " " .. tostring ( admins ), getRootElement(), 255, 255, 0)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{ACL_functions}}<br />
[[zh-cn:IsObjectInACLGroup]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=Control_names&diff=77055Control names2023-06-17T22:27:29Z<p>LordHenry: Undo changes.</p>
<hr />
<div>This page lists all the control names. These can be used as key arguments by the console commands ''bind'' and ''unbind'' as well as scripting functions such as [[bindKey]], [[unbindKey]], [[toggleControl]] etc.<br />
<br />
Lua table of all the valid control names listed on this page:<br />
<syntaxhighlight lang="lua">controlTable = { "fire", "aim_weapon", "next_weapon", "previous_weapon", "forwards", "backwards", "left", "right", "zoom_in", "zoom_out",<br />
"change_camera", "jump", "sprint", "look_behind", "crouch", "action", "walk", "conversation_yes", "conversation_no",<br />
"group_control_forwards", "group_control_back", "enter_exit", "vehicle_fire", "vehicle_secondary_fire", "vehicle_left", "vehicle_right",<br />
"steer_forward", "steer_back", "accelerate", "brake_reverse", "radio_next", "radio_previous", "radio_user_track_skip", "horn", "sub_mission",<br />
"handbrake", "vehicle_look_left", "vehicle_look_right", "vehicle_look_behind", "vehicle_mouse_look", "special_control_left", "special_control_right",<br />
"special_control_down", "special_control_up" }</syntaxhighlight><br />
<br />
==GTA control list==<br />
<div style="border:3px solid green;margin-bottom:3px;"><div style="float:right;padding-right:5px;font-weight:bold;">ON FOOT</div><br />
* '''fire''' Fire a player's weapon. ('''Note''': If you want to disable weapons fire, remember to also disable the control '''action''' in addition to the control '''fire'''.)<br />
* '''aim_weapon''' Aim the player's current weapon. (if possible) (this also affects right-click + F punching)<br />
* '''next_weapon''' Switch to the next weapon.<br />
* '''previous_weapon''' Switch to the previous weapon.<br />
* '''forwards''' Move forwards.<br />
* '''backwards''' Move backwards.<br />
* '''left''' Move left.<br />
* '''right''' Move right.<br />
* '''zoom_in''' Zoom targeted weapon in. (sniper/rocket launcher/camera etc)<br />
* '''zoom_out''' Zoom targeted weapon out.<br />
* '''change_camera''' Change camera mode.<br />
* '''jump''' Make the player jump.<br />
* '''sprint''' Make the player sprint.<br />
* '''look_behind''' Make the player look behind. (and allow the player to see behind them)<br />
* '''crouch''' Make the player crouch/duck.<br />
* '''action''' Show the stats menu - Fire with tab key.<br />
* '''walk''' Make the player move slowly/quietly.<br />
* '''conversation_yes''' Answer yes to a question.<br />
* '''conversation_no''' Answer no to a question.<br />
* '''group_control_forwards''' Make the group you are controlling move forwards.<br />
* '''group_control_back''' Make the group you are controlling move backwards.<br />
* '''enter_exit''' Make the player enter a vehicle. Also used for alternative fighting styles.<br />
</div><br />
<div style="border:3px solid red;margin-bottom:3px;"><div style="float:right;padding-right:5px;font-weight:bold;">IN VEHICLE</div><br />
* '''vehicle_fire''' Fire the player's vehicle's primary weapon (e.g. hunter's missiles) or shoot with driveby.<br />
* '''vehicle_secondary_fire''' Fire the player's vehicle's secondary weapon. (e.g. hunter's minigun)<br />
* '''vehicle_left''' Make the player's vehicle turn left.<br />
* '''vehicle_right''' Make the player's vehicle turn right.<br />
* '''steer_forward''' Make the player's vehicle turn down. (lean forwards for helicopters/planes)<br />
* '''steer_back''' Make the player's vehicle turn up. (lean backwards for helicopters/planes)<br />
* '''accelerate''' Make the player's vehicle accelerate.<br />
* '''brake_reverse''' Make the player's vehicle brake (slow down) and if stationary reverse.<br />
* '''radio_next''' Change to the next radio station. (Doesn't work - use [[setRadioChannel]] and [[onClientPlayerRadioSwitch]] instead.)<br />
* '''radio_previous''' Change to the previous radio station. (Doesn't work - use [[setRadioChannel]] and [[onClientPlayerRadioSwitch]] instead.)<br />
* '''radio_user_track_skip''' Skip the current track being played on the custom radio station.<br />
* '''horn''' Play the horn of the player's vehicle (if the vehicle has a horn) and can trigger the siren on emergency vehicles.<br />
* '''sub_mission''' Start a submission if one is avaliable. (e.g. taxi missions)<br />
* '''handbrake''' Apply the handbrake on the player's vehicle.<br />
* '''vehicle_look_left''' Look to the left.<br />
* '''vehicle_look_right''' Look to the right.<br />
* '''vehicle_look_behind''' Look behind.<br />
* '''vehicle_mouse_look''' <br />
* '''special_control_left''' Move the some special vehicle component left. (e.g. tank's turret)<br />
* '''special_control_right''' Move the some special vehicle component right. (e.g. tank's turret)<br />
* '''special_control_down''' Move the some special vehicle component down. (e.g. tank's turret)<br />
* '''special_control_up''' Move the some special vehicle component up. (e.g. tank's turret)<br />
* '''enter_exit''' Make the player exit a vehicle.<br />
</div><br />
<br />
==MTA hard-coded commands==<br />
The following are names of hard-coded MTA commands which do not use bindKey, but can act as bindKey by using them in an [[addCommandHandler]]. Other than that, this control list will '''only''' work with the functions [[toggleControl]] and [[toggleAllControls]]. Please note that [[toggleControl]] can't disable screenshot.<br />
<br />
<div style="border:3px solid blue;margin-bottom:3px;"><div<br />
style="float:right;padding-right:5px;font-weight:bold;">MTA COMMANDS</div><br />
* '''enter_passenger''' Enters the closest vehicle as passenger<br />
* '''screenshot''' Takes a screenshot<br />
* '''chatbox''' Opens the chatbox for input<br />
* '''radar''' Toggles the radar-map showing<br />
* '''radar_zoom_in''' Zooms in on the radar-map<br />
* '''radar_zoom_out''' Zooms out on the radar-map<br />
* '''radar_move_north''' Moves north on the radar-map<br />
* '''radar_move_south''' Moves south on the radar-map<br />
* '''radar_move_east''' Moves east on the radar-map<br />
* '''radar_move_west''' Moves west on the radar-map<br />
* '''radar_attach''' Attaches the view to the local-player on the radar-map<br />
</div><br />
[[Category:Scripting Concepts]]<br />
[[pt-br:Control_names]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=Control_names&diff=77054Control names2023-06-17T22:25:43Z<p>LordHenry: /* GTA control list */</p>
<hr />
<div>This page lists all the control names. These can be used as key arguments by the console commands ''bind'' and ''unbind'' as well as scripting functions such as [[bindKey]], [[unbindKey]], [[toggleControl]] etc.<br />
<br />
Lua table of all the valid control names listed on this page:<br />
<syntaxhighlight lang="lua">controlTable = { "fire", "aim_weapon", "next_weapon", "previous_weapon", "forwards", "backwards", "left", "right", "zoom_in", "zoom_out",<br />
"change_camera", "jump", "sprint", "look_behind", "crouch", "action", "walk", "conversation_yes", "conversation_no",<br />
"group_control_forwards", "group_control_back", "enter_exit", "vehicle_fire", "vehicle_secondary_fire", "vehicle_left", "vehicle_right",<br />
"steer_forward", "steer_back", "accelerate", "brake_reverse", "radio_next", "radio_previous", "radio_user_track_skip", "horn", "sub_mission",<br />
"handbrake", "vehicle_look_left", "vehicle_look_right", "vehicle_look_behind", "vehicle_mouse_look", "special_control_left", "special_control_right",<br />
"special_control_down", "special_control_up" }</syntaxhighlight><br />
<br />
==GTA control list==<br />
<div style="border:3px solid green;margin-bottom:3px;"><div style="float:right;padding-right:5px;font-weight:bold;">ON FOOT</div><br />
* '''fire''' Fire a player's weapon. ('''Note''': If you want to disable weapons fire, remember to also disable the control '''action''' in addition to the control '''fire'''.)<br />
* '''aim_weapon''' Aim the player's current weapon. (if possible) (this also affects right-click + F punching)<br />
* '''next_weapon''' Switch to the next weapon.<br />
* '''previous_weapon''' Switch to the previous weapon.<br />
* '''forwards''' Move forwards.<br />
* '''backwards''' Move backwards.<br />
* '''left''' Move left.<br />
* '''right''' Move right.<br />
* '''zoom_in''' Zoom targeted weapon in. (sniper/rocket launcher/camera etc)<br />
* '''zoom_out''' Zoom targeted weapon out.<br />
* '''change_camera''' Change camera mode.<br />
* '''jump''' Make the player jump.<br />
* '''sprint''' Make the player sprint.<br />
* '''look_behind''' Make the player look behind. (and allow the player to see behind them)<br />
* '''crouch''' Make the player crouch/duck.<br />
* '''action''' Show the stats menu - Fire with tab key.<br />
* '''walk''' Make the player move slowly/quietly.<br />
* '''conversation_yes''' Answer yes to a question.<br />
* '''conversation_no''' Answer no to a question.<br />
* '''group_control_forwards''' Make the group you are controlling move forwards.<br />
* '''group_control_back''' Make the group you are controlling move backwards.<br />
* '''enter_exit''' Make the player enter a vehicle. Also used for alternative fighting styles.<br />
* '''enter_passenger''' Make the player enter a vehicle as a passenger.<br />
</div><br />
<div style="border:3px solid red;margin-bottom:3px;"><div style="float:right;padding-right:5px;font-weight:bold;">IN VEHICLE</div><br />
* '''vehicle_fire''' Fire the player's vehicle's primary weapon (e.g. hunter's missiles) or shoot with driveby.<br />
* '''vehicle_secondary_fire''' Fire the player's vehicle's secondary weapon. (e.g. hunter's minigun)<br />
* '''vehicle_left''' Make the player's vehicle turn left.<br />
* '''vehicle_right''' Make the player's vehicle turn right.<br />
* '''steer_forward''' Make the player's vehicle turn down. (lean forwards for helicopters/planes)<br />
* '''steer_back''' Make the player's vehicle turn up. (lean backwards for helicopters/planes)<br />
* '''accelerate''' Make the player's vehicle accelerate.<br />
* '''brake_reverse''' Make the player's vehicle brake (slow down) and if stationary reverse.<br />
* '''radio_next''' Change to the next radio station. (Doesn't work - use [[setRadioChannel]] and [[onClientPlayerRadioSwitch]] instead.)<br />
* '''radio_previous''' Change to the previous radio station. (Doesn't work - use [[setRadioChannel]] and [[onClientPlayerRadioSwitch]] instead.)<br />
* '''radio_user_track_skip''' Skip the current track being played on the custom radio station.<br />
* '''horn''' Play the horn of the player's vehicle (if the vehicle has a horn) and can trigger the siren on emergency vehicles.<br />
* '''sub_mission''' Start a submission if one is avaliable. (e.g. taxi missions)<br />
* '''handbrake''' Apply the handbrake on the player's vehicle.<br />
* '''vehicle_look_left''' Look to the left.<br />
* '''vehicle_look_right''' Look to the right.<br />
* '''vehicle_look_behind''' Look behind.<br />
* '''vehicle_mouse_look''' <br />
* '''special_control_left''' Move the some special vehicle component left. (e.g. tank's turret)<br />
* '''special_control_right''' Move the some special vehicle component right. (e.g. tank's turret)<br />
* '''special_control_down''' Move the some special vehicle component down. (e.g. tank's turret)<br />
* '''special_control_up''' Move the some special vehicle component up. (e.g. tank's turret)<br />
* '''enter_exit''' Make the player exit a vehicle.<br />
* '''enter_passenger''' Make the player exit a vehicle as a passenger. The player can still exit de vehicle using the "enter_exit" control, so you need to disable both if needed.<br />
</div><br />
<br />
==MTA hard-coded commands==<br />
The following are names of hard-coded MTA commands which do not use bindKey, but can act as bindKey by using them in an [[addCommandHandler]]. Other than that, this control list will '''only''' work with the functions [[toggleControl]] and [[toggleAllControls]]. Please note that [[toggleControl]] can't disable screenshot.<br />
<br />
<div style="border:3px solid blue;margin-bottom:3px;"><div<br />
style="float:right;padding-right:5px;font-weight:bold;">MTA COMMANDS</div><br />
* '''enter_passenger''' Enters the closest vehicle as passenger<br />
* '''screenshot''' Takes a screenshot<br />
* '''chatbox''' Opens the chatbox for input<br />
* '''radar''' Toggles the radar-map showing<br />
* '''radar_zoom_in''' Zooms in on the radar-map<br />
* '''radar_zoom_out''' Zooms out on the radar-map<br />
* '''radar_move_north''' Moves north on the radar-map<br />
* '''radar_move_south''' Moves south on the radar-map<br />
* '''radar_move_east''' Moves east on the radar-map<br />
* '''radar_move_west''' Moves west on the radar-map<br />
* '''radar_attach''' Attaches the view to the local-player on the radar-map<br />
</div><br />
[[Category:Scripting Concepts]]<br />
[[pt-br:Control_names]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=DxDrawBorderedText&diff=77046DxDrawBorderedText2023-06-16T20:23:00Z<p>LordHenry: /* Code */ Allow scaleY parameter.</p>
<hr />
<div>{{Useful Function}}<br />
<lowercasetitle></lowercasetitle><br />
__NOTOC__<br />
This function renders a text with an outline. In order for the text to stay visible continuously, you need to call this function with the same parameters on each frame update (see [[onClientRender]]).<br />
<br />
== Syntax ==<br />
<syntaxhighlight lang="lua">bool dxDrawBorderedText ( int outline, string text, float left, float top [, float right = left, float bottom = top, int color = white,<br />
float scaleXY = 1.0 [, float scaleY = 1.0 ], mixed font = "default", string alignX = "left", string alignY = "top",<br />
bool clip = false, bool wordBreak = false, bool postGUI = false, bool colorCoded = false, bool subPixelPositioning = false,<br />
float fRotation = 0.0, float fRotationCenterX = 0.0, float fRotationCenterY = 0.0 ] )</syntaxhighlight><br />
<br />
===Required Arguments=== <br />
*'''outline:''' an integer representing the text outline weight.<br />
*'''text:''' the text to draw.<br />
*'''left:''' the absolute X coordinate of the top left corner of the text.<br />
*'''top:''' the absolute Y coordinate of the top left corner of the text.<br />
<br />
===Optional Arguments===<br />
*'''right:''' the absolute X coordinate of the right side of the text bounding box. Used for text aligning, clipping and word breaking.<br />
*'''bottom:''' the absolute Y coordinate of the bottom side of the text bounding box. Used for text aligning, clipping and word breaking.<br />
*'''color:''' the color of the text, a value produced by [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).<br />
*'''scale:''' the size of the text.{{New feature|3.0110|1.1|'''scale:''' can (optionally) be specified as two floats. i.e. '''scaleX, scaleY'''}}<br />
*'''font:''' Either a custom [[DX font]] element or the name of a built-in DX font: '''Note: Some fonts are incompatible with certain languages such as Arabic.'''<br />
{{DxFonts}}<br />
*'''alignX:''' horizontal alignment of the text within the bounding box. Can be '''"left"''', '''"center"''' or '''"right"'''.<br />
*'''alignY:''' vertical alignment of the text within the bounding box. Can be '''"top"''', '''"center"''' or '''"bottom"'''.<br />
*'''clip:''' if set to ''true'', the parts of the text that don't fit within the bounding box will be cut off.<br />
*'''wordBreak:''' if set to ''true'', the text will wrap to a new line whenever it reaches the right side of the bounding box. If ''false'', the text will always be completely on one line.<br />
* '''postGUI:''' A bool representing whether the text should be drawn on top of or behind any ingame GUI (rendered by CEGUI).<br />
*'''colorCoded:''' Set to true to enable embedded #FFFFFF color codes. '''Note: clip and wordBreak are forced false if this is set.'''<br />
*'''subPixelPositioning:''' A bool representing whether the text can be positioned sub-pixel-ly. Looks nicer for moving/scaling animations.<br />
*'''fRotation:''' Rotation'''<br />
*'''fRotationCenterX:''' Rotation Origin X'''<br />
*'''fRotationCenterY:''' Rotation Origin Y'''<br />
<br />
===Returns===<br />
This function doesn't return values.<br />
<br />
==Code==<br />
<section name="Version1" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
function dxDrawBorderedText (outline, text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
for oX = (outline * -1), outline do<br />
for oY = (outline * -1), outline do<br />
dxDrawText (text, left + oX, top + oY, right + oX, bottom + oY, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
end<br />
end<br />
dxDrawText (text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Version2" class="client" show="true"><br />
This second version makes the outline width adapts to the font scale instead of using a fixed outline width. If you increase the font size, the outline width will also increase.<br />
<syntaxhighlight lang="lua"><br />
function dxDrawBorderedText (outline, text, left, top, right, bottom, color, scaleX, scaleY, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
if type(scaleY) == "string" then<br />
scaleY, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY = scaleX, scaleY, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX<br />
end<br />
local outlineX = (scaleX or 1) * (1.333333333333334 * (outline or 1))<br />
local outlineY = (scaleY or 1) * (1.333333333333334 * (outline or 1))<br />
dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left - outlineX, top - outlineY, right - outlineX, bottom - outlineY, tocolor (0, 0, 0, 225), scaleX, scaleY, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left + outlineX, top - outlineY, right + outlineX, bottom - outlineY, tocolor (0, 0, 0, 225), scaleX, scaleY, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left - outlineX, top + outlineY, right - outlineX, bottom + outlineY, tocolor (0, 0, 0, 225), scaleX, scaleY, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left + outlineX, top + outlineY, right + outlineX, bottom + outlineY, tocolor (0, 0, 0, 225), scaleX, scaleY, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left - outlineX, top, right - outlineX, bottom, tocolor (0, 0, 0, 225), scaleX, scaleY, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left + outlineX, top, right + outlineX, bottom, tocolor (0, 0, 0, 225), scaleX, scaleY, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left, top - outlineY, right, bottom - outlineY, tocolor (0, 0, 0, 225), scaleX, scaleY, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left, top + outlineY, right, bottom + outlineY, tocolor (0, 0, 0, 225), scaleX, scaleY, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
dxDrawText (text, left, top, right, bottom, color, scaleX, scaleY, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)<br />
end<br />
</syntaxhighlight><br />
</section><br />
'''Author:''' [[User:LordHenry|LordHenry]]<br />
<br />
==Example==<br />
This example draws a text with outline on the screen.<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua">local screenX, screenY = guiGetScreenSize()<br />
<br />
addEventHandler ("onClientRender", root, function()<br />
dxDrawBorderedText (3, "mission completed!", 0, 0, screenX, screenY - (screenY * 0.1), tocolor (150, 100, 0, 255), 3, "pricedown", "center", "center", true, false)<br />
dxDrawBorderedText (3, "$1000000", 0, screenY * 0.1, screenX, screenY, tocolor (255, 255, 255, 255), 3, "pricedown", "center", "center", true, false)<br />
end)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=User:LordHenry&diff=76749User:LordHenry2023-04-25T20:34:11Z<p>LordHenry: DarkVector info.</p>
<hr />
<div>__NOTOC__<br />
{{Note|This page requires '''DarkVector''' theme. You can enable dark mode in your [[Special:Preferences#mw-prefsection-rendering|preferences]].<br><br />
Also, enable '''legacy DarkVector'''.}}<br />
[[file:LordHenry-Logo.png|frameless|right]]<br />
== Lord Henry MTA profiles ==<br />
[https://community.multitheftauto.com/index.php?p=profile&id=421903 MTA community profile]<br><br />
[https://forum.mtasa.com/profile/50620-lord-henry MTA forum profile]<br><br />
MTA wiki profile <font color="gray"> (you are here)</font><br />
<br />
== Pages created by Lord Henry ==<br />
[[autoAttach]]<br><br />
[[createGarageColShape]]<br><br />
[[dxDrawBorderedText]]<br><br />
[[dxDrawRing]]<br><br />
[[exports]] (redirect page to [[call]])<br><br />
[[fadeInText]]<br><br />
[[getServerIP]] (redirect page to [[GetServerConfigSetting]])<br><br />
[[getWorldPositionFromMapPosition]] <br><br />
[[guiGridListSetColumnNonSortable]]<br><br />
[[isMouseOnGUICloseButton]]<br><br />
[[isVehicleReversing]]<br><br />
[[lookAt]] (redirect page to [[findRotation3D]])<br><br />
[[math.randomDiff]]<br><br />
[[playVideo]]<br><br />
[[resource:Bone_attach]]<br><br />
[[setPedArmour]] (redirect page to [[setPedArmor]])<br><br />
[[Template:PT-BR/Client_function]]<br><br />
[[Template:PT-BR/Server_function]]<br><br />
[[Template:PT-BR/Useful_function]]<br><br />
[[Template:ZoneNames]]<br />
<br />
== Wiki contributions by Lord Henry ==<br />
[[Special:Contributions/LordHenry]]<br />
<br />
== External Links to Lord Henry ==<br />
[[file:Youtube.png|32px]] [https://www.youtube.com/c/LordHenry Lord Henry - Youtube Channel]<br><br />
[[file:Facebook.png|32px]] [https://www.facebook.com/LordHenryEntertainment/ Lord Henry - Facebook Page]<br><br />
[[file:Instagram.png|32px]] [https://www.instagram.com/lordhenry.games/ Lord Henry - Instagram Page]<br><br />
[[file:Artstation.png|32px]] [https://www.artstation.com/lordhenry/ Lord Henry - Artstation Page]<br><br />
[[file:Sketchfab.png|32px]] [https://sketchfab.com/lordhenry Lord Henry - Sketchfab]<br><br />
[[file:Github2.png|32px]] [https://github.com/Lord-Henry Lord Henry - Github]<br />
<br />
== Friendlist ==<br />
[[User:Danilo]]<br><br />
[[User:Eficiencia]]<br><br />
[[User:HiroShi]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=P%C3%A1gina_Inicial&diff=76748Página Inicial2023-04-25T20:25:28Z<p>LordHenry: Suspicious link changed.</p>
<hr />
<div>{| width="100%" cellspacing="0" cellpadding="0"<br />
| colspan="2" |<br />
<div style="border: 1px solid #D8D8D8; padding: 5px; height: 130px;"><br />
[[File:Mtalogo.png|left|100px]]'''Bem vindo ao Wiki do Multi Theft Auto.''' Aqui você encontra tudo sobre o uso desta modificação.<br />
<br />
Há muitas [[PT-BR/Como_você_pode_ajudar|coisas em que você pode nos ajudar]] para melhorar este programa, como criar um mapa, um modo de jogo, documentar funções e eventos, escrever códigos úteis para outros usuários, fazer tutoriais, reportar bugs que encontrar ou somente jogar a vontade!<br />
<br />
Se você tem alguma dúvida a respeito do Multi Theft Auto, não se esqueça de perguntar à comunidade em nossos [http://forum.mtasa.com/ fóruns].<br />
<br><br><br />
[ Pare de jogar sozinho ]<br />
<br><br><br />
</div><br />
|}<br />
{| width="100%" cellspacing="0" cellpadding="0"<br />
| colspan="2" |<br />
|-<br />
|width="50%" style="vertical-align:top;" |<div style="border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px; background: #FFFCF2;"><br />
<div style="float:right; width: 32px;">[[File:Input-gaming.png|link=]]</div><br />
<h3>Jogar</h3><br />
<div style="background: #FFEEAA; border: 1px solid #FFCD19;"><br />
[[File:Go-down.png|link=http://mtasa.com/]] ''' [http://mtasa.com/ Baixe o Multi Theft Auto {{Current Version|full}}]'''</div><br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Onde_adquirir_o_GTASA|Onde adquirir o GTASA]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Manual_do_Cliente|Manual do usuário]]<br />
<!--* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Novidades_na_versão_{{Current Version|full}}|Novidades da última versão ]] --><br />
* [[Image:iUS.png|Em Inglês|20px]] [[Changes_in_{{padleft:|5|{{Current Version|full}}}}| Novidades da versão {{padleft:|5|{{Current Version|full}}}}]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Soluções_de_Problemas_-_FAQ|Solução de problemas]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Migrando_do_MTA:Race_ao_MTA:SA_1.3|Migrando do MTA:Race para o MTA:SA {{padleft:|3|{{Current Version|full}}}}]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Manual_do_Servidor|Manual do servidor]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Recursos:Map_Manager|Gerenciador de mapas (''Map Manager'')]]<br />
<br />
<h3>Editor de mapas</h3><br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Resource:Editor|Manual do editor]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Resource:Editor-EDF|Ficheiro de definições do editor (EDF)]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Resource:Editor-Plugins|Extensões para o editor]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Resource:Editor#FAQ|Perguntas frequentes (FAQ)]]<br />
</div><br />
<div style="border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;"><br />
<div style="float:right; width: 32px;">[[File:Package-x-generic.png|link=]]</div><br />
<h3>Banco de dados</h3><br />
Aqui tem tudo relacionado às vantagens que Lua tem a oferecer ao MTA e seus recursos.<br />
* [[Image:iUS.png|Em Inglês|20px]] [[:Category:Resource|Catálogo de Recursos]] - Você deve aprender com eles para fazer scripts bons<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Scripts_do_Cliente|Scripts do Cliente]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Módulos|Módulos]]<br />
</div><br />
<br />
<div style="border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;"><br />
<div style="float:right; width: 32px;">[[File:Applications-development.png|link=]]</div><br />
<h3>Desenvolvimento do Multi Theft Auto</h3><br />
[[File:Go-down.png|link=http://nightly.mtasa.com/]] [http://nightly.mtasa.com/ Últimas compilações]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Compilando_o_MTASA|Compilando o MTASA no Windows]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Compilando_o_MTASA_no_Mac_OS_X|Compilando o MTASA no Mac OS X]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Compilando_o_MTASA_no_Linux|Compilando o MTASA no Linux]]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Guia_do_Desenvolvedor|Guia do Desenvolvedor]]<br />
* [[File:iUS.png|Em Inglês|20px]] [https://github.com/multitheftauto/mtasa-blue Repositório Github]<br />
* [[Image:iBR.png|Em Português|20px]] [[PT-BR/Roadmap|Roteiro para versões futuras]]<br />
* [[File:iUS.png|Em Inglês|20px]] [http://bugs.mtasa.com/ Central de bugs]<br />
* [[File:iUS.png|En Inglês|20px]] [[Branches|Ramos]]<br />
</div><br />
<br />
<div style="border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;"><br />
<div style="float:right; width: 32px;">[[File:Applications-office.png|link=]]</div><br />
<h3>Como você pode nos ajudar</h3><br />
* Documentar funções ou eventos<br />
* Criar exemplos funcionais e eficientes de funções e eventos<br />
* Examinar e corrigir as páginas<br />
* Escrever tutoriais para ajudar novatos<br />
* Ajudar a traduzir as páginas da Wiki para outras linguagens<br />
</div><br />
<br />
<div style="border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;"><br />
<div style="float:right; width: 32px;">[[File:Internet-group-chat.png|link=]]</div><br />
<h3>Comunidade</h3><br />
* [[File:iUS.png|Em Inglês|20px]] [http://forum.multitheftauto.com/ Fóruns]<br />
** [[File:iBR.png|Em Português|20px]] [http://forum.multitheftauto.com/forum/97-portuguese-português/ Seção em Português]<br />
* [[File:iUS.png|Em Inglês|20px]] [https://discord.com/invite/mtasa Discord]<br />
* [[File:iUS.png|Em Inglês|20px]] [irc://irc.multitheftauto.com/mta IRC]<br />
* [[File:iUS.png|Em Inglês|20px]] [http://community.mtasa.com/ Comunidade]<br />
* [[File:iUS.png|Em Inglês|20px]] [http://twitter.com/#!/MTAQA/ Twitter] <br />
* [[File:iUS.png|Em Inglês|20px]] [http://www.youtube.com/user/MTAQA Youtube]<br />
* [[File:iUS.png|Em Inglês|20px]] [http://plus.google.com/102014133442331779727/ Google]<br />
* [[File:iUS.png|Em Inglês|20px]] [http://www.moddb.com/mods/multi-theft-auto-san-andreas ModDB]<br />
</div><br />
<br />
<div style="border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;"><br />
<div style="float:right; width: 32px;">[[File:Star.png]]</div><br />
<h3>Extra</h3><br />
* [[Special:PrefixIndex/PT-BR|Lista de páginas em Português]]<br />
</div><br />
<br />
| width="50%" style="vertical-align:top;" |<br />
<br />
<div style="border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;"><br />
<div style="float:right; width: 32px;">[[File:Accessories-text-editor.png|link=]]</div><br />
<h3>Scripting</h3><br />
* [[File:iBR.png|Em Português|20px]] [[PT-BR/Introdução_ao_Scripting|Introdução a ''scripting'']]<br />
* [[File:iBR.png|Em Português|20px]] [[PT-BR/Introducao_ao_GUI_scripting|Introdução a ''scripting'' de UI]]<br />
* [[File:iBR.png|Em Português|20px]] [[Depuração|Depuração]] - Encontre erros em seu Script<br />
* [[File:iBR.png|Em Português|20px]] [[PT-BR/Recursos|Introdução a recursos]]<br />
** [[File:iBR.png|Em Português|20px]] [[Acesso web via recursos|Acesso web via recursos]] - Abra servidores web através de recursos<br />
** [[File:iBR.png|Em Português|20px]] [[PT-BR/Tutorial_CEF|Tutorial CEF]] - Como usar o navegador web em seus recursos<br />
** [[File:iBR.png|Em Português|20px]] [[:Category:PT-BR/Recursos|Lista de recursos]]<br />
** [[File:iBR.png|Em Português|20px]] [[O arquivo Meta|Meta.xml]] - Todo recurso possui um arquivo meta descrevendo a si próprio<br />
** [[File:iBR.png|Em Português|20px]] [[Lista de Controle de Acesso|Lista de controle de acesso (ACL)]] - Componente vital para recursos complexos<br />
* [[File:iBR.png|Em Português|20px]] [[PT-BR/Composição_de_Gamemodes|Composição de modos de jogo]]<br />
<h3>Links dos fóruns</h3><br />
* [[File:iBR.png|Em Português|20px]] [http://forum.mtasa.com/viewforum.php?f=152 Secção do fórum para dúvidas sobre ''scripting'']<br />
* [[File:iUS.png|Em Inglês|20px]] [http://forum.mtasa.com/viewforum.php?f=148 Guias de ''scripting'']<br />
* [[File:iUS.png|Em Inglês|20px]] [http://forum.mtasa.com/viewtopic.php?f=13&t=29363 Wiki ''offline'']<br />
<div style="float:right; width: 32px;">[[File:start-here.png|link=]]</div><br />
<h3>Manuais sobre Lua</h3><br />
Página muito útil para ajuda-lo a entender o funcionamento do Lua<br />
* [[Image:iBR.png|Em Português|20px]] [http://www.lua.org/portugues.html Introdução à linguagem]<br />
* [[File:iUS.png|Em Inglês|20px]] [http://nixstaller.sourceforge.net/manual/0.5.1/nixstaller_10.html Manual básico]<br />
* [[Image:iBR.png|Em Português|20px]] [http://www.lua.org/manual/5.1/pt/ Manual de referência]<br />
* [[File:iUS.png|Em Inglês|20px]] [http://lua-users.org/wiki/TutorialDirectory Outra wiki, somente de Lua]<br />
</div><br />
<br />
<div style="border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px; background:#F2F2FF;"><br />
<div style="float:right; width: 32px;">[[File:Preferences-system.png|link=]]</div><br />
<h3>Referência</h3><br />
* [[File:iBR.png|Em Português|20px]] [[PT-BR/Funções_de_Scripting_do_Cliente|Funções de Scripting do Cliente]]<br />
* [[File:iUS.png|Em Inglês|20px]] [[Client Scripting Events|Eventos do cliente]]<br />
* [[File:iBR.png|Em Português|20px]] [[PT-BR/Funções_de_Scripting_do_Servidor|Funções de Scripting do Servidor]]<br />
* [[File:iBR.png|Em Português|20px]] [[PT-BR/Eventos_de_Scripting_do_Servidor|Eventos de Scripting do Servidor]]<br />
* [[File:iUS.png|Em Inglês|20px]] [[PT-BR/Funções_Úteis|Funções Úteis]]<br />
<!-- Incomplete * [[Module functions|Server-side external module scripting functions list]] --><br />
* [[File:iUS.png|Em Inglês|20px]] [[MTA Classes|Classes do Multi Theft Auto]] - Informações detalhadas sobre todas as classes do MTA<br />
** [[File:iBR.png|Em Inglês|20px]] [[PT-BR/Elemento|Elementos do MTA]] / [[PT-BR/Árvore de elementos|Árvore de elementos]]<br />
</div><br />
<div style="border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;"><br />
<div style="float:right; width: 32px;">[[File:System-file-manager.png|link=]]</div><br />
<h3>[[Id|Lista de IDs de objetos e texturas]]</h3><br />
*[[Animations|Animações]]<br />
*[[Character Skins|''Skins'' de pedestres]]<br />
*[[Roupas do CJ|Roupas do CJ]]<br />
*[[Garage|Garagens]]<br />
*[[Interior IDs|Interiores]]<br />
*[[Material IDs|Materiais]]<br />
*[[Projectiles|Projéteis]]<br />
*[[Radar Blips|''Blips'']]<br />
*[[Sounds|Efeitos sonoros]]<br />
*[[Vehicle IDs|Veículos]]<br />
*[[Vehicle Colors|Cores dos veículos]]<br />
*[[Vehicle Upgrades|Acessórios dos veículos]]<br />
*[[Vehicle variants|Variantes dos veículos]]<br />
*[[Weapons|Armas]]<br />
*[[Weather|Ambientação]]<br />
</div><br />
<br />
<div style="border: 1px dotted #D8D8D8; padding:4px 8px 8px 8px; margin:10px;"><br />
<div style="float:right; width: 32px;">[[File:pBR.png|32px]]</div><br />
<br />
<h3>Sobre a Tradução</h3><br />
* Tradutores:<br />
** [https://forum.mtasa.com/profile/19686-racextreme/|<span style="color: blue">RaceXtreme</span>]<br />
** [https://forum.mtasa.com/profile/27827-stanley-sathler/|<span style="color: blue">StanleySathler</span>]<br />
** [https://forum.mtasa.com/profile/24588-dnl291/|<span style="color: blue">DNL291</span>]<br />
** [https://forum.mtasa.com/profile/30695-ymassai/|<span style="color: blue">Ninguem</span>]<br />
** [https://forum.mtasa.com/profile/31772-anderl/|<span style="color:blue">Anderl</span>]<br />
** [https://forum.mtasa.com/profile/71215-kronos-lettify|<span style="color:blue">KronoS Lettify</span>]<br />
** [https://forum.mtasa.com/profile/69598-eficiencia/|<span style="color:blue">Eficiencia</span>]<br />
** [https://forum.mtasa.com/profile/74654-hiroshi/|<span style="color:blue">HiroShi</span>]<br />
** [https://forum.mtasa.com/profile/63099-vampire/|<span style="color:blue">Vampire</span>]<br />
<br />
<br />
É importante que todos colaborem para que nossa página em português fique melhor a cada dia!<br />
<br />
[[File:Osi symbol.png|75px|link=http://opensource.org/]]<br />
'''Multi Theft Auto''' é um projeto '''open source'''. <br><br />
</div><br />
|-<br />
| colspan="2" |<br />
|}<br />
{| width="100%" cellspacing="0" cellpadding="0"<br />
| colspan="2" |<br />
<div style="padding-left: 15px; padding-right: 15px;" class="plainlinks"><br />
[[File:MTALogo_8ball.png|left|85px|link=Archive]]<br />
<ul style="list-style: none; width: 200px; float: left;"><br />
<li>'''Sobre o Multi Theft Auto'''</li><br />
<li>[[Archive|Arquivos]]</li><br />
<li>[[Press Coverage|Eventos]]</li><br />
<li>[http://code.google.com/p/mtasa-blue/people/list Desenvolvedores]</li><br />
</ul><br />
<ul style="list-style: none; width: 200px; float: left;"><br />
<li>'''Multi Theft Auto 0.5'''</li><br />
<li>[[Archive#Multi_Theft_Auto_0.5|Baixe-o]]</li><br />
<li>[[MTA 0.5r2 Known Issues|Solução de problemas]]</li><br />
</ul><br />
<ul style="list-style: none; width: 200px; float: left;"><br />
<li>'''Status da Wiki'''</li><br />
<li>{{NUMBEROFARTICLES}} artigos</li><br />
<li>{{NUMBEROFPAGES}} páginas</li><br />
<li>{{NUMBEROFUSERS}} usuários registrados</li><br />
</ul><br />
</div><br />
|}<br />
<br />
__NOTOC__<br />
__NOEDITSECTION__<br />
{{Languages list|pt-br}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/setSoundMinDistance&diff=76747PT-BR/setSoundMinDistance2023-04-25T20:00:30Z<p>LordHenry: Correções de ortografia.</p>
<hr />
<div>__NOTOC__ <br />
{{PT-BR/Client_function}}<br />
Define a distância mínima na qual um [[sound|áudio]] para de ficar mais alto.<br />
<br />
==Sintaxe== <br />
<syntaxhighlight lang="lua">bool setSoundMinDistance ( element audio, int distancia )</syntaxhighlight> <br />
<br />
{{BR/OOP||[[sound|audio]]:setMinDistance|minDistance|getSoundMinDistance}}<br />
<br />
===Argumentos necessários=== <br />
*'''audio:''' um elemento de [[sound|áudio]].<br />
*'''distancia:''' um [[int]] representando a distância no qual o [[sound|áudio]] para de ficar mais alto. O valor padrão é 5.<br />
<br />
===Retorno===<br />
Retorna ''true'' se a distância mínima foi definida com sucesso, do contrário retorna ''false''.<br />
<br />
==Exemplo== <br />
Este exemplo cria um áudio 3D e adiciona um comando para alterar sua distância mínima.<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
local audio = playSound3D("audio.mp3", 373.14, -125.21, 1001, true)<br />
<br />
function definiDistanciaMin(comando, distancia)<br />
setSoundMinDistance(audio, tonumber(distancia)) -- Define a distância mínima para o valor digitado no 2º parâmetro do commandHandler ('distancia')<br />
end<br />
addCommandHandler("distanciamin", definiDistanciaMin)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{PT-BR/Funcoes_audio_client}}<br />
<br />
[[EN:setSoundMinDistance]]<br />
[[HU:setSoundMinDistance]]<br />
[[AR:setSoundMinDistance]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/setSoundMaxDistance&diff=76746PT-BR/setSoundMaxDistance2023-04-25T19:56:03Z<p>LordHenry: Correções de ortografia.</p>
<hr />
<div>__NOTOC__ <br />
{{PT-BR/Client_function}}<br />
Essa função define a distância máxima em que um [[sound|áudio]] pode ser ouvido.<br />
<br />
==Sintaxe== <br />
<syntaxhighlight lang="lua">bool setSoundMaxDistance ( element audio, int distancia )</syntaxhighlight> <br />
<br />
{{BR/OOP||[[sound|audio]]:setMaxDistance|maxDistance|getSoundMaxDistance}}<br />
<br />
===Argumentos necessários=== <br />
*'''audio:''' o elemento de [[sound|áudio]].<br />
*'''distancia:''' a distância máxima. O valor padrão é 20.<br />
<br />
===Retorno===<br />
Retorna ''true'' se a distância máxima foi alterada com sucesso, do contrário retorna ''false''.<br />
<br />
==Exemplo== <br />
Esse exemplo cria um áudio no mundo e te permite mudar sua distância máxima usando o comando '/distancia <int>'<br />
<section name="Cliente" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
local audio = playSound3D("audio.mp3", 373.14, -125.21, 1001, true)<br />
<br />
function definiDistanciaMax(comando, distancia)<br />
setSoundMaxDistance(audio, tonumber(distancia)) -- Define a distância máxima para o valor digitado no 2º parâmetro do commandHandler ('distancia')<br />
end<br />
addCommandHandler("distancia", definiDistanciaMax)<br />
</syntaxhighlight><br />
</section><br />
<br />
==Veja também==<br />
{{PT-BR/Funcoes_audio_client}}<br />
<br />
[[en:setSoundMaxDistance]]<br />
[[hu:setSoundMaxDistance]]<br />
[[ar:setSoundMaxDistance]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=76389Template:Useful Functions2023-04-04T01:16:29Z<p>LordHenry: /* Data functions */</p>
<hr />
<div>__NOTOC__<br />
=== Table functions ===<br />
*[[addTableChangeHandler]] <span style="color:gray; font-size:smaller;">» This function monitors the changes of a table.</span><br />
*[[getTableFromSql]] <span style="color:gray; font-size:smaller;">» This functionality is used to obtain saved tables using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql ]).</span><br />
*[[isValueInTable]] <span style="color:gray; font-size:smaller;">» This function returns true if the value exists in the table, false if the value does not exist in the table.</span><br />
*[[pairsByKeys]] <span style="color:gray; font-size:smaller;">» This function sort pairs table.</span><br />
*[[rangeToTable]] <span style="color:gray; font-size:smaller;">» This function converts a string range to a table containing number values.</span><br />
*[[setTableProtected]] <span style="color:gray; font-size:smaller;">» This function protects a table and makes it read-only.</span><br />
*[[setTableToSql]] <span style="color:gray; font-size:smaller;">» This function is used to save the table in the database (sql).</span><br />
*[[Sort_Functions]] <span style="color:gray; font-size:smaller;">» These functions are able to sort your tables by a key.</span><br />
*[[table.compare]] <span style="color:gray; font-size:smaller;">» This function checks whether two given tables are equal.</span><br />
*[[table.copy]] <span style="color:gray; font-size:smaller;">» This function copies a whole table and all the tables in that table.</span><br />
*[[table.deepmerge]] <span style="color:gray; font-size:smaller;">» This function deep merges two tables. Every nested table will be correspondingly merged.</span><br />
*[[table.element]] <span style="color:gray; font-size:smaller;">» This function returns a new table with only userdata content.</span><br />
*[[table.empty]] <span style="color:gray; font-size:smaller;">» This function checks whether a table is empty.</span><br />
*[[table.fromString]] <span style="color:gray; font-size:smaller;">» This function converts string to a table.</span><br />
*[[table.getRandomRows]] <span style="color:gray; font-size:smaller;">» This function returns random rows from table.</span><br />
*[[table.map]] <span style="color:gray; font-size:smaller;">» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.</span><br />
*[[table.merge]] <span style="color:gray; font-size:smaller;">» This function merges two or more tables together.</span><br />
*[[table.random]] <span style="color:gray; font-size:smaller;">» This function retrieves a random value from a table.</span><br />
*[[table.removeValue]] <span style="color:gray; font-size:smaller;">» This function removes a specified value from a table.</span><br />
*[[table.size]] <span style="color:gray; font-size:smaller;">» This function returns the absolute size of a table.</span><br />
*[[table.toString]] <span style="color:gray; font-size:smaller;">» This function converts table to a string.</span><br />
<br />
=== ACL functions ===<br />
*[[aclGroupClone]] <span style="color:gray; font-size:smaller;">» This function clone a group to another group with/without ACLs and/or objects.</span><br />
*[[getAccountsRanks]] <span style="color:gray; font-size:smaller;">» This function is used to detect the account name groups and put them in the chat.</span><br />
*[[getPlayerAcls]] <span style="color:gray; font-size:smaller;">» This function returns a table of all ACL groups on a player.</span><br />
*[[getPlayersInACLGroup]] <span style="color:gray; font-size:smaller;">» This function returns all players in an ACL group.</span><br />
*[[isPlayerInACL]] <span style="color:gray; font-size:smaller;">» This function checks if a player element is in an ACL group.</span><br />
*[[renameAclGroup]] <span style="color:gray; font-size:smaller;">» This function gives an existing ACL group a new name.</span><br />
<br />
=== Account functions ===<br />
*[[getPlayerFromAccountName]] <span style="color:gray; font-size:smaller;">» This function is used to obtain a player by the name of his account.</span><br />
<br />
=== Camera functions ===<br />
*[[smoothMoveCamera]] <span style="color:gray; font-size:smaller;">» This function allows you to create a cinematic camera flight.</span><br />
<br />
=== Colshape functions ===<br />
*[[createGarageColShape]] <span style="color:gray; font-size:smaller;">» This function creates a collision shape from the specified garage.</span><br />
<br />
=== Cursor functions ===<br />
*[[getCursorMovedOn]] <span style="color:gray; font-size:smaller;">» This function checks in which way the cursor is currently moving.</span><br />
<br />
=== Drawing functions ===<br />
*[[dxDrawAnimWindow]] <span style="color:gray; font-size:smaller;">» This function draws an animated 2D window on the screen.</span><br />
*[[dxDrawBorderedRectangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a bordered rectangle.</span><br />
*[[dxDrawBorderedText]] <span style="color:gray; font-size:smaller;">» This is a function that will create a bordered text.</span><br />
*[[dxDrawDashedLine]] <span style="color:gray; font-size:smaller;">» This function draws a line with dashes.</span><br />
*[[dxDrawGifImage]] <span style="color:gray; font-size:smaller;">» This function simulates the effect of a GIF image by using image sprites in 2D.</span><br />
*[[dxDrawImage3D]] <span style="color:gray; font-size:smaller;">» This function draws a 3D image in GTA world.</span><br />
*[[dxDrawImageOnElement]] <span style="color:gray; font-size:smaller;">» This function draws an image on any element.</span><br />
*[[dxDrawLinedRectangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a rectangle outline with dx lines.</span><br />
*[[dxDrawLoading]] <span style="color:gray; font-size:smaller;">» This function draws a loading bar on the screen.</span><br />
*[[dxDrawOctagon3D]] <span style="color:gray; font-size:smaller;">» This function creates a 3D Octagon</span><br />
*[[dxDrawPolygon]] <span style="color:gray; font-size:smaller;">» This function draws a custom polygon on the screen.</span><br />
*[[dxDrawProgressBar]] <span style="color:gray; font-size:smaller;">» This function simulates a progress bar drawed using DirectDraw.</span><br />
*[[dxDrawRectangle3D]] <span style="color:gray; font-size:smaller;">» This function draws a 3D rectangle in GTA world.</span><br />
*[[dxDrawRectangleOnPlayer]] <span style="color:gray; font-size:smaller;">» This function draws a 3D rectangle above the player.</span><br />
*[[dxDrawRing]] <span style="color:gray; font-size:smaller;">» This function draws a ring with dx lines.</span><br />
*[[dxDrawRombo]] <span style="color:gray; font-size:smaller;">» This function creates a Rhombus.</span><br />
*[[dxDrawSprite]] <span style="color:gray; font-size:smaller;">» This function draw a sprite in the 3D world.</span><br />
*[[dxDrawTextOnElement]] <span style="color:gray; font-size:smaller;">» This function draws a text on any element.</span><br />
*[[dxDrawTextOnRectangle]] <span style="color:gray; font-size:smaller;">» Esta funcion crea un rectangle con un texto dentro.</span><br />
*[[dxDrawTriangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a triangle with dx lines.</span><br />
*[[dxGetFontSizeFromHeight]] <span style="color:gray; font-size:smaller;">» This function calculates the font size from given height.</span><br />
*[[dxGetRealFontHeight]] <span style="color:gray; font-size:smaller;">» This function calculates the height of a font.</span><br />
*[[getScreenStartPositionFromBox]] <span style="color:gray; font-size:smaller;">» This function helps with getting the correct position for your dx-effects.</span><br />
*[[wordWrap]] <span style="color:gray; font-size:smaller;">» This function breaks a long string into a table of separate lines limited to a specific length in pixels, for drawing separately.</span><br />
*[[CreateRectangle3D]] <span style="color:gray; font-size:smaller;">» This is a function that will create a 3d rectangle on the player screen.</span><br />
*[[DxDrawBordered3DLine]] <span style="color:gray; font-size:smaller;">»This function creates a bordered area with 3D dx lines.</span><br />
<br />
=== Effects functions ===<br />
*[[attachEffect]] <span style="color:gray; font-size:smaller;">» This function allows you attach an effect to an element.</span><br />
<br />
=== Element functions === <br />
*[[autoAttach]] <span style="color:gray; font-size:smaller;">» This function attaches one element into another at the same position and rotation they are.</span><br />
*[[isElementPlayer]] <span style="color:gray; font-size:smaller;">» This function checks whether the element is a player or not.</span><br />
*[[attachElementToBone]] <span style="color:gray; font-size:smaller;">» This function allows you to attach an element to ped bone accurately using new bone functions.</span><br />
*[[getElementsInDimension]] <span style="color:gray; font-size:smaller;">» This function returns a table of elements that are in the specified dimension.</span><br />
*[[getElementSpeed]] <span style="color:gray; font-size:smaller;">» This function returns the specified element's speed in m/s, km/h or mph.</span><br />
*[[getElementsWithinMarker]] <span style="color:gray; font-size:smaller;">» This function returns a table of elements that are within a marker's collision shape.</span><br />
*[[getElementUsingData]] <span style="color:gray; font-size:smaller;">» This function returns table elements that contains the elements data with the given key and value.</span><br />
*[[getNearestElement]] <span style="color:gray; font-size:smaller;">» This function returns the nearest element (of a specific type) to a player.</span><br />
*[[isElementInPhotograph]] <span style="color:gray; font-size:smaller;">» This function checks if an element is in the player's camera picture area.</span><br />
*[[isElementInRange]] <span style="color:gray; font-size:smaller;">» This function allows you to check if an element's range to a main point is within the maximum range.</span><br />
*[[isElementMoving]]<span style="color:gray; font-size:smaller;">» This function checks if an element is moving.</span><br />
*[[isElementWithinAColShape]]<span style="color:gray; font-size:smaller;">» This function checks if an element is within a collision shape element.</span><br />
*[[isElementInAir]]<span style="color:gray; font-size:smaller;">» This function checks if an element is in air or not.</span><br />
*[[multi_check]] <span style="color:gray; font-size:smaller;">» This function checks one element to many, handy and clean.</span><br />
*[[setElementSpeed]] <span style="color:gray; font-size:smaller;">» This function allows you to set the speed of an element in kph or mph units.</span><br />
*[[getElementDirectionCardialPoint]] <span style="color:gray; font-size:smaller;">» This function returns the direction of the element according to the ''wind rose''.</span><br />
<br />
=== Events ===<br />
*[[onVehicleWeaponFire]] <span style="color:gray; font-size:smaller;">» This code implements an event that is triggered when a player in a vehicle fires a vehicle's weapon.</span><br />
<br />
=== Input functions ===<br />
*[[bindControlKeys]] <span style="color:gray; font-size:smaller;">» This function allows you to bind each key bound to a control individually. Doing this bypasses a little MTA restriction.</span><br />
*[[getBoundControls]] <span style="color:gray; font-size:smaller;">» This function returns a table of control names that are bound to the specified key.</span><br />
*[[unbindControlKeys]] <span style="color:gray; font-size:smaller;">» This function allows you to unbind each key bound to a control individually. Use this function with [[bindControlKeys]].</span><br />
*[[isCommandHandlerAdded]] <span style="color:gray; font-size:smaller;">» This function allows you to check if a command is added or not in the respective resource.</span><br />
<br />
=== Data functions === <br />
*[[byte2human]] <span style="color:gray; font-size:smaller;">» This function converts an integer (number of bytes) into a human-readable unit.</span><br />
*[[capitalize]] <span style="color:gray; font-size:smaller;">» This function capitalizes a given string.</span><br />
*[[convertDate]] <span style="color:gray; font-size:smaller;">» This function converts date to another look.</span><br />
*[[convertServerTickToTimeStamp]] <span style="color:gray; font-size:smaller;">» This function converts server ticks to a unix timestamp.</span><br />
*[[convertTextToSpeech]] <span style="color:gray; font-size:smaller;">» This function converts the provided text to a speech in the provided language which players can hear.</span><br />
*[[findRotation3D]] <span style="color:gray; font-size:smaller;">» This function takes two sets of XYZ coordinates. It returns the 3D direction from point A to point B.</span><br />
*[[findRotation]] <span style="color:gray; font-size:smaller;">» This function takes two points and returns the direction from point A to point B.</span><br />
*[[formatDate]] <span style="color:gray; font-size:smaller;">» This function formats a date on the basis of a format string and returns it.</span><br />
*[[formatNumber]] <span style="color:gray; font-size:smaller;">» This function formats large numbers by adding commas.</span><br />
*[[generateRandomASCIIString]] <span style="color:gray; font-size:smaller;">» This function returns a random string which uses ASCII characters. </span><br />
*[[generateString]] <span style="color:gray; font-size:smaller;">» This function generates a random string with any characters.</span><br />
*[[getAge]] <span style="color:gray; font-size:smaller;">» This function calculates the age of a given birthday.</span><br />
*[[getDistanceBetweenElements]] <span style="color:gray; font-size:smaller;">» Returns the distance between two elements.</span><br />
*[[getDistanceBetweenPointAndSegment2D]] <span style="color:gray; font-size:smaller;">» This function takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.</span><br />
*[[getEasterDate]] <span style="color:gray; font-size:smaller;">» This function returns easter date monthday and month for a given year.</span><br />
*[[getElementRelatedAngle]] <span style="color:gray; font-size:smaller;">» This function returns the related angle between one element to another. This is useful to check which side an element is to another.</span><br />
*[[getFreeDimension]] <span style="color:gray; font-size:smaller;">» This function get free dimension.</span><br />
*[[getKeyFromValueInTable]] <span style="color:gray; font-size:smaller;">» This function returns the key of the specified value in a table.</span><br />
*[[getOffsetFromXYZ]] <span style="color:gray; font-size:smaller;">» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.</span><br />
*[[getPointFromDistanceRotation]] <span style="color:gray; font-size:smaller;">» This function finds a point based on a starting point, direction and distance.</span><br />
*[[getRealMonth]] <span style="color:gray; font-size:smaller;">» This function returns the current month name</span><br />
*[[getRGColorFromPercentage]] <span style="color:gray; font-family:'Georgia', sans-serif; font-size:smaller;">»This function returns two integers representing red and green colors according to the specified percentage.</span><br />
*[[getScreenRotationFromWorldPosition]] <span style="color:gray; font-size:smaller;">» This function returns a screen relative rotation to a world position.</span><br />
*[[getTimestamp]] <span style="color:gray; font-size:smaller;">» This function returns the UNIX timestamp of a specified date and time.</span><br />
*[[gradientString]] <span style="color:gray; font-size:smaller;">» This function transforms a string in a new coloured gradient string.</span><br />
*[[hex2rgb]] <span style="color:gray; font-size:smaller;">» This function convert hex to rgb.</span><br />
*[[hexColorToRGB]] <span style="color:gray; font-size:smaller;">» This function convert hex string/number to RGBA values.</span><br />
*[[isLeapYear]] <span style="color:gray; font-size:smaller;">» This function returns a boolean representing if a given year is a leap year.</span><br />
*[[isValidMail]] <span style="color:gray; font-size:smaller;">» This function checks whether a provided e-mail string is valid.</span><br />
*[[removeHex]] <span style="color:gray; font-size:smaller;">» This function is used to remove hexadecimal numbers (colors, for example) from strings.<br />
*[[RGBToHex]] <span style="color:gray; font-size:smaller;">» This function returns a string representing the color in hexadecimal.</span><br />
*[[RGBToHSV]] <span style="color:gray; font-size:smaller;">» This function convert RGB to HSV color space.</span><br />
*[[RGBToDecimal]] <span style="color:gray; font-size:smaller;">» This function convert RGB to Decimal color.</span><br />
*[[secondsToTimeDesc]] <span style="color:gray; font-size:smaller;">» This function converts a plain seconds-integer into a user-friendly time description.</span><br />
*[[string.count]] <span style="color:gray; font-size:smaller;">» This function counts the amount of occurences of a string in a string.</span><br />
*[[string.explode]] <span style="color:gray; font-size:smaller;">» This function splits a string at a given separator pattern and returns a table with the pieces.</span><br />
*[[string.insert]] <span style="color:gray; font-size:smaller;">» This function inserts a string within another string at a given position.</span><br />
*[[switch]] <span style="color:gray; font-size:smaller;">» This function allows the value of a variable or expression to control the flow of program execution via a multiway branch.</span><br />
*[[tocolor2rgba]] <span style="color:gray; font-size:smaller;">» This function convert tocolor to rgba.</span><br />
*[[toHex]] <span style="color:gray; font-size:smaller;">» This function converts a decimal number to a hexadecimal number, as a fix to be used client-side.</span><br />
*[[var dump]] <span style="color:gray; font-size:smaller;">» This function outputs information about one or more variables using outputConsole.</span><br />
*[[wavelengthToRGBA]] <span style="color:gray; font-size:smaller;">» This function converts a physical wavelength of light to a RGBA color.</span><br />
<br />
=== GUI functions === <br />
*[[centerWindow]] <span style="color:gray; font-size:smaller;">» This function centers a CEGUI window element responsively in any resolution.</span><br />
*[[guiMoveElement]] <span style="color:gray; font-size:smaller;">» This function moves guiElement by/like using moveObject.</span><br />
*[[guiSetStaticImageMovable]] <span style="color:gray; font-size:smaller;">» This function allows you to move a static image like a gui window.</span><br />
*[[isMouseOnGUICloseButton]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether the mouse cursor/pointer is within a gui-window's native close button.</span><br />
*[[isMouseOnGuiElement]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether or not your mouse is over a specific gui element, this is especially useful if the gui element has a parent. </span><br />
=====Comboboxes=====<br />
*[[guiComboBoxAdjustHeight]] <span style="color:gray; font-size:smaller;">» This function adjusts a CEGUI combobox element to have the correct height.</span><br />
<br />
=====Gridlists=====<br />
*[[convertGridListToText]] <span style="color:gray; font-size:smaller;">» This function converts grid list contents to text.</span><br />
*[[getGridListRowIndexFromText]] <span style="color:gray; font-size:smaller;">» This function returns the GridList row index from the specified text.</span><br />
*[[guiGridListAddPlayers]] <span style="color:gray; font-size:smaller;">» This function add all online players to a grid list.</span><br />
*[[guiGridListGetColumnIDFromTitle]] <span style="color:gray; font-size:smaller;">» This function gets a gridlist's column ID from the column title.</span><br />
*[[guiGridListGetSelectedText]] <span style="color:gray; font-size:smaller;">» This function returns a string containing the inner text of a selected gridlist item.</span><br />
*[[guiGridListSetColumnNonSortable]] <span style="color:gray; font-size:smaller;">» This function makes a gridlist column become non-sortable.</span><br />
*[[isTextInGridList]] <span style="color:gray; font-size:smaller;">» This function checks if some text exist or not in the GridList.</span><br />
<br />
=====Labels=====<br />
*[[guiLabelAddEffect]] <span style="color:gray; font-size:smaller;">» This function add an effects to the gui-label like (shadow, outline).</span><br />
<br />
=== Marker functions ===<br />
*[[createMarkerAttachedTo]] <span style="color:gray; font-size:smaller;">» This function creates a marker that is attached to an element.</span><br />
<br />
=== Math functions ===<br />
*[[math.clamp]] <span style="color:gray; font-size:smaller;">» This function returns the number between range of numbers or it's minimum or maximum.</span><br />
*[[math.getBezierPoint]] <span style="color:gray; font-size:smaller;">» Get N-th order bezier point.</span><br />
*[[math.hypot]] <span style="color:gray; font-size:smaller;">» This function returns the Hypotenuse of the triangle given by sides x and y.</span><br />
*[[math.isPointInPolygon]] <span style="color:gray; font-size:smaller;">» Check if point is inside polygon or not.</span><br />
*[[math.lerp]] <span style="color:gray; font-size:smaller;">» Get val between two integer.</span><br />
*[[math.percent]] <span style="color:gray; font-size:smaller;">» This function returns a percentage from two number values.</span><br />
*[[math.polygonArea]] <span style="color:gray; font-size:smaller;">» Compute area of any polygon.</span><br />
*[[math.randomDiff]] <span style="color:gray; font-size:smaller;">» Generates a pseudo-random integer that's always different from the last random number generated.</span><br />
*[[math.rotVecToEulerAngle]] <span style="color:gray; font-size:smaller;">» Rotation Vector To Euler Angle</span><br />
*[[math.round]] <span style="color:gray; font-size:smaller;">» Rounds a number whereas the number of decimals to keep and the method may be set.</span><br />
*[[mathNumber]] <span style="color:gray; font-size:smaller;">» This function is a workaround for the client-side floating-point precision of 24-bits.</span><br />
*[[reMap]] <span style="color:gray; font-size:smaller;">» Re-maps a number from one range to another.</span><br />
*[[Math.percentProgress|math.percentProgress]] <span style="color:gray; font-size:smaller;">» Returns a percentage progress from two specific values.</span><br />
*[[math.average]] <span style="color:gray; font-size:smaller;">» This function returns the simple arithmetic mean of multiple numbers.</span><br />
<br />
=== Map functions ===<br />
*[[assignLod]] <span style="color:gray; font-size:smaller;">» This function lets you conveniently generate and apply a LOD model to a mapping object.</span><br />
*[[getWorldPositionFromMapPosition]] <span style="color:gray; font-size:smaller;">» This function converts an F11 map position to world position.</span><br />
<br />
=== Ped functions ===<br />
*[[getAlivePlayers (Client)|getAlivePlayers]] <span style="color:gray; font-size:smaller;">» This function returns a table of the alive players client-side.</span><br />
*[[getAlivePlayersInTeam]] <span style="color:gray; font-size:smaller;">» This function returns a table of the alive players in a team.</span><br />
*[[getGuestPlayers]] <span style="color:gray; font-size:smaller;">» This function gets a players not login or players Guest .</span><br />
*[[getOnlineAdmins]] <span style="color:gray; font-size:smaller;">» This function returns a table of all logged-in administrators.</span><br />
*[[getPedEyesPosition]] <span style="color:gray; font-size:smaller;">» This function allows you to get peds eyes position.</span><br />
*[[getPedGender]] <span style="color:gray; font-size:smaller;">» This function allows you to get peds their gender.</span><br />
*[[getPedMaxHealth]] <span style="color:gray; font-size:smaller;">» This function returns a pedestrians's maximum health by converting it from their maximum health stat.</span><br />
*[[getPedMaxOxygenLevel]] <span style="color:gray; font-size:smaller;">» This function returns a ped's maximum oxygen level by converting it from their maximum underwater stamina stat.</span><br />
*[[getPedWeaponSkill]] <span style="color:gray; font-size:smaller;">» This function returns a ped's corresponding weapon skill level name.</span><br />
*[[getPedHitBone]] <span style="color:gray; font-size:smaller;">» This function gets the approximate number of the bone where the ped is hit.</span><br />
*[[getPlayerFromNamePart]] <span style="color:gray; font-size:smaller;">» This function returns a player from partial name.</span><br />
*[[getPlayerFromSerial]] <span style="color:gray; font-size:smaller;">» This function returns a player from their serial.</span><br />
*[[getPlayersByData]] <span style="color:gray; font-size:smaller;">» This function returns a table of players that have the specified data name.</span><br />
*[[getPlayersInPhotograph]] <span style="color:gray; font-size:smaller;">» This function returns a table of all players in photograph.</span><br />
*[[getPlayersInVehicles]] <span style="color:gray; font-size:smaller;">» This function returns a table of the players insides vehicles from a specified dimension.</span><br />
*[[isPedAiming]]<span style="color:gray; font-size:smaller;">» This function checks if a pedestrian is aiming their weapon.</span><br />
*[[isPedAimingNearPed]] <span style="color:gray; font-size:smaller;">» This is similar to isPedAiming but uses a colshape to be more precise.</span><br />
*[[isPedDiving]] <span style="color:gray; font-size:smaller;">» This feature checks that pedestrian is diving in the water.</span><br />
*[[isPedDrivingVehicle]] <span style="color:gray; font-size:smaller;">» This function checks if a specified pedestrian is driving a vehicle.</span><br />
*[[isPlayerInTeam]] <span style="color:gray; font-size:smaller;">» This function checks if a player is in a specified team.</span><br />
*[[setPedAttack]] <span style="color:gray; font-size:smaller;">» This function will make a ped attack a specified target.</span><br />
*[[setPedFollow]] <span style="color:gray; font-size:smaller;">» This function will make a ped follow a specified target.</span><br />
*[[getPlayerNameFromID]] <span style="color:gray; font-size:smaller;">» This function will get the player name from the ID element data.</span><br />
<br />
=== Player functions ===<br />
*[[countPlayersInRange]] <span style="color:gray; font-size:smaller;">» This function returns the number of players that are within a certain range of the specified coordinates.</span><br />
*[[getPlayerPreviousAndNextWeapon]] <span style="color:gray; font-size:smaller;">» This function returns the player previous and next weapon.</span><br />
*[[getPlayersInRange]]<span style="color:gray; font-size:smaller;">» This function make a table of players within certain range.</span><br />
*[[isPlayerActuallyInVehicle]]<span style="color:gray; font-size:smaller;">» This function checks if a player is actually in a vehicle instead of just in the process of entering.</span><br />
*[[isPlayerHitByVehicle]]<span style="color:gray; font-size:smaller;">» This function cancels event when a element is hit by a vehicle.</span><br />
*[[warpToPlayer]]<span style="color:gray; font-size:smaller;">» This function make player warp to another player.</span><br />
<br />
=== Resource functions ===<br />
*[[getFilesInResourceFolder]] <span style="color:gray; font-size:smaller;">» This function gets a list of files that are inside a folder of a resource.</span><br />
*[[getResourceScripts]] <span style="color:gray; font-size:smaller;">» This function returns a table of the resource scripts.</span><br />
*[[getResourceSettings]] <span style="color:gray; font-size:smaller;">» This function returns a table of the resource settings.</span><br />
*[[getResourceSize]] <span style="color:gray; font-size:smaller;">» This function returns the size of a specified resource in kB(kilobyte)</span><br />
*[[refreshResource]] <span style="color:gray; font-size:smaller;">» This function refreshes your resource if you changed any of the files<br />
*[[setResourcePriority]] <span style="color:gray; font-size:smaller;">» This function set resource download priority group.</span><br />
<br />
=== Sound functions ===<br />
*[[isSoundFinished]] <span style="color:gray; font-size:smaller;">» This function checks if a sound element has finished.</span><br />
*[[isSoundPlaying]] <span style="color:gray; font-size:smaller;">» This function checks if a sound element is playing or not.</span><br />
*[[stopSoundSlowly]] <span style="color:gray; font-size:smaller;">» This function stop your sound element slowly.</span><br />
<br />
=== Browser functions ===<br />
*[[playVideo]] <span style="color:gray; font-size:smaller;">» This function plays a video on the screen.</span><br />
<br />
=== Team functions ===<br />
*[[getTeamFromColor]] <span style="color:gray; font-size:smaller;">» This function returns a team element by the specified color.</span><br />
*[[getTeamWithFewestPlayers]] <span style="color:gray; font-size:smaller;">» This function returns a team element with least players of all the specified teams.</span><br />
<br />
=== Vehicle functions ===<br />
*[[findEmptyCarSeat]] <span style="color:gray; font-size:smaller;">» This function finds you the first empty seat in a vehicle.</span><br />
*[[getNearestVehicle]] <span style="color:gray; font-size:smaller;">» This function gets the nearest vehicle to the specified player in a specified distance.</span><br />
*[[getRandomVehicle]] <span style="color:gray; font-size:smaller;">» This function gets a random vehicle.</span><br />
*[[getValidVehicleModels]] <span style="color:gray; font-size:smaller;">» This function returns a table of all valid vehicle models.</span><br />
*[[getVehiclesCountByType]] <span style="color:gray; font-size:smaller;">» This function returns the amount of vehicles by the given type as an integer value.</span><br />
*[[getVehicleTurnVelocityCenterOfMass]]<span style="color:gray; font-size:smaller;">» This function gets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
*[[isVehicleDoubleExhaust]] <span style="color:gray; font-size:smaller;">» This function checks is exhaust vehicle double.</span><br />
*[[isVehicleEmpty]] <span style="color:gray; font-size:smaller;">» This function checks whether a vehicle is empty.</span><br />
*[[isVehicleOccupied]] <span style="color:gray; font-size:smaller;">» This function checks if a specified vehicle is occupied.</span><br />
*[[isVehicleOnRoof]] <span style="color:gray; font-size:smaller;">» This function checks whether vehicle is on roof.</span><br />
*[[isVehicleOnFire]] <span style="color:gray; font-size:smaller;">» This function checks if the vehicle is on fire or not.</span><br />
*[[isVehicleReversing]] <span style="color:gray; font-size:smaller;">» This function checks if a specified vehicle is moving backwards.</span><br />
*[[isVehicleUpgraded]] <span style="color:gray; font-size:smaller;">» This function checks is vehicle upgraded by upgrade ID.</span><br />
*[[setVehicleGravityPoint]] <span style="color:gray; font-size:smaller;">» This function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.</span><br />
*[[setVehicleTurnVelocityCenterOfMass]]<span style="color:gray; font-size:smaller;">» This function sets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
*[[setVehicleHandlingFromText]]<span style="color:gray; font-size:smaller;">» This function sets a vehicle's handling from text.</span><br />
<br />
=== Weapon functions === <br />
*[[getJetpackWeaponsEnabled]] <span style="color:gray; font-size:smaller;">» This function returns a table of enabled weapons usable on a jetpack.</span><br />
<br />
=== Object functions ===<br />
*[[getDynamicDoorObjectOpenRatio]] <span style="color:gray; font-size:smaller;">» This function tells you how open a dynamic door is in a range from 0 to 1.</span><br />
*[[isElementObject]] <span style="color:gray; font-size:smaller;">» This function tells you if an element is an object or no.</span><br />
<br />
=== XML functions ===<br />
*[[getXMLNodes]] <span style="color:gray; font-size:smaller;">» This function returns all children of a XML node.</span><br />
<br />
=== Engine functions ===<br />
*[[engineGetCOLsFromLibrary]] <span style="color:gray; font-size:smaller;">» This function gets the collision data from the col library.</span><br />
*[[engineLoadIMGContainer]] <span style="color:gray; font-size:smaller;">» This function loads the IMG container.</span><br />
<br />
=== Utility ===<br />
*[[animate]] <span style="color:gray; font-size:smaller;">» This function allows you to use interpolateBetween without render event and easily used.</span><br />
*[[callClientFunction]] <span style="color:gray; font-size:smaller;">» This function allows you to call any client-side function from the server's side.</span><br />
*[[callServerFunction]] <span style="color:gray; font-size:smaller;">» This function allows you to call any server-side function from the client's side.</span><br />
*[[check]] <span style="color:gray; font-size:smaller;">» This function checks if its arguments are of the right type and calls the error-function if one is not.</span><br />
*[[checkPassiveTimer]] <span style="color:gray; font-size:smaller;">» This function allows you to use passive timers in your conditions. For example you want to prevent players repeatedly using a command.</span><br />
*[[coroutine.resume]] <span style="color:gray; font-size:smaller;">» This function applies a fix for hidden coroutine error messages.</span><br />
*[[compact]] <span style="color:gray; font-size:smaller;">» This function create table containing variables and their values.</span><br />
*[[getBanFromName]] <span style="color:gray; font-size:smaller;">» This functions returns the ban of the given playername.</span><br />
*[[getCurrentFPS]] <span style="color:gray; font-size:smaller;">» This function returns the frames per second at which GTA: SA is running.</span><br />
*[[getSkinNameFromID]] <span style="color:gray; font-size:smaller;">» This function returns the name of the skin from the given id.</span><br />
*[[IfElse]] <span style="color:gray; font-size:smaller;">» This function returns one of two values based on a boolean expression.</span><br />
*[[isCharInString]] <span style="color:gray; font-size:smaller;">» This shared function allows you to check if a char specified is in a string value.</span><br />
*[[isMouseInCircle]] <span style="color:gray; font-size:smaller;">» This function checks if a cursor position is in circular area or not.</span><br />
*[[isMouseInPosition]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether the mouse cursor/pointer is within a rectangular position.</span><br />
*[[iterElements]] <span style="color:gray; font-size:smaller;">» This function returns ''a time-saving'' iterator for your for-loops.</span><br />
*[[PlotTrajectoryAtTime]] <span style="color:gray; font-size:smaller;">» Calculate projectile/water trajectory.</span><br />
*[[preprocessor]] <span style="color:gray; font-size:smaller;">» This function allow you to use gcc macros.</span><br />
*[[vector3:compare]] <span style="color:gray; font-size:smaller;">» This method checks whether two vectors match, with optional precision.</span><br />
*[[svgCreateRoundedRectangle]] <span style="color:gray; font-size:smaller;">» This function creates a rectangle with rounded edges.</span><br />
<br />
<noinclude>[[Category:Useful Functions]]</noinclude></div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=76388Template:Useful Functions2023-04-04T01:13:23Z<p>LordHenry: /* Data functions */</p>
<hr />
<div>__NOTOC__<br />
=== Table functions ===<br />
*[[addTableChangeHandler]] <span style="color:gray; font-size:smaller;">» This function monitors the changes of a table.</span><br />
*[[getTableFromSql]] <span style="color:gray; font-size:smaller;">» This functionality is used to obtain saved tables using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql ]).</span><br />
*[[isValueInTable]] <span style="color:gray; font-size:smaller;">» This function returns true if the value exists in the table, false if the value does not exist in the table.</span><br />
*[[pairsByKeys]] <span style="color:gray; font-size:smaller;">» This function sort pairs table.</span><br />
*[[rangeToTable]] <span style="color:gray; font-size:smaller;">» This function converts a string range to a table containing number values.</span><br />
*[[setTableProtected]] <span style="color:gray; font-size:smaller;">» This function protects a table and makes it read-only.</span><br />
*[[setTableToSql]] <span style="color:gray; font-size:smaller;">» This function is used to save the table in the database (sql).</span><br />
*[[Sort_Functions]] <span style="color:gray; font-size:smaller;">» These functions are able to sort your tables by a key.</span><br />
*[[table.compare]] <span style="color:gray; font-size:smaller;">» This function checks whether two given tables are equal.</span><br />
*[[table.copy]] <span style="color:gray; font-size:smaller;">» This function copies a whole table and all the tables in that table.</span><br />
*[[table.deepmerge]] <span style="color:gray; font-size:smaller;">» This function deep merges two tables. Every nested table will be correspondingly merged.</span><br />
*[[table.element]] <span style="color:gray; font-size:smaller;">» This function returns a new table with only userdata content.</span><br />
*[[table.empty]] <span style="color:gray; font-size:smaller;">» This function checks whether a table is empty.</span><br />
*[[table.fromString]] <span style="color:gray; font-size:smaller;">» This function converts string to a table.</span><br />
*[[table.getRandomRows]] <span style="color:gray; font-size:smaller;">» This function returns random rows from table.</span><br />
*[[table.map]] <span style="color:gray; font-size:smaller;">» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.</span><br />
*[[table.merge]] <span style="color:gray; font-size:smaller;">» This function merges two or more tables together.</span><br />
*[[table.random]] <span style="color:gray; font-size:smaller;">» This function retrieves a random value from a table.</span><br />
*[[table.removeValue]] <span style="color:gray; font-size:smaller;">» This function removes a specified value from a table.</span><br />
*[[table.size]] <span style="color:gray; font-size:smaller;">» This function returns the absolute size of a table.</span><br />
*[[table.toString]] <span style="color:gray; font-size:smaller;">» This function converts table to a string.</span><br />
<br />
=== ACL functions ===<br />
*[[aclGroupClone]] <span style="color:gray; font-size:smaller;">» This function clone a group to another group with/without ACLs and/or objects.</span><br />
*[[getAccountsRanks]] <span style="color:gray; font-size:smaller;">» This function is used to detect the account name groups and put them in the chat.</span><br />
*[[getPlayerAcls]] <span style="color:gray; font-size:smaller;">» This function returns a table of all ACL groups on a player.</span><br />
*[[getPlayersInACLGroup]] <span style="color:gray; font-size:smaller;">» This function returns all players in an ACL group.</span><br />
*[[isPlayerInACL]] <span style="color:gray; font-size:smaller;">» This function checks if a player element is in an ACL group.</span><br />
*[[renameAclGroup]] <span style="color:gray; font-size:smaller;">» This function gives an existing ACL group a new name.</span><br />
<br />
=== Account functions ===<br />
*[[getPlayerFromAccountName]] <span style="color:gray; font-size:smaller;">» This function is used to obtain a player by the name of his account.</span><br />
<br />
=== Camera functions ===<br />
*[[smoothMoveCamera]] <span style="color:gray; font-size:smaller;">» This function allows you to create a cinematic camera flight.</span><br />
<br />
=== Colshape functions ===<br />
*[[createGarageColShape]] <span style="color:gray; font-size:smaller;">» This function creates a collision shape from the specified garage.</span><br />
<br />
=== Cursor functions ===<br />
*[[getCursorMovedOn]] <span style="color:gray; font-size:smaller;">» This function checks in which way the cursor is currently moving.</span><br />
<br />
=== Drawing functions ===<br />
*[[dxDrawAnimWindow]] <span style="color:gray; font-size:smaller;">» This function draws an animated 2D window on the screen.</span><br />
*[[dxDrawBorderedRectangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a bordered rectangle.</span><br />
*[[dxDrawBorderedText]] <span style="color:gray; font-size:smaller;">» This is a function that will create a bordered text.</span><br />
*[[dxDrawDashedLine]] <span style="color:gray; font-size:smaller;">» This function draws a line with dashes.</span><br />
*[[dxDrawGifImage]] <span style="color:gray; font-size:smaller;">» This function simulates the effect of a GIF image by using image sprites in 2D.</span><br />
*[[dxDrawImage3D]] <span style="color:gray; font-size:smaller;">» This function draws a 3D image in GTA world.</span><br />
*[[dxDrawImageOnElement]] <span style="color:gray; font-size:smaller;">» This function draws an image on any element.</span><br />
*[[dxDrawLinedRectangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a rectangle outline with dx lines.</span><br />
*[[dxDrawLoading]] <span style="color:gray; font-size:smaller;">» This function draws a loading bar on the screen.</span><br />
*[[dxDrawOctagon3D]] <span style="color:gray; font-size:smaller;">» This function creates a 3D Octagon</span><br />
*[[dxDrawPolygon]] <span style="color:gray; font-size:smaller;">» This function draws a custom polygon on the screen.</span><br />
*[[dxDrawProgressBar]] <span style="color:gray; font-size:smaller;">» This function simulates a progress bar drawed using DirectDraw.</span><br />
*[[dxDrawRectangle3D]] <span style="color:gray; font-size:smaller;">» This function draws a 3D rectangle in GTA world.</span><br />
*[[dxDrawRectangleOnPlayer]] <span style="color:gray; font-size:smaller;">» This function draws a 3D rectangle above the player.</span><br />
*[[dxDrawRing]] <span style="color:gray; font-size:smaller;">» This function draws a ring with dx lines.</span><br />
*[[dxDrawRombo]] <span style="color:gray; font-size:smaller;">» This function creates a Rhombus.</span><br />
*[[dxDrawSprite]] <span style="color:gray; font-size:smaller;">» This function draw a sprite in the 3D world.</span><br />
*[[dxDrawTextOnElement]] <span style="color:gray; font-size:smaller;">» This function draws a text on any element.</span><br />
*[[dxDrawTextOnRectangle]] <span style="color:gray; font-size:smaller;">» Esta funcion crea un rectangle con un texto dentro.</span><br />
*[[dxDrawTriangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a triangle with dx lines.</span><br />
*[[dxGetFontSizeFromHeight]] <span style="color:gray; font-size:smaller;">» This function calculates the font size from given height.</span><br />
*[[dxGetRealFontHeight]] <span style="color:gray; font-size:smaller;">» This function calculates the height of a font.</span><br />
*[[getScreenStartPositionFromBox]] <span style="color:gray; font-size:smaller;">» This function helps with getting the correct position for your dx-effects.</span><br />
*[[wordWrap]] <span style="color:gray; font-size:smaller;">» This function breaks a long string into a table of separate lines limited to a specific length in pixels, for drawing separately.</span><br />
*[[CreateRectangle3D]] <span style="color:gray; font-size:smaller;">» This is a function that will create a 3d rectangle on the player screen.</span><br />
*[[DxDrawBordered3DLine]] <span style="color:gray; font-size:smaller;">»This function creates a bordered area with 3D dx lines.</span><br />
<br />
=== Effects functions ===<br />
*[[attachEffect]] <span style="color:gray; font-size:smaller;">» This function allows you attach an effect to an element.</span><br />
<br />
=== Element functions === <br />
*[[autoAttach]] <span style="color:gray; font-size:smaller;">» This function attaches one element into another at the same position and rotation they are.</span><br />
*[[isElementPlayer]] <span style="color:gray; font-size:smaller;">» This function checks whether the element is a player or not.</span><br />
*[[attachElementToBone]] <span style="color:gray; font-size:smaller;">» This function allows you to attach an element to ped bone accurately using new bone functions.</span><br />
*[[getElementsInDimension]] <span style="color:gray; font-size:smaller;">» This function returns a table of elements that are in the specified dimension.</span><br />
*[[getElementSpeed]] <span style="color:gray; font-size:smaller;">» This function returns the specified element's speed in m/s, km/h or mph.</span><br />
*[[getElementsWithinMarker]] <span style="color:gray; font-size:smaller;">» This function returns a table of elements that are within a marker's collision shape.</span><br />
*[[getElementUsingData]] <span style="color:gray; font-size:smaller;">» This function returns table elements that contains the elements data with the given key and value.</span><br />
*[[getNearestElement]] <span style="color:gray; font-size:smaller;">» This function returns the nearest element (of a specific type) to a player.</span><br />
*[[isElementInPhotograph]] <span style="color:gray; font-size:smaller;">» This function checks if an element is in the player's camera picture area.</span><br />
*[[isElementInRange]] <span style="color:gray; font-size:smaller;">» This function allows you to check if an element's range to a main point is within the maximum range.</span><br />
*[[isElementMoving]]<span style="color:gray; font-size:smaller;">» This function checks if an element is moving.</span><br />
*[[isElementWithinAColShape]]<span style="color:gray; font-size:smaller;">» This function checks if an element is within a collision shape element.</span><br />
*[[isElementInAir]]<span style="color:gray; font-size:smaller;">» This function checks if an element is in air or not.</span><br />
*[[multi_check]] <span style="color:gray; font-size:smaller;">» This function checks one element to many, handy and clean.</span><br />
*[[setElementSpeed]] <span style="color:gray; font-size:smaller;">» This function allows you to set the speed of an element in kph or mph units.</span><br />
*[[getElementDirectionCardialPoint]] <span style="color:gray; font-size:smaller;">» This function returns the direction of the element according to the ''wind rose''.</span><br />
<br />
=== Events ===<br />
*[[onVehicleWeaponFire]] <span style="color:gray; font-size:smaller;">» This code implements an event that is triggered when a player in a vehicle fires a vehicle's weapon.</span><br />
<br />
=== Input functions ===<br />
*[[bindControlKeys]] <span style="color:gray; font-size:smaller;">» This function allows you to bind each key bound to a control individually. Doing this bypasses a little MTA restriction.</span><br />
*[[getBoundControls]] <span style="color:gray; font-size:smaller;">» This function returns a table of control names that are bound to the specified key.</span><br />
*[[unbindControlKeys]] <span style="color:gray; font-size:smaller;">» This function allows you to unbind each key bound to a control individually. Use this function with [[bindControlKeys]].</span><br />
*[[isCommandHandlerAdded]] <span style="color:gray; font-size:smaller;">» This function allows you to check if a command is added or not in the respective resource.</span><br />
<br />
=== Data functions === <br />
*[[byte2human]] <span style="color:gray; font-size:smaller;">» This function converts an integer (number of bytes) into a human-readable unit.</span><br />
*[[capitalize]] <span style="color:gray; font-size:smaller;">» This function capitalizes a given string.</span><br />
*[[convertDate]] <span style="color:gray; font-size:smaller;">» This function converts date to another look.</span><br />
*[[convertServerTickToTimeStamp]] <span style="color:gray; font-size:smaller;">» This function converts server ticks to a unix timestamp.</span><br />
*[[convertTextToSpeech]] <span style="color:gray; font-size:smaller;">» This function converts the provided text to a speech in the provided language which players can hear.</span><br />
*[[findRotation3D]] <span style="color:gray; font-size:smaller;">» This function takes two sets of XYZ coordinates. It returns the 3D direction from point A to point B.</span><br />
*[[findRotation]] <span style="color:gray; font-size:smaller;">» This function takes two points and returns the direction from point A to point B.</span><br />
*[[formatDate]] <span style="color:gray; font-size:smaller;">» This function formats a date on the basis of a format string and returns it.</span><br />
*[[formatNumber]] <span style="color:gray; font-size:smaller;">» This function formats large numbers by adding commas.</span><br />
*[[generateRandomASCIIString]] <span style="color:gray; font-size:smaller;">» This function returns a random string which uses ASCII characters. </span><br />
*[[generateString]] <span style="color:gray; font-size:smaller;">» This function generates a random string with any characters.</span><br />
*[[getAge]] <span style="color:gray; font-size:smaller;">» This function calculates the age of a given birthday.</span><br />
*[[getDistanceBetweenElements]] <span style="color:gray; font-size:smaller;">» Returns the distance between two elements.</span><br />
*[[getDistanceBetweenPointAndSegment2D]] <span style="color:gray; font-size:smaller;">» This function takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.</span><br />
*[[getEasterDate]] <span style="color:gray; font-size:smaller;">» This function returns easter date monthday and month for a given year.</span><br />
*[[getElementRelatedAngle]] <span style="color:gray; font-size:smaller;">» This function returns the related angle between one element to another.</span><br />
*[[getFreeDimension]] <span style="color:gray; font-size:smaller;">» This function get free dimension.</span><br />
*[[getKeyFromValueInTable]] <span style="color:gray; font-size:smaller;">» This function returns the key of the specified value in a table.</span><br />
*[[getOffsetFromXYZ]] <span style="color:gray; font-size:smaller;">» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.</span><br />
*[[getPointFromDistanceRotation]] <span style="color:gray; font-size:smaller;">» This function finds a point based on a starting point, direction and distance.</span><br />
*[[getRealMonth]] <span style="color:gray; font-size:smaller;">» This function returns the current month name</span><br />
*[[getRGColorFromPercentage]] <span style="color:gray; font-family:'Georgia', sans-serif; font-size:smaller;">»This function returns two integers representing red and green colors according to the specified percentage.</span><br />
*[[getScreenRotationFromWorldPosition]] <span style="color:gray; font-size:smaller;">» This function returns a screen relative rotation to a world position.</span><br />
*[[getTimestamp]] <span style="color:gray; font-size:smaller;">» This function returns the UNIX timestamp of a specified date and time.</span><br />
*[[gradientString]] <span style="color:gray; font-size:smaller;">» This function transforms a string in a new coloured gradient string.</span><br />
*[[hex2rgb]] <span style="color:gray; font-size:smaller;">» This function convert hex to rgb.</span><br />
*[[hexColorToRGB]] <span style="color:gray; font-size:smaller;">» This function convert hex string/number to RGBA values.</span><br />
*[[isLeapYear]] <span style="color:gray; font-size:smaller;">» This function returns a boolean representing if a given year is a leap year.</span><br />
*[[isValidMail]] <span style="color:gray; font-size:smaller;">» This function checks whether a provided e-mail string is valid.</span><br />
*[[removeHex]] <span style="color:gray; font-size:smaller;">» This function is used to remove hexadecimal numbers (colors, for example) from strings.<br />
*[[RGBToHex]] <span style="color:gray; font-size:smaller;">» This function returns a string representing the color in hexadecimal.</span><br />
*[[RGBToHSV]] <span style="color:gray; font-size:smaller;">» This function convert RGB to HSV color space.</span><br />
*[[RGBToDecimal]] <span style="color:gray; font-size:smaller;">» This function convert RGB to Decimal color.</span><br />
*[[secondsToTimeDesc]] <span style="color:gray; font-size:smaller;">» This function converts a plain seconds-integer into a user-friendly time description.</span><br />
*[[string.count]] <span style="color:gray; font-size:smaller;">» This function counts the amount of occurences of a string in a string.</span><br />
*[[string.explode]] <span style="color:gray; font-size:smaller;">» This function splits a string at a given separator pattern and returns a table with the pieces.</span><br />
*[[string.insert]] <span style="color:gray; font-size:smaller;">» This function inserts a string within another string at a given position.</span><br />
*[[switch]] <span style="color:gray; font-size:smaller;">» This function allows the value of a variable or expression to control the flow of program execution via a multiway branch.</span><br />
*[[tocolor2rgba]] <span style="color:gray; font-size:smaller;">» This function convert tocolor to rgba.</span><br />
*[[toHex]] <span style="color:gray; font-size:smaller;">» This function converts a decimal number to a hexadecimal number, as a fix to be used client-side.</span><br />
*[[var dump]] <span style="color:gray; font-size:smaller;">» This function outputs information about one or more variables using outputConsole.</span><br />
*[[wavelengthToRGBA]] <span style="color:gray; font-size:smaller;">» This function converts a physical wavelength of light to a RGBA color.</span><br />
<br />
=== GUI functions === <br />
*[[centerWindow]] <span style="color:gray; font-size:smaller;">» This function centers a CEGUI window element responsively in any resolution.</span><br />
*[[guiMoveElement]] <span style="color:gray; font-size:smaller;">» This function moves guiElement by/like using moveObject.</span><br />
*[[guiSetStaticImageMovable]] <span style="color:gray; font-size:smaller;">» This function allows you to move a static image like a gui window.</span><br />
*[[isMouseOnGUICloseButton]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether the mouse cursor/pointer is within a gui-window's native close button.</span><br />
*[[isMouseOnGuiElement]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether or not your mouse is over a specific gui element, this is especially useful if the gui element has a parent. </span><br />
=====Comboboxes=====<br />
*[[guiComboBoxAdjustHeight]] <span style="color:gray; font-size:smaller;">» This function adjusts a CEGUI combobox element to have the correct height.</span><br />
<br />
=====Gridlists=====<br />
*[[convertGridListToText]] <span style="color:gray; font-size:smaller;">» This function converts grid list contents to text.</span><br />
*[[getGridListRowIndexFromText]] <span style="color:gray; font-size:smaller;">» This function returns the GridList row index from the specified text.</span><br />
*[[guiGridListAddPlayers]] <span style="color:gray; font-size:smaller;">» This function add all online players to a grid list.</span><br />
*[[guiGridListGetColumnIDFromTitle]] <span style="color:gray; font-size:smaller;">» This function gets a gridlist's column ID from the column title.</span><br />
*[[guiGridListGetSelectedText]] <span style="color:gray; font-size:smaller;">» This function returns a string containing the inner text of a selected gridlist item.</span><br />
*[[guiGridListSetColumnNonSortable]] <span style="color:gray; font-size:smaller;">» This function makes a gridlist column become non-sortable.</span><br />
*[[isTextInGridList]] <span style="color:gray; font-size:smaller;">» This function checks if some text exist or not in the GridList.</span><br />
<br />
=====Labels=====<br />
*[[guiLabelAddEffect]] <span style="color:gray; font-size:smaller;">» This function add an effects to the gui-label like (shadow, outline).</span><br />
<br />
=== Marker functions ===<br />
*[[createMarkerAttachedTo]] <span style="color:gray; font-size:smaller;">» This function creates a marker that is attached to an element.</span><br />
<br />
=== Math functions ===<br />
*[[math.clamp]] <span style="color:gray; font-size:smaller;">» This function returns the number between range of numbers or it's minimum or maximum.</span><br />
*[[math.getBezierPoint]] <span style="color:gray; font-size:smaller;">» Get N-th order bezier point.</span><br />
*[[math.hypot]] <span style="color:gray; font-size:smaller;">» This function returns the Hypotenuse of the triangle given by sides x and y.</span><br />
*[[math.isPointInPolygon]] <span style="color:gray; font-size:smaller;">» Check if point is inside polygon or not.</span><br />
*[[math.lerp]] <span style="color:gray; font-size:smaller;">» Get val between two integer.</span><br />
*[[math.percent]] <span style="color:gray; font-size:smaller;">» This function returns a percentage from two number values.</span><br />
*[[math.polygonArea]] <span style="color:gray; font-size:smaller;">» Compute area of any polygon.</span><br />
*[[math.randomDiff]] <span style="color:gray; font-size:smaller;">» Generates a pseudo-random integer that's always different from the last random number generated.</span><br />
*[[math.rotVecToEulerAngle]] <span style="color:gray; font-size:smaller;">» Rotation Vector To Euler Angle</span><br />
*[[math.round]] <span style="color:gray; font-size:smaller;">» Rounds a number whereas the number of decimals to keep and the method may be set.</span><br />
*[[mathNumber]] <span style="color:gray; font-size:smaller;">» This function is a workaround for the client-side floating-point precision of 24-bits.</span><br />
*[[reMap]] <span style="color:gray; font-size:smaller;">» Re-maps a number from one range to another.</span><br />
*[[Math.percentProgress|math.percentProgress]] <span style="color:gray; font-size:smaller;">» Returns a percentage progress from two specific values.</span><br />
*[[math.average]] <span style="color:gray; font-size:smaller;">» This function returns the simple arithmetic mean of multiple numbers.</span><br />
<br />
=== Map functions ===<br />
*[[assignLod]] <span style="color:gray; font-size:smaller;">» This function lets you conveniently generate and apply a LOD model to a mapping object.</span><br />
*[[getWorldPositionFromMapPosition]] <span style="color:gray; font-size:smaller;">» This function converts an F11 map position to world position.</span><br />
<br />
=== Ped functions ===<br />
*[[getAlivePlayers (Client)|getAlivePlayers]] <span style="color:gray; font-size:smaller;">» This function returns a table of the alive players client-side.</span><br />
*[[getAlivePlayersInTeam]] <span style="color:gray; font-size:smaller;">» This function returns a table of the alive players in a team.</span><br />
*[[getGuestPlayers]] <span style="color:gray; font-size:smaller;">» This function gets a players not login or players Guest .</span><br />
*[[getOnlineAdmins]] <span style="color:gray; font-size:smaller;">» This function returns a table of all logged-in administrators.</span><br />
*[[getPedEyesPosition]] <span style="color:gray; font-size:smaller;">» This function allows you to get peds eyes position.</span><br />
*[[getPedGender]] <span style="color:gray; font-size:smaller;">» This function allows you to get peds their gender.</span><br />
*[[getPedMaxHealth]] <span style="color:gray; font-size:smaller;">» This function returns a pedestrians's maximum health by converting it from their maximum health stat.</span><br />
*[[getPedMaxOxygenLevel]] <span style="color:gray; font-size:smaller;">» This function returns a ped's maximum oxygen level by converting it from their maximum underwater stamina stat.</span><br />
*[[getPedWeaponSkill]] <span style="color:gray; font-size:smaller;">» This function returns a ped's corresponding weapon skill level name.</span><br />
*[[getPedHitBone]] <span style="color:gray; font-size:smaller;">» This function gets the approximate number of the bone where the ped is hit.</span><br />
*[[getPlayerFromNamePart]] <span style="color:gray; font-size:smaller;">» This function returns a player from partial name.</span><br />
*[[getPlayerFromSerial]] <span style="color:gray; font-size:smaller;">» This function returns a player from their serial.</span><br />
*[[getPlayersByData]] <span style="color:gray; font-size:smaller;">» This function returns a table of players that have the specified data name.</span><br />
*[[getPlayersInPhotograph]] <span style="color:gray; font-size:smaller;">» This function returns a table of all players in photograph.</span><br />
*[[getPlayersInVehicles]] <span style="color:gray; font-size:smaller;">» This function returns a table of the players insides vehicles from a specified dimension.</span><br />
*[[isPedAiming]]<span style="color:gray; font-size:smaller;">» This function checks if a pedestrian is aiming their weapon.</span><br />
*[[isPedAimingNearPed]] <span style="color:gray; font-size:smaller;">» This is similar to isPedAiming but uses a colshape to be more precise.</span><br />
*[[isPedDiving]] <span style="color:gray; font-size:smaller;">» This feature checks that pedestrian is diving in the water.</span><br />
*[[isPedDrivingVehicle]] <span style="color:gray; font-size:smaller;">» This function checks if a specified pedestrian is driving a vehicle.</span><br />
*[[isPlayerInTeam]] <span style="color:gray; font-size:smaller;">» This function checks if a player is in a specified team.</span><br />
*[[setPedAttack]] <span style="color:gray; font-size:smaller;">» This function will make a ped attack a specified target.</span><br />
*[[setPedFollow]] <span style="color:gray; font-size:smaller;">» This function will make a ped follow a specified target.</span><br />
*[[getPlayerNameFromID]] <span style="color:gray; font-size:smaller;">» This function will get the player name from the ID element data.</span><br />
<br />
=== Player functions ===<br />
*[[countPlayersInRange]] <span style="color:gray; font-size:smaller;">» This function returns the number of players that are within a certain range of the specified coordinates.</span><br />
*[[getPlayerPreviousAndNextWeapon]] <span style="color:gray; font-size:smaller;">» This function returns the player previous and next weapon.</span><br />
*[[getPlayersInRange]]<span style="color:gray; font-size:smaller;">» This function make a table of players within certain range.</span><br />
*[[isPlayerActuallyInVehicle]]<span style="color:gray; font-size:smaller;">» This function checks if a player is actually in a vehicle instead of just in the process of entering.</span><br />
*[[isPlayerHitByVehicle]]<span style="color:gray; font-size:smaller;">» This function cancels event when a element is hit by a vehicle.</span><br />
*[[warpToPlayer]]<span style="color:gray; font-size:smaller;">» This function make player warp to another player.</span><br />
<br />
=== Resource functions ===<br />
*[[getFilesInResourceFolder]] <span style="color:gray; font-size:smaller;">» This function gets a list of files that are inside a folder of a resource.</span><br />
*[[getResourceScripts]] <span style="color:gray; font-size:smaller;">» This function returns a table of the resource scripts.</span><br />
*[[getResourceSettings]] <span style="color:gray; font-size:smaller;">» This function returns a table of the resource settings.</span><br />
*[[getResourceSize]] <span style="color:gray; font-size:smaller;">» This function returns the size of a specified resource in kB(kilobyte)</span><br />
*[[refreshResource]] <span style="color:gray; font-size:smaller;">» This function refreshes your resource if you changed any of the files<br />
*[[setResourcePriority]] <span style="color:gray; font-size:smaller;">» This function set resource download priority group.</span><br />
<br />
=== Sound functions ===<br />
*[[isSoundFinished]] <span style="color:gray; font-size:smaller;">» This function checks if a sound element has finished.</span><br />
*[[isSoundPlaying]] <span style="color:gray; font-size:smaller;">» This function checks if a sound element is playing or not.</span><br />
*[[stopSoundSlowly]] <span style="color:gray; font-size:smaller;">» This function stop your sound element slowly.</span><br />
<br />
=== Browser functions ===<br />
*[[playVideo]] <span style="color:gray; font-size:smaller;">» This function plays a video on the screen.</span><br />
<br />
=== Team functions ===<br />
*[[getTeamFromColor]] <span style="color:gray; font-size:smaller;">» This function returns a team element by the specified color.</span><br />
*[[getTeamWithFewestPlayers]] <span style="color:gray; font-size:smaller;">» This function returns a team element with least players of all the specified teams.</span><br />
<br />
=== Vehicle functions ===<br />
*[[findEmptyCarSeat]] <span style="color:gray; font-size:smaller;">» This function finds you the first empty seat in a vehicle.</span><br />
*[[getNearestVehicle]] <span style="color:gray; font-size:smaller;">» This function gets the nearest vehicle to the specified player in a specified distance.</span><br />
*[[getRandomVehicle]] <span style="color:gray; font-size:smaller;">» This function gets a random vehicle.</span><br />
*[[getValidVehicleModels]] <span style="color:gray; font-size:smaller;">» This function returns a table of all valid vehicle models.</span><br />
*[[getVehiclesCountByType]] <span style="color:gray; font-size:smaller;">» This function returns the amount of vehicles by the given type as an integer value.</span><br />
*[[getVehicleTurnVelocityCenterOfMass]]<span style="color:gray; font-size:smaller;">» This function gets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
*[[isVehicleDoubleExhaust]] <span style="color:gray; font-size:smaller;">» This function checks is exhaust vehicle double.</span><br />
*[[isVehicleEmpty]] <span style="color:gray; font-size:smaller;">» This function checks whether a vehicle is empty.</span><br />
*[[isVehicleOccupied]] <span style="color:gray; font-size:smaller;">» This function checks if a specified vehicle is occupied.</span><br />
*[[isVehicleOnRoof]] <span style="color:gray; font-size:smaller;">» This function checks whether vehicle is on roof.</span><br />
*[[isVehicleOnFire]] <span style="color:gray; font-size:smaller;">» This function checks if the vehicle is on fire or not.</span><br />
*[[isVehicleReversing]] <span style="color:gray; font-size:smaller;">» This function checks if a specified vehicle is moving backwards.</span><br />
*[[isVehicleUpgraded]] <span style="color:gray; font-size:smaller;">» This function checks is vehicle upgraded by upgrade ID.</span><br />
*[[setVehicleGravityPoint]] <span style="color:gray; font-size:smaller;">» This function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.</span><br />
*[[setVehicleTurnVelocityCenterOfMass]]<span style="color:gray; font-size:smaller;">» This function sets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
*[[setVehicleHandlingFromText]]<span style="color:gray; font-size:smaller;">» This function sets a vehicle's handling from text.</span><br />
<br />
=== Weapon functions === <br />
*[[getJetpackWeaponsEnabled]] <span style="color:gray; font-size:smaller;">» This function returns a table of enabled weapons usable on a jetpack.</span><br />
<br />
=== Object functions ===<br />
*[[getDynamicDoorObjectOpenRatio]] <span style="color:gray; font-size:smaller;">» This function tells you how open a dynamic door is in a range from 0 to 1.</span><br />
*[[isElementObject]] <span style="color:gray; font-size:smaller;">» This function tells you if an element is an object or no.</span><br />
<br />
=== XML functions ===<br />
*[[getXMLNodes]] <span style="color:gray; font-size:smaller;">» This function returns all children of a XML node.</span><br />
<br />
=== Engine functions ===<br />
*[[engineGetCOLsFromLibrary]] <span style="color:gray; font-size:smaller;">» This function gets the collision data from the col library.</span><br />
*[[engineLoadIMGContainer]] <span style="color:gray; font-size:smaller;">» This function loads the IMG container.</span><br />
<br />
=== Utility ===<br />
*[[animate]] <span style="color:gray; font-size:smaller;">» This function allows you to use interpolateBetween without render event and easily used.</span><br />
*[[callClientFunction]] <span style="color:gray; font-size:smaller;">» This function allows you to call any client-side function from the server's side.</span><br />
*[[callServerFunction]] <span style="color:gray; font-size:smaller;">» This function allows you to call any server-side function from the client's side.</span><br />
*[[check]] <span style="color:gray; font-size:smaller;">» This function checks if its arguments are of the right type and calls the error-function if one is not.</span><br />
*[[checkPassiveTimer]] <span style="color:gray; font-size:smaller;">» This function allows you to use passive timers in your conditions. For example you want to prevent players repeatedly using a command.</span><br />
*[[coroutine.resume]] <span style="color:gray; font-size:smaller;">» This function applies a fix for hidden coroutine error messages.</span><br />
*[[compact]] <span style="color:gray; font-size:smaller;">» This function create table containing variables and their values.</span><br />
*[[getBanFromName]] <span style="color:gray; font-size:smaller;">» This functions returns the ban of the given playername.</span><br />
*[[getCurrentFPS]] <span style="color:gray; font-size:smaller;">» This function returns the frames per second at which GTA: SA is running.</span><br />
*[[getSkinNameFromID]] <span style="color:gray; font-size:smaller;">» This function returns the name of the skin from the given id.</span><br />
*[[IfElse]] <span style="color:gray; font-size:smaller;">» This function returns one of two values based on a boolean expression.</span><br />
*[[isCharInString]] <span style="color:gray; font-size:smaller;">» This shared function allows you to check if a char specified is in a string value.</span><br />
*[[isMouseInCircle]] <span style="color:gray; font-size:smaller;">» This function checks if a cursor position is in circular area or not.</span><br />
*[[isMouseInPosition]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether the mouse cursor/pointer is within a rectangular position.</span><br />
*[[iterElements]] <span style="color:gray; font-size:smaller;">» This function returns ''a time-saving'' iterator for your for-loops.</span><br />
*[[PlotTrajectoryAtTime]] <span style="color:gray; font-size:smaller;">» Calculate projectile/water trajectory.</span><br />
*[[preprocessor]] <span style="color:gray; font-size:smaller;">» This function allow you to use gcc macros.</span><br />
*[[vector3:compare]] <span style="color:gray; font-size:smaller;">» This method checks whether two vectors match, with optional precision.</span><br />
*[[svgCreateRoundedRectangle]] <span style="color:gray; font-size:smaller;">» This function creates a rectangle with rounded edges.</span><br />
<br />
<noinclude>[[Category:Useful Functions]]</noinclude></div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=GetElementRelatedAngle&diff=76387GetElementRelatedAngle2023-04-04T01:09:42Z<p>LordHenry: /* Syntax */</p>
<hr />
<div>__NOTOC__<br />
{{Useful Function}}<br />
This function returns the related angle between one [[Element|element]] to another. This is useful to check if a player is on the left side of a vehicle, for example.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">float getElementRelatedAngle (element thisElement, element targetElement)</syntaxhighlight><br />
===Required Arguments===<br />
* '''thisElement''': The element whose '''XY position''' will be checked to obtain the angle relative to the other element.<br />
* '''targetElement''': The element whose '''XY position''' and '''Z rotation''' will be checked to obtain the angle relative to the other element.<br />
<br />
===Returns===<br />
Returns a float indicating the related angle between the first element and the second. It returns ''false'' if invalid parameters are provided.<br />
<br />
==Code==<br />
<section name="Server/Client-side script" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function getElementRelatedAngle (thisElement, targetElement)<br />
if isElement(thisElement) and isElement(targetElement) then<br />
local pointX, pointY = getElementPosition(thisElement)<br />
local x, y = getElementPosition(targetElement)<br />
local _, _, rz = getElementRotation(targetElement)<br />
local anglePointToElement = math.atan2(pointX - x, pointY - y)<br />
local formattedAnglePointToElement = math.deg(anglePointToElement)<br />
local elementRelatedPosition = formattedAnglePointToElement + rz<br />
<br />
-- Valid angles must be from 0 to 359.9999999999<br />
if (elementRelatedPosition < 0) then<br />
elementRelatedPosition = elementRelatedPosition + 360 -- Sets any negative angle to valid angle.<br />
elseif (elementRelatedPosition >= 360) then<br />
elementRelatedPosition = elementRelatedPosition - 360 -- Sets any angle higher than 360 to valid angle. 360 becomes 0.<br />
end<br />
<br />
return elementRelatedPosition<br />
else<br />
return false<br />
end<br />
end<br />
</syntaxhighlight></section><br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This example allows the player to press ''H'' near a vehicle to open its door according to the vehicle related angle. If the player is on the front of the vehicle, it opens the hood, if the player is on the back of the vehicle, it opens the trunk and so on.<br />
<syntaxhighlight lang="lua"><br />
function getNearestElement(thePlayer, elementType) -- Useful function (simplified version)<br />
local dist = 20 -- Only gets elements nearer than this distance.<br />
local x, y, z = getElementPosition(thePlayer)<br />
local nearest = false<br />
for _,veh in pairs(getElementsByType(elementType)) do<br />
local vx, vy, vz = getElementPosition(veh)<br />
local newDist = getDistanceBetweenPoints3D(x, y, z, vx, vy, vz)<br />
if newDist < dist then<br />
dist = newDist<br />
nearest = veh<br />
end<br />
end<br />
return nearest, dist<br />
end<br />
<br />
bindKey("h", "down", function(key, state)<br />
local veh, distance = getNearestElement(localPlayer, "vehicle")<br />
if veh and isElement(veh) then<br />
if distance < 5 then<br />
local angle = getElementRelatedAngle(localPlayer, veh)<br />
local door<br />
if angle >= 340 or angle < 20 then<br />
door = 0<br />
elseif angle >= 20 and angle < 90 then<br />
door = 3<br />
elseif angle >= 90 and angle < 160 then<br />
door = 5<br />
elseif angle >= 160 and angle < 200 then<br />
door = 1<br />
elseif angle >= 200 and angle < 270 then<br />
door = 4<br />
elseif angle >= 270 and angle < 340 then<br />
door = 2<br />
end<br />
if getVehicleDoorOpenRatio (veh, door) > 0 then<br />
setVehicleDoorOpenRatio (veh, door, 0, 500)<br />
else<br />
setVehicleDoorOpenRatio (veh, door, 1, 500)<br />
end<br />
end<br />
end<br />
end)<br />
</syntaxhighlight><br />
</section><br />
Author: [[User:LordHenry|LordHenry]]<br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=GetElementRelatedAngle&diff=76386GetElementRelatedAngle2023-04-04T01:09:15Z<p>LordHenry: Created page with "__NOTOC__ {{Useful Function}} This function returns the related angle between one element to another. This is useful to check if a player is on the left side of a vehicle, for example. ==Syntax== <syntaxhighlight lang="lua">float, float getElementRelatedAngle (element thisElement, element targetElement)</syntaxhighlight> ===Required Arguments=== * '''thisElement''': The element whose '''XY position''' will be checked to obtain the angle relative to the other..."</p>
<hr />
<div>__NOTOC__<br />
{{Useful Function}}<br />
This function returns the related angle between one [[Element|element]] to another. This is useful to check if a player is on the left side of a vehicle, for example.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">float, float getElementRelatedAngle (element thisElement, element targetElement)</syntaxhighlight><br />
===Required Arguments===<br />
* '''thisElement''': The element whose '''XY position''' will be checked to obtain the angle relative to the other element.<br />
* '''targetElement''': The element whose '''XY position''' and '''Z rotation''' will be checked to obtain the angle relative to the other element.<br />
<br />
===Returns===<br />
Returns a float indicating the related angle between the first element and the second. It returns ''false'' if invalid parameters are provided.<br />
<br />
==Code==<br />
<section name="Server/Client-side script" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function getElementRelatedAngle (thisElement, targetElement)<br />
if isElement(thisElement) and isElement(targetElement) then<br />
local pointX, pointY = getElementPosition(thisElement)<br />
local x, y = getElementPosition(targetElement)<br />
local _, _, rz = getElementRotation(targetElement)<br />
local anglePointToElement = math.atan2(pointX - x, pointY - y)<br />
local formattedAnglePointToElement = math.deg(anglePointToElement)<br />
local elementRelatedPosition = formattedAnglePointToElement + rz<br />
<br />
-- Valid angles must be from 0 to 359.9999999999<br />
if (elementRelatedPosition < 0) then<br />
elementRelatedPosition = elementRelatedPosition + 360 -- Sets any negative angle to valid angle.<br />
elseif (elementRelatedPosition >= 360) then<br />
elementRelatedPosition = elementRelatedPosition - 360 -- Sets any angle higher than 360 to valid angle. 360 becomes 0.<br />
end<br />
<br />
return elementRelatedPosition<br />
else<br />
return false<br />
end<br />
end<br />
</syntaxhighlight></section><br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This example allows the player to press ''H'' near a vehicle to open its door according to the vehicle related angle. If the player is on the front of the vehicle, it opens the hood, if the player is on the back of the vehicle, it opens the trunk and so on.<br />
<syntaxhighlight lang="lua"><br />
function getNearestElement(thePlayer, elementType) -- Useful function (simplified version)<br />
local dist = 20 -- Only gets elements nearer than this distance.<br />
local x, y, z = getElementPosition(thePlayer)<br />
local nearest = false<br />
for _,veh in pairs(getElementsByType(elementType)) do<br />
local vx, vy, vz = getElementPosition(veh)<br />
local newDist = getDistanceBetweenPoints3D(x, y, z, vx, vy, vz)<br />
if newDist < dist then<br />
dist = newDist<br />
nearest = veh<br />
end<br />
end<br />
return nearest, dist<br />
end<br />
<br />
bindKey("h", "down", function(key, state)<br />
local veh, distance = getNearestElement(localPlayer, "vehicle")<br />
if veh and isElement(veh) then<br />
if distance < 5 then<br />
local angle = getElementRelatedAngle(localPlayer, veh)<br />
local door<br />
if angle >= 340 or angle < 20 then<br />
door = 0<br />
elseif angle >= 20 and angle < 90 then<br />
door = 3<br />
elseif angle >= 90 and angle < 160 then<br />
door = 5<br />
elseif angle >= 160 and angle < 200 then<br />
door = 1<br />
elseif angle >= 200 and angle < 270 then<br />
door = 4<br />
elseif angle >= 270 and angle < 340 then<br />
door = 2<br />
end<br />
if getVehicleDoorOpenRatio (veh, door) > 0 then<br />
setVehicleDoorOpenRatio (veh, door, 0, 500)<br />
else<br />
setVehicleDoorOpenRatio (veh, door, 1, 500)<br />
end<br />
end<br />
end<br />
end)<br />
</syntaxhighlight><br />
</section><br />
Author: [[User:LordHenry|LordHenry]]<br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=User:LordHenry&diff=76379User:LordHenry2023-04-01T20:48:56Z<p>LordHenry: /* Pages created by Lord Henry */</p>
<hr />
<div>__NOTOC__<br />
{{Note|This page requires '''DarkVector''' theme. You can enable dark mode in your [[Special:Preferences#mw-prefsection-rendering|preferences]]}}<br />
[[file:LordHenry-Logo.png|frameless|right]]<br />
== Lord Henry MTA profiles ==<br />
[https://community.multitheftauto.com/index.php?p=profile&id=421903 MTA community profile]<br><br />
[https://forum.mtasa.com/profile/50620-lord-henry MTA forum profile]<br><br />
MTA wiki profile <font color="gray"> (you are here)</font><br />
<br />
== Pages created by Lord Henry ==<br />
[[autoAttach]]<br><br />
[[createGarageColShape]]<br><br />
[[dxDrawBorderedText]]<br><br />
[[dxDrawRing]]<br><br />
[[exports]] (redirect page to [[call]])<br><br />
[[fadeInText]]<br><br />
[[getServerIP]] (redirect page to [[GetServerConfigSetting]])<br><br />
[[getWorldPositionFromMapPosition]] <br><br />
[[guiGridListSetColumnNonSortable]]<br><br />
[[isMouseOnGUICloseButton]]<br><br />
[[isVehicleReversing]]<br><br />
[[lookAt]] (redirect page to [[findRotation3D]])<br><br />
[[math.randomDiff]]<br><br />
[[playVideo]]<br><br />
[[resource:Bone_attach]]<br><br />
[[setPedArmour]] (redirect page to [[setPedArmor]])<br><br />
[[Template:PT-BR/Client_function]]<br><br />
[[Template:PT-BR/Server_function]]<br><br />
[[Template:PT-BR/Useful_function]]<br><br />
[[Template:ZoneNames]]<br />
<br />
== Wiki contributions by Lord Henry ==<br />
[[Special:Contributions/LordHenry]]<br />
<br />
== External Links to Lord Henry ==<br />
[[file:Youtube.png|32px]] [https://www.youtube.com/c/LordHenry Lord Henry - Youtube Channel]<br><br />
[[file:Facebook.png|32px]] [https://www.facebook.com/LordHenryEntertainment/ Lord Henry - Facebook Page]<br><br />
[[file:Instagram.png|32px]] [https://www.instagram.com/lordhenry.games/ Lord Henry - Instagram Page]<br><br />
[[file:Artstation.png|32px]] [https://www.artstation.com/lordhenry/ Lord Henry - Artstation Page]<br><br />
[[file:Sketchfab.png|32px]] [https://sketchfab.com/lordhenry Lord Henry - Sketchfab]<br><br />
[[file:Github2.png|32px]] [https://github.com/Lord-Henry Lord Henry - Github]<br />
<br />
== Friendlist ==<br />
[[User:Danilo]]<br><br />
[[User:Eficiencia]]<br><br />
[[User:HiroShi]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/takeNumFromElementData&diff=76378PT-BR/takeNumFromElementData2023-04-01T20:47:57Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__<br />
{{PT-BR/Useful_function}}<br />
Esta função é utilizada para subtrair o numero de uma determinada [[PT-BR/Element_data|ElementData]]. <br />
'''NOTA:''' Só pode ser usado em [[PT-BR/Element_data|ElementData]].<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool takeNumFromElementData( player thePlayer, int amount, string key )<br />
</syntaxhighlight><br />
<br />
===Argumentos obrigatórios===<br />
*'''thePlayer''': Caso seja em server-side, caso seja em client-side use: getLocalPlayer().<br />
*'''amount''': O valor que deseja subtrair.<br />
*'''key''': O nome do [[PT-BR/Element_data|ElementData]] a qual você deseja subtrair o valor.<br />
<br />
===Returns===<br />
Se esta função retorna ''arg.3'' quer dizer que o elemento citado não exista ou não tem valor atribuido, ''arg.2'' caso não determine o valor(lembrando deve ser um número !).<br />
<br />
==Código==<br />
<section name="Funcao compartilhada - Shared" class="shared" show="true"><br />
<syntaxhighlight lang="lua"><br />
function takeNumFromElementData( thePlayer, amount, key)<br />
if tonumber ( amount ) then<br />
if ( getElementData( thePlayer, tostring ( key ) ) ) then<br />
return setElementData ( thePlayer, key, ( getElementData( thePlayer, tonumber( key ) ) - tonumber(amount) ) )<br />
else<br />
outputDebugString ( "Error: arg.3", 3, 255, 0, 0, 0 )<br />
end<br />
else<br />
outputDebugString ( "Error: arg.2", 3, 255, 0, 0, 0 )<br />
end<br />
return false<br />
end<br />
</syntaxhighlight><br />
</section><br />
'''Author:''' Hiroshi Nagaza<br />
<br />
<br />
==Exemplo==<br />
<section name="Server" class="server" show="true"><br />
Este exemplo subtrair o número de um [[PT-BR/Element_data|ElementData]], chamado: "HR_LEVEL".<br />
<syntaxhighlight lang="lua"><br />
function RemoverLevels( thePlayer, command, amount, key )<br />
takeNumFromElementData(thePlayer, amount, key )<br />
end<br />
addEventHandler ( "takelevels", RemoverLevels) -- no caso o comando seria: /takelevels 20 HR_LEVEL<br />
</syntaxhighlight><br />
</section><br />
<br />
==Veja Também==<br />
{{Element_functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=Template:PT-BR/Useful_function&diff=76377Template:PT-BR/Useful function2023-04-01T20:47:39Z<p>LordHenry: Created page with "<pageclass class="#228B22" subcaption="Função Útil"></pageclass> <includeonly> Category:Useful Functions </includeonly>"</p>
<hr />
<div><pageclass class="#228B22" subcaption="Função Útil"></pageclass><br />
<includeonly><br />
[[Category:Useful Functions]]<br />
</includeonly></div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=User:LordHenry&diff=76375User:LordHenry2023-04-01T20:42:27Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__<br />
{{Note|This page requires '''DarkVector''' theme. You can enable dark mode in your [[Special:Preferences#mw-prefsection-rendering|preferences]]}}<br />
[[file:LordHenry-Logo.png|frameless|right]]<br />
== Lord Henry MTA profiles ==<br />
[https://community.multitheftauto.com/index.php?p=profile&id=421903 MTA community profile]<br><br />
[https://forum.mtasa.com/profile/50620-lord-henry MTA forum profile]<br><br />
MTA wiki profile <font color="gray"> (you are here)</font><br />
<br />
== Pages created by Lord Henry ==<br />
[[autoAttach]]<br><br />
[[createGarageColShape]]<br><br />
[[dxDrawBorderedText]]<br><br />
[[dxDrawRing]]<br><br />
[[exports]] (redirect page to [[call]])<br><br />
[[fadeInText]]<br><br />
[[getServerIP]] (redirect page to [[GetServerConfigSetting]])<br><br />
[[getWorldPositionFromMapPosition]] <br><br />
[[guiGridListSetColumnNonSortable]]<br><br />
[[isMouseOnGUICloseButton]]<br><br />
[[isVehicleReversing]]<br><br />
[[lookAt]] (redirect page to [[findRotation3D]])<br><br />
[[math.randomDiff]]<br><br />
[[playVideo]]<br><br />
[[resource:Bone_attach]]<br><br />
[[setPedArmour]] (redirect page to [[setPedArmor]])<br><br />
[[Template:PT-BR/Useful_Function]]<br><br />
[[Template:ZoneNames]]<br />
<br />
== Wiki contributions by Lord Henry ==<br />
[[Special:Contributions/LordHenry]]<br />
<br />
== External Links to Lord Henry ==<br />
[[file:Youtube.png|32px]] [https://www.youtube.com/c/LordHenry Lord Henry - Youtube Channel]<br><br />
[[file:Facebook.png|32px]] [https://www.facebook.com/LordHenryEntertainment/ Lord Henry - Facebook Page]<br><br />
[[file:Instagram.png|32px]] [https://www.instagram.com/lordhenry.games/ Lord Henry - Instagram Page]<br><br />
[[file:Artstation.png|32px]] [https://www.artstation.com/lordhenry/ Lord Henry - Artstation Page]<br><br />
[[file:Sketchfab.png|32px]] [https://sketchfab.com/lordhenry Lord Henry - Sketchfab]<br><br />
[[file:Github2.png|32px]] [https://github.com/Lord-Henry Lord Henry - Github]<br />
<br />
== Friendlist ==<br />
[[User:Danilo]]<br><br />
[[User:Eficiencia]]<br><br />
[[User:HiroShi]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/takeNumFromElementData&diff=76374PT-BR/takeNumFromElementData2023-04-01T20:41:26Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__<br />
{{PT-BR/Useful_Function}}<br />
Esta função é utilizada para subtrair o numero de uma determinada [[PT-BR/Element_data|ElementData]]. <br />
'''NOTA:''' Só pode ser usado em [[PT-BR/Element_data|ElementData]].<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool takeNumFromElementData( player thePlayer, int amount, string key )<br />
</syntaxhighlight><br />
<br />
===Argumentos obrigatórios===<br />
*'''thePlayer''': Caso seja em server-side, caso seja em client-side use: getLocalPlayer().<br />
*'''amount''': O valor que deseja subtrair.<br />
*'''key''': O nome do [[PT-BR/Element_data|ElementData]] a qual você deseja subtrair o valor.<br />
<br />
===Returns===<br />
Se esta função retorna ''arg.3'' quer dizer que o elemento citado não exista ou não tem valor atribuido, ''arg.2'' caso não determine o valor(lembrando deve ser um número !).<br />
<br />
==Código==<br />
<section name="Funcao compartilhada - Shared" class="shared" show="true"><br />
<syntaxhighlight lang="lua"><br />
function takeNumFromElementData( thePlayer, amount, key)<br />
if tonumber ( amount ) then<br />
if ( getElementData( thePlayer, tostring ( key ) ) ) then<br />
return setElementData ( thePlayer, key, ( getElementData( thePlayer, tonumber( key ) ) - tonumber(amount) ) )<br />
else<br />
outputDebugString ( "Error: arg.3", 3, 255, 0, 0, 0 )<br />
end<br />
else<br />
outputDebugString ( "Error: arg.2", 3, 255, 0, 0, 0 )<br />
end<br />
return false<br />
end<br />
</syntaxhighlight><br />
</section><br />
'''Author:''' Hiroshi Nagaza<br />
<br />
<br />
==Exemplo==<br />
<section name="Server" class="server" show="true"><br />
Este exemplo subtrair o número de um [[PT-BR/Element_data|ElementData]], chamado: "HR_LEVEL".<br />
<syntaxhighlight lang="lua"><br />
function RemoverLevels( thePlayer, command, amount, key )<br />
takeNumFromElementData(thePlayer, amount, key )<br />
end<br />
addEventHandler ( "takelevels", RemoverLevels) -- no caso o comando seria: /takelevels 20 HR_LEVEL<br />
</syntaxhighlight><br />
</section><br />
<br />
==Veja Também==<br />
{{Element_functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/hasObjectPermissionTo&diff=76371PT-BR/hasObjectPermissionTo2023-04-01T20:22:43Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__ <br />
{{PT-BR/Server_function}}<br />
Esta função retorna se o determinado objeto tem ou não acesso para realizar determinada ação.<br />
{{BR/Nota|Somente alguns nomes de ações funcionam. Esta função parece retornar ''nil'' e exibir um aviso de má argumentação quando é checado se um objeto tem permissões para uma ação que não comece com as palavras ''function.'', ''command.'' ou ''resource.''.}}<br />
<br />
Os scripts frequentemente querem limitar acesso de seus recursos para usuários em particulares. A forma ingênua de fazer isto seria verificando se um jogador que está tentando realizar uma ação, está em um grupo da ACL (geralmente o grupo Admin). O principal problema disso é que o grupo Admin é maleável e nem sempre pode existir. Isto também não dá ao administrador do servidor qualquer flexibilidade. Ele pode querer permitir que seus 'moderadores' usem a função que está com acesso limitado, ou que desabilite esta função por completo.<br />
<br />
É aqui que entra o uso adequado da ACL e, felizmente, isso é muito fácil. Tudo se resume a usar esta função. Esta função, com um nome um tanto confuso, permite que você verifique se um objeto da ACL (um jogador ou um resource) tem uma permissão da ACL. Neste caso, só vamos trabalhar com 'players'.<br />
<br />
Então, primeiro de tudo, pense num nome para sua 'permissão'. Hum, imaginemos que queremos uma área privada em que somente determinados jogadores podem entrar, então vamos chamar nossa permissão de ''accessPrivateArea''. Daí, tudo que você precisa fazer é usar a instrução 'if' no seu código:<br />
<syntaxhighlight lang="lua"><br />
if hasObjectPermissionTo ( player, "resource.YourResourceName.accessPrivateArea", false ) then<br />
-- Seja lá o que você quer que aconteça se o jogador tem a permissão.<br />
else<br />
-- Seja lá o que você quer que aconteça se o jogador não tem a permissão.<br />
end<br />
</syntaxhighlight><br />
<br />
Note que nomeamos a ''permissão'' usando ''resource.YourResourceName.accessPrivateArea'' - isso é só para deixar mais 'legível', para que o admin saiba qual resource a permissão pertence. É extremamente recomendado que você siga esta ideia. O argumento ''false'' se refere ao argumento ''defaultPermission'', '''false''' indicando que se o usuário não tiver a permissão concedida ou não concedida (ex.: o admin não adicionou a permissão no config), por padrão ela não será concedida.<br />
<br />
A única desvantagem de usar este método é que o admin terá de modificar sua configuração. As vantagens são que o admin tem muito mais controle e seu script vai funcionar para qualquer servidor, contanto que o administrador o tenha configurado.<br />
<br />
==Sintaxe== <br />
<syntaxhighlight lang="lua"><br />
bool hasObjectPermissionTo ( string / element theObject, string theAction [, bool defaultPermission = true ] )<br />
</syntaxhighlight> <br />
<!-- Yes! This is actually correct this time ^^ notice theObject can be a string! --><br />
{{PT-BR/POO|Esta função é também uma função estática sob a classe ACL.|[[ACL]].hasObjectPermissionTo||}}<br />
===Argumentos necessários=== <br />
*'''theObject:''' O objeto para checar se tem a permissão. Aqui pode especificar um elemento client (ex.: player), um resource ou uma string nos seguintes formatos: "user.<name>" ou "resource.<name>".<br />
*'''theAction:''' A ação para verificar se o determinado objeto tem acesso. Ex.: "funcion.kickPlayer".<br />
<br />
===Argumentos opcionais=== <br />
{{BR/ArgOpcional}} <br />
*'''defaultPermission:''' A permissão padrão se nada é especificado em nenhum dos grupos em que o determinado objeto 'theObject' seja um membro. Se especificar '''true''', o determinado objeto terá permissões para realizar a ação a não ser que o oposto esteja explicitamente especificado na [[ACL]]. Se '''false''', a ação será negada por padrão a não ser que esteja explicitamente aprovado pela [[ACL]].<br />
<br />
===Retorno===<br />
Retorna ''true'' se o objeto especificado tem permissão para realizar a determinada ação, ''false'' caso contrário. Retorna ''nil'' se a função falha pela má argumentação.<br />
<br />
==Exemplo== <br />
Este exemplo expulsa um jogador do servidor se o usuário que estiver usando tiver acesso à função `kickPlayer`.<br />
<syntaxhighlight lang="lua"><br />
-- Kick command<br />
function onKickCommandHandler ( playerSource, commandName, playerToKick, stringReason )<br />
-- Does the calling user have permission to kick the player? Default<br />
-- to false for safety reasons. We do this so any user can't use us to<br />
-- kick players.<br />
if ( hasObjectPermissionTo ( playerSource, "function.kickPlayer", false ) ) then<br />
<br />
-- Do we have permission to kick the player? We do this so we can fail<br />
-- nicely if this resource doesn't have access to call that function.<br />
if ( hasObjectPermissionTo ( getThisResource (), "function.kickPlayer", true ) ) then<br />
-- Kick him<br />
kickPlayer ( playerToKick, playerSource, stringReason )<br />
else<br />
-- Resource doesn't have any permissions, sorry<br />
outputChatBox ( "kick: The admin resource is not able to kick players. Please give this resource access to 'function.kickPlayer' in the ACL to use this function.", playerSource )<br />
end<br />
else<br />
-- User doesn't have any permissions<br />
outputChatBox ( "kick: You don't have permissions to use this command.", playerSource )<br />
end<br />
end<br />
addCommandHandler ( "kick", onKickCommandHandler )<br />
</syntaxhighlight><br />
<br />
==Veja também==<br />
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc --><br />
{{PT-BR/ACL functions}}<br />
[[zh-cn:hasObjectPermissionTo]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/giveWeapon&diff=76370PT-BR/giveWeapon2023-04-01T20:22:28Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__ <br />
{{PT-BR/Server_function}}<br />
Esta função dá uma determinada arma para um determinado [[Elemento/Player|jogador]] ou [[Elemento/Ped|ped]]. Há um argumento opcional que se refere à munição. Por exemplo, uma arma branca, ou arma de mão que não são disparados ou não disparam projéteis não precisam de munição.<br />
{{BR/Nota|<br />
*Quando definir munição para as [[Weapon|armas no slot]] 0,1,10,11 or 12, a munição máxima será '''1'''<br />
*Quando definir munição para as [[Weapon|armas no slot]] 3,4,5, a munição será ''adicionada''<br />
*Quando definir munição para as [[Weapon|armas no slot]] 2,6,7,8,9 e a arma deste slot for trocada, a munição é ''realocada''<br />
}}<br />
<br />
==Sintaxe== <br />
<syntaxhighlight lang="lua">bool giveWeapon ( ped thePlayer, int weapon [, int ammo=30, bool setAsCurrent=false ] )</syntaxhighlight> <br />
<br />
===Argumentos Necessários=== <br />
*'''thePlayer:''' O [[Elemento/Player|jogador]] or [[Elemento/Ped|ped]] que receberá a arma.<br />
*'''weapon:''' Um número inteiro representando o ID da [[Weapon|arma]]. Clique [[Weapon|aqui]] para uma lista de possíveis ID's de armas.<br />
<br />
===Argumentos Opcionais===<br />
{{BR/ArgOpcional}} <br />
*'''ammo:''' Um número [[PT-BR/Int|inteiro]] representando a quantidade da munição para a arma. Para armas que não precisam de munição, como as armas brancas, este argumento deve ser pelo menos '''1'''.<br />
*'''setAsCurrent:''' Um valor [[boolean|booleano]] determinando se a arma vai ou não set definida como atual para o jogador, ou seja, se '''true''', assim que o jogador receber a arma, o jogador vai segurar esta arma.<br />
<br />
===Retorno=== <br />
Retorna ''true'' se a arma foi adquirida com sucesso, senão ''false''.<br />
<br />
==Exemplo== <br />
'''Examplo 1:''' Este exemplo dá uma M4 para o jogador com 200 de munição assim que ele ''spawnar''.<br />
<syntaxhighlight lang="lua"><br />
function giveWeaponsOnSpawn ( theSpawnpont, theTeam )<br />
giveWeapon ( source, 31, 200 ) -- Gives the M4 weapon with 200 ammo<br />
end<br />
addEventHandler ( "onPlayerSpawn", root, giveWeaponsOnSpawn ) -- attach the event handler<br />
</syntaxhighlight><br />
<br />
<br />
'''Example 2:''' Este exemplo adiciona o comando "give" no console que permite a obtenção de qualquer arma ao executar: "give <id> <amount>".<br />
<syntaxhighlight lang="lua"><br />
function consoleGive ( thePlayer, commandName, weaponID, ammo )<br />
local status = giveWeapon ( thePlayer, weaponID, ammo, true ) -- attempt to give the weapon, forcing it as selected weapon<br />
if ( not status ) then -- if it was unsuccessful<br />
outputConsole ( "Failed to give weapon.", thePlayer ) -- tell the player<br />
end<br />
end<br />
addCommandHandler ( "give", consoleGive )<br />
</syntaxhighlight><br />
<br />
<br />
'''Example 3:''' Este exemplo cria um ped em uma determinada posição. Você pode dar à ele uma arma executando o seguinte comando "give <weaponID> <amount>" no console.<br />
<syntaxhighlight lang="lua"><br />
ped = createPed( 19, -1634.5775, 1203.85, 7.1796 )<br />
<br />
addCommandHandler( "give",<br />
function ( player, command, id, amount )<br />
if not tonumber ( id ) then return end<br />
<br />
if not tonumber ( amount ) then<br />
amount = 9001<br />
end<br />
<br />
giveWeapon( ped, id, amount, true )<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Weapon functions}}<br />
[[ru:giveWeapon]]<br />
[[pl:giveWeapon]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/RedirectPlayer&diff=76369PT-BR/RedirectPlayer2023-04-01T20:22:02Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__<br />
{{PT-BR/Server_function}}<br />
Esta função redireciona o jogador para um servidor específico.<br />
{{BR/Nota|O mod que usar esta função precisará de '''permissões de ACL''' para funcionar (function.redirectPlayer)}}<br />
<br />
==Sintaxe==<br />
<syntaxhighlight lang="lua"><br />
bool redirectPlayer ( player thePlayer, string serverIP = "", int serverPort = 0 [, string serverPassword = "" ] )<br />
</syntaxhighlight><br />
{{PT-BR/POO||[[player]]:redirect||}}<br />
===Argumentos necessários===<br />
*'''thePlayer:''' O jogador que você quer redirecionar.<br />
*'''serverIP:''' O endereço IP (ou nome de domínio que o endereço utilize) do servidor para qual quer redirecionar o jogador. '''Use uma string vazia para reconectar no servidor em que já estava.'''<br />
*'''serverPort:''' A porta do servidor para qual quer redirecionar o jogador, que geralmente é 22003. '''Coloque 0 para que a porta usada seja a mesma do servidor em que está atualmente.'''<br />
<br />
===Argumento opcional===<br />
*'''serverPassword:''' A senha para o servidor, caso o mesmo esteja trancado.<br />
<br />
===Retorna===<br />
Retorna ''true'' se o jogador foi redirecionado com sucesso, ''false'' se argumentos inválidos foram especificados.<br />
<br />
==Exemplo==<br />
<br />
Este exemplo auto-redireciona todos os jogadores que entrarem no servidor para o servidor especificado' IP:PORTA.<br />
<syntaxhighlight lang="lua"><br />
local ip_port = "123.123.1.2:1234" -- coloque o IP e porta do servidor no seguinte formato: 192.168.1.1:22003<br />
local senha = "senha_para_conectar" -- Se o servidor estiver trancado, coloque a senha aqui (Se não, não precisa especificar a variável na função)<br />
<br />
function Redirecionar()<br />
redirectPlayer(source, gettok(ip_port,1,":"), tonumber(gettok(ip_port,2,":")), senha)<br />
end<br />
addEventHandler ("onPlayerJoin", root, Redirecionar)<br />
</syntaxhighlight><br />
<br />
Este exemplo adiciona o comando "irservidor" usando a sintaxe, "/irservidor IP_servidor Port_servidor [Sen_servidor]".<br />
<syntaxhighlight lang="lua"><br />
function irParaOServidor (playerSource, commandName, IP_servidor, Port_servidor, Sen_servidor)<br />
if IP_servidor and Port_servidor then -- Se o IP e a Porta foram especificados, então<br />
if Sen_servidor then -- Se a senha também foi especificada<br />
redirectPlayer (playerSource, IP_servidor, tonumber(Port_servidor), Sen_servidor) -- redireciona o jogador<br />
else -- Se a senha não foi especificada<br />
redirectPlayer (playerSource, IP_servidor, tonumber(Port_servidor)) -- redireciona o jogador para o servidor sem especificar o parâmetro da senha<br />
end<br />
else -- Se o IP e a Porta não foram especificados<br />
outputChatBox ("Erro! Siga a sintaxe: /irservidor IP Porta [Senha]", playerSource) -- Exiba a mensagem de erro para o jogador<br />
end<br />
end<br />
<br />
addCommandHandler ("irservidor", irParaOServidor) <br />
</syntaxhighlight><br />
<br />
{{New feature/item|3.0120|1.2|3429|<br />
Este exemplo adiciona o comando "reentrar" que pode se parecer com o '''/reconnect''' nativo do MTA.<br />
<syntaxhighlight lang="lua"><br />
function Reentrar (oJogador, cmd)<br />
redirectPlayer(oJogador)<br />
end<br />
addCommandHandler("reentrar", Reentrar) -- Anexe o comando à função designada<br />
</syntaxhighlight><br />
}}<br />
<br />
==Veja também==<br />
{{BR/Funções de Jogador}}<br />
[[en:redirectPlayer]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/SetElementBonePosition&diff=76367PT-BR/SetElementBonePosition2023-04-01T20:17:30Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__<br />
{{PT-BR/Client_function}}<br />
{{Added feature/item|1.5.9|1.5.8|20704|Esta função define as coordenadas de um osso previamente especificado. Atualmente os elementos do tipo: [[Elemento/Player|Player]] e [[Elemento/Ped|Ped]] são aceitos.}}<br />
{{Tip|Se você quer anexar um elemente a um osso, confira: [[attachElementToBone]].}}<br />
{{Note|Você precisa usar essa função em conjunto com o seguinte evento: [[onClientPedsProcessed]].}}<br />
<br />
==Sintaxe==<br />
<syntaxhighlight lang="lua"><br />
bool setElementBonePosition ( element theElement, int bone, float x, float y, float z )<br />
</syntaxhighlight><br />
<br />
===Argumentos necessários===<br />
*'''theElement:''' o [[elemento]] que terá a posição do osso definida.<br />
*'''bone:''' o ID do osso que terá a posição definida. Confira os ID's em: [[Bone IDs]].<br />
*'''x:''' A coordenada X que o osso terá.<br />
*'''y:''' A coordenada Y que o osso terá.<br />
*'''z:''' A coordenada Z que o osso terá.<br />
<br />
===Retorno===<br />
Retorna ''true'' se a execução for bem sucedida, ''false'' caso contrário.<br />
<br />
==Exemplo==<br />
[[File:CJ with long neck.png|thumb|alt=CJ with long neck|Pré-visualização do exemplo.]]<br />
Este exemplo mostra o CJ surpreso e com um longo pescoço<br />
<syntaxhighlight lang="lua"><br />
local bones = {<br />
[4] = Vector3(0, 0, 0.15),<br />
[5] = Vector3(0, 0, 0.15),<br />
[6] = Vector3(0, 0, 0.13),<br />
[7] = Vector3(0, 0, 0.13),<br />
[8] = Vector3(0, 0, 0.1),<br />
}<br />
function updatePed()<br />
for bone,v in pairs(bones) do<br />
local pos = localPlayer:getBonePosition(bone)+v<br />
setElementBonePosition(localPlayer, bone, pos)<br />
end<br />
end<br />
addEventHandler("onClientPedsProcessed", root, updatePed)<br />
</syntaxhighlight><br />
<br />
==Requerimentos==<br />
{{Requirements|n/a|1.5.8-9.20704|}}<br />
<br />
==Veja também==<br />
{{Client_element_functions}}</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/svgGetSize&diff=76366PT-BR/svgGetSize2023-04-01T20:17:13Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__<br />
{{PT-BR/Client_function}}<br />
{{Added feature/item|1.5.9|1.5.8|20979|Obtém o documento XML subjacente de um elemento SVG.}}<br />
==Sintaxe== <br />
<syntaxhighlight lang="lua">int, int svgGetSize( svg svgElement )</syntaxhighlight><br />
<br />
===Argumentos Necessários===<br />
*'''svgElement:''' O elemento [[svg]] que você deseja obter o tamanho.<br />
<br />
===Retornos===<br />
* Retorna dois [[int]]s, representando '''largura''' e '''altura'''<br />
<br />
==Exemplo==<br />
Veja o exemplo em [[svgSetSize]].<br />
<br />
==Requisitos==<br />
{{Requirements|n/a|1.5.8-9.20979|}}<br />
<br />
==Veja também==<br />
{{PT-BR/SVG functions}}<br />
<br />
[[en:svgGetSize]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/svgSetSize&diff=76365PT-BR/svgSetSize2023-04-01T20:16:54Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__<br />
{{PT-BR/Client_function}}<br />
{{Added feature/item|1.5.9|1.5.8|20979|Define o documento XML subjacente de um elemento SVG.}}<br />
==Sintaxe== <br />
<syntaxhighlight lang="lua">bool svgSetSize( svg svgElement, int width, int height [, function callback ( bool didLoad ) ] )</syntaxhighlight><br />
<br />
===Argumentos Necessários===<br />
*'''svgElement:''' O elemento [[svg]] que você deseja definir o tamanho.<br />
*'''width:''' Largura, de preferência em potência de dois (16, 32, 64 etc.), o máximo é 4096<br />
*'''height :''' Altura, de preferência em potência de dois (16, 32, 64 etc.), o máximo é 4096<br />
<br />
===Argumentos Opcionais===<br />
{{OptionalArg}}<br />
*'''callback:''' Uma função de retorno de chamada que é armazenada no SVG e disparada toda vez que a textura do SVG é atualizada (por exemplo, via [[svgSetSize]]). Nota: se presente, isso substituirá o retorno de chamada atual armazenado no [[svg]]<br />
<br />
===Retornos===<br />
* Retorna '''true''' se for bem sucedido, '''false''' caso dê errado.<br />
<br />
==Exemplo==<br />
Este exemplo cria um elemento [[svg]] incluindo um keybind (F2) para adicionar um nó rect filho, com o uso de uma função de callback para notificar no debugscript quando o SVG foi atualizado.<br />
<br />
<syntaxhighlight lang="lua"><br />
-- Isso também pode ser um arquivo, com o caminho fornecido para svgCreate<br />
local rawSvgData = [[<br />
<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><br />
<circle cx="250" cy="250" r="250" fill="#0fc0fc" /><br />
</svg><br />
]]<br />
<br />
local svgs = {}<br />
<br />
local function render(svg)<br />
if (not isElement(svg)) or (getElementType(svg) ~= "svg") then<br />
removeEventHandler("onClientRender", root, svgs[svg].handler)<br />
svgs[svg] = nil<br />
end<br />
<br />
local width, height = svgGetSize(svg)<br />
dxDrawImage(0, 0, width, height, svg, 0, 0, 0, tocolor(255, 255, 255), false)<br />
end<br />
<br />
local function onUpdate(svg)<br />
-- Se esta for a primeira atualização, adicione svg à nossa tabela e comece a desenhá-la<br />
if (not svgs[svg]) then<br />
svgs[svg] = {<br />
state = true,<br />
handler = function()<br />
render(svg)<br />
end<br />
}<br />
<br />
addEventHandler("onClientRender", root, svgs[svg].handler)<br />
end<br />
<br />
iprint("Textura SVG atualizada.", svg, getTickCount())<br />
end<br />
<br />
local function init()<br />
-- Cria um SVG contendo um círculo, usando os dados XML brutos acima<br />
local mySvg = svgCreate(500, 500, rawSvgData, onUpdate)<br />
<br />
-- Vincule uma chave para criar um nó filho SVG rect, que acionará o retorno de chamada onUpdate<br />
bindKey("F2", "down", function()<br />
addSVGRectNode(mySvg)<br />
end)<br />
end<br />
addEventHandler("onClientResourceStart", resourceRoot, init)<br />
<br />
-- Adiciona um nó reto ao SVG com cor, tamanho e posição aleatórios<br />
function addSVGRectNode(svg)<br />
-- Obter o documento XML do nosso SVG<br />
local svgXML = svgGetDocumentXML(svg)<br />
<br />
-- Adicione um nó SVG reto, posicionado no centro do documento<br />
local rect = xmlCreateChild(svgXML, "rect")<br />
<br />
local size = math.random(0, 50)<br />
local r, g, b = math.random(10, 99), math.random(10, 99), math.random(10, 99)<br />
<br />
xmlNodeSetAttribute(rect, "x", (size / 2) .. "%")<br />
xmlNodeSetAttribute(rect, "y", (size / 2) .. "%")<br />
xmlNodeSetAttribute(rect, "width", size .. "%")<br />
xmlNodeSetAttribute(rect, "height", size .. "%")<br />
xmlNodeSetAttribute(rect, "fill", "#" .. r .. g .. b)<br />
<br />
-- Aplique nosso XML ao SVG e comece a desenhar via callback<br />
svgSetDocumentXML(svg, svgXML)<br />
end<br />
</syntaxhighlight><br />
<br />
==Requisitos==<br />
{{Requirements|n/a|1.5.8-9.20979|}}<br />
<br />
==Veja também==<br />
{{PT-BR/SVG functions}}<br />
<br />
[[en:svgSetSize]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/svgGetSize&diff=76364PT-BR/svgGetSize2023-04-01T20:16:30Z<p>LordHenry: </p>
<hr />
<div>{{PT-BR/Client_function}}<br />
{{Added feature/item|1.5.9|1.5.8|20979|Obtém o documento XML subjacente de um elemento SVG.}}<br />
==Sintaxe== <br />
<syntaxhighlight lang="lua">int, int svgGetSize( svg svgElement )</syntaxhighlight><br />
<br />
===Argumentos Necessários===<br />
*'''svgElement:''' O elemento [[svg]] que você deseja obter o tamanho.<br />
<br />
===Retornos===<br />
* Retorna dois [[int]]s, representando '''largura''' e '''altura'''<br />
<br />
==Exemplo==<br />
Veja o exemplo em [[svgSetSize]].<br />
<br />
==Requisitos==<br />
{{Requirements|n/a|1.5.8-9.20979|}}<br />
<br />
==Veja também==<br />
{{PT-BR/SVG functions}}<br />
<br />
[[en:svgGetSize]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/svgGetDocumentXML&diff=76363PT-BR/svgGetDocumentXML2023-04-01T20:16:10Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__<br />
{{PT-BR/Client_function}}<br />
{{Added feature/item|1.5.9|1.5.8|20979|Obtém o documento XML subjacente de um elemento SVG.}}<br />
==Sintaxe== <br />
<syntaxhighlight lang="lua">xmlnode svgGetDocumentXML ( svg svgElement )</syntaxhighlight><br />
<br />
===Argumentos Necessários===<br />
*'''svgElement:''' O elemento [[svg]] que você deseja obter o documento XML.<br />
<br />
===Retornos===<br />
* Retorna um [[xmlnode]] se for bem sucedido, '''false''' caso dê errado.<br />
<br />
==Exemplo==<br />
Veja o exemplo em [[svgSetDocumentXML]]<br />
<br />
==Requisitos==<br />
{{Requirements|N/A|1.5.8-9.20979|}}<br />
<br />
==Veja também==<br />
{{PT-BR/SVG functions}}<br />
<br />
[[en:svgGetDocumentXML]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/SvgSetDocumentXML&diff=76362PT-BR/SvgSetDocumentXML2023-04-01T20:15:06Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__<br />
{{PT-BR/Client_function}}<br />
{{Added feature/item|1.5.9|1.5.8|20979|Define o documento XML subjacente de um elemento SVG.}}<br />
==Sintaxe== <br />
<syntaxhighlight lang="lua">bool svgSetDocumentXML ( svg svgElement, xmlnode xmlDocument [, function callback ( bool didLoad ) ] )</syntaxhighlight><br />
<br />
===Argumentos Necessários===<br />
*'''svgElement:''' Um elemento [[svg]] que você deseja definir o documento XML.<br />
*'''xmlDocument:''' Um [[xmlnode]] contendo os dados para serem definidos no documento SVG.<br />
<br />
===Argumentos Opcionais===<br />
{{OptionalArg}}<br />
*'''callback:''' Uma função de retorno de chamada que é armazenada no SVG e disparada toda vez que a textura do SVG é atualizada (por exemplo, via [[svgSetSize]]). Nota: se presente, isso substituirá o retorno de chamada atual armazenado no [[svg]]<br />
<br />
===Retornos===<br />
* Retorna'''true''' se for bem sucedido, '''false''' caso contrário.<br />
<br />
==Exemplo==<br />
Este exemplo cria um elemento [[svg]] incluindo um keybind (F2) para adicionar um nó rect filho, com o uso de uma função de callback para notificar no debugscript quando o SVG foi atualizado.<br />
<br />
<syntaxhighlight lang="lua"><br />
-- Isso também pode ser um arquivo, com o caminho fornecido para svgCreate<br />
local rawSvgData = [[<br />
<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><br />
<circle cx="250" cy="250" r="250" fill="#0fc0fc" /><br />
</svg><br />
]]<br />
<br />
local svgs = {}<br />
<br />
local function render(svg)<br />
if (not isElement(svg)) or (getElementType(svg) ~= "svg") then<br />
removeEventHandler("onClientRender", root, svgs[svg].handler)<br />
svgs[svg] = nil<br />
end<br />
<br />
local width, height = svgGetSize(svg)<br />
dxDrawImage(0, 0, width, height, svg, 0, 0, 0, tocolor(255, 255, 255), false)<br />
end<br />
<br />
local function onUpdate(svg)<br />
-- Se esta for a primeira atualização, adicione svg à nossa tabela e comece a desenhá-la<br />
if (not svgs[svg]) then<br />
svgs[svg] = {<br />
state = true,<br />
handler = function()<br />
render(svg)<br />
end<br />
}<br />
<br />
addEventHandler("onClientRender", root, svgs[svg].handler)<br />
end<br />
<br />
iprint("Textura SVG atualizada.", svg, getTickCount())<br />
end<br />
<br />
local function init()<br />
-- Cria um SVG contendo um círculo, usando os dados XML brutos acima<br />
local mySvg = svgCreate(500, 500, rawSvgData, onUpdate)<br />
<br />
-- Vincule uma chave para criar um nó filho SVG rect, que acionará o retorno de chamada onUpdate<br />
bindKey("F2", "down", function()<br />
addSVGRectNode(mySvg)<br />
end)<br />
end<br />
addEventHandler("onClientResourceStart", resourceRoot, init)<br />
<br />
-- Adiciona um nó reto ao SVG com cor, tamanho e posição aleatórios<br />
function addSVGRectNode(svg)<br />
-- Obter o documento XML do nosso SVG<br />
local svgXML = svgGetDocumentXML(svg)<br />
<br />
-- Adicione um nó SVG reto, posicionado no centro do documento<br />
local rect = xmlCreateChild(svgXML, "rect")<br />
<br />
local size = math.random(0, 50)<br />
local r, g, b = math.random(10, 99), math.random(10, 99), math.random(10, 99)<br />
<br />
xmlNodeSetAttribute(rect, "x", (size / 2) .. "%")<br />
xmlNodeSetAttribute(rect, "y", (size / 2) .. "%")<br />
xmlNodeSetAttribute(rect, "width", size .. "%")<br />
xmlNodeSetAttribute(rect, "height", size .. "%")<br />
xmlNodeSetAttribute(rect, "fill", "#" .. r .. g .. b)<br />
<br />
-- Aplique nosso XML ao SVG e comece a desenhar via callback<br />
svgSetDocumentXML(svg, svgXML)<br />
end<br />
</syntaxhighlight><br />
<br />
==Requisitos==<br />
{{Requirements|n/a|1.5.8-9.20979|}}<br />
<br />
==Veja também==<br />
{{PT-BR/SVG functions}}<br />
<br />
[[en:svgSetDocumentXML]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/svgGetDocumentXML&diff=76361PT-BR/svgGetDocumentXML2023-04-01T20:14:51Z<p>LordHenry: </p>
<hr />
<div>{{PT-BR/Client_function}}<br />
{{Added feature/item|1.5.9|1.5.8|20979|Obtém o documento XML subjacente de um elemento SVG.}}<br />
==Sintaxe== <br />
<syntaxhighlight lang="lua">xmlnode svgGetDocumentXML ( svg svgElement )</syntaxhighlight><br />
<br />
===Argumentos Necessários===<br />
*'''svgElement:''' O elemento [[svg]] que você deseja obter o documento XML.<br />
<br />
===Retornos===<br />
* Retorna um [[xmlnode]] se for bem sucedido, '''false''' caso dê errado.<br />
<br />
==Exemplo==<br />
Veja o exemplo em [[svgSetDocumentXML]]<br />
<br />
==Requisitos==<br />
{{Requirements|N/A|1.5.8-9.20979|}}<br />
<br />
==Veja também==<br />
{{PT-BR/SVG functions}}<br />
<br />
[[en:svgGetDocumentXML]]</div>LordHenryhttps://wiki.multitheftauto.com/index.php?title=PT-BR/svgCreate&diff=76360PT-BR/svgCreate2023-04-01T20:14:36Z<p>LordHenry: </p>
<hr />
<div>__NOTOC__<br />
{{PT-BR/Client_function}}<br />
{{BR/Nota Importante|'''NÃO''' use [[svgCreate]] dentro do evento [[onClientRender]] pode ocasionar crash em seu servidor.}}<br />
{{Added feature/item|1.5.9|1.5.8|20979|}}<br />
Cria um [[svg]] com um tamanho (documento em branco), por um caminho de arquivo ou dados brutos.<br />
==Sintaxe== <br />
<syntaxhighlight lang="lua">svg svgCreate ( int width, int height [, string pathOrRawData, function callback ( bool didLoad ) ] )</syntaxhighlight><br />
<br />
===Argumentos Necessários===<br />
*'''width''' Largura, de preferência em potência de dois (16, 32, 64 etc.), o máximo é 4096.<br />
*'''height''' Altura, de preferência em potência de dois (16, 32, 64 etc.), o máximo é 4096.<br />
<br />
===Argumentos Opcionais===<br />
{{OptionalArg}}<br />
*'''pathOrRawData:''' Uma [[string]] representando o caminho para seu arquivo SVG, ou dados brutos SVG.<br />
*'''callback:''' Uma função de retorno de chamada que é armazenada no SVG e disparada toda vez que a textura do SVG é atualizada (por exemplo, via [[svgSetDocumentXML]]).<br />
Nota: Veja [[svgSetUpdateCallback]] para trabalhar com a função de retorno de chamada de um svg.<br />
<br />
===Retornos===<br />
* Retorna um [[svg]] se criado com sucesso, ''false'' caso dê errado.<br />
<br />
==Exemplo==<br />
O exemplo abaixo mostra como você pode carregar um SVG por dados brutos (ou arquivo) e desenhá-lo com [[dxDrawImage]] via [[onClientRender]].<br />
<br />
<syntaxhighlight lang="lua"><br />
-- Isso também pode ser um arquivo, com o diretório do arquivo fornecido no svgCreate<br />
local rawSvgData = [[<br />
<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><br />
<circle cx="250" cy="250" r="250" fill="#0fc0fc" /><br />
</svg><br />
]]<br />
<br />
local myCircleSvg<br />
<br />
local function drawCircleSvg()<br />
dxDrawImage(0, 0, 500, 500, myCircleSvg, 0, 0, 0, tocolor(255, 255, 255), false)<br />
end<br />
<br />
local function init()<br />
-- Cria um SVG contendo um círculo, usando os dados XML brutos acima<br />
myCircleSvg = svgCreate(500, 500, rawSvgData)<br />
addEventHandler("onClientRender", root, drawCircleSvg)<br />
end<br />
addEventHandler("onClientResourceStart", resourceRoot, init)<br />
</syntaxhighlight><br />
<br />
Aqui está outro exemplo mais aprofundado que utiliza o argumento de retorno de chamada. Você pode usar a tecla F2 para definir o SVG para um tamanho aleatório e ver o retorno de chamada de atualização gerar uma mensagem no debugscript.<br />
<br />
<syntaxhighlight lang="lua"><br />
-- Isso também pode ser um arquivo, com o caminho fornecido para svgCreate<br />
local rawSvgData = [[<br />
<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><br />
<circle cx="250" cy="250" r="250" fill="#0fc0fc" /><br />
</svg><br />
]]<br />
<br />
local svgs = {}<br />
<br />
local function render(svg)<br />
if (not isElement(svg)) or (getElementType(svg) ~= "svg") then<br />
removeEventHandler("onClientRender", root, svgs[svg].handler)<br />
svgs[svg] = nil<br />
end<br />
<br />
local width, height = svgGetSize(svg)<br />
dxDrawImage(0, 0, width, height, svg, 0, 0, 0, tocolor(255, 255, 255), false)<br />
end<br />
<br />
local function onUpdate(svg)<br />
-- Se esta for a primeira atualização, adicione svg à nossa tabela e comece a desenhá-la<br />
if (not svgs[svg]) then<br />
svgs[svg] = {<br />
state = true,<br />
handler = function()<br />
render(svg)<br />
end<br />
}<br />
<br />
addEventHandler("onClientRender", root, svgs[svg].handler)<br />
end<br />
<br />
iprint("Textura SVG atualizada.", svg, getTickCount())<br />
end<br />
<br />
local function init()<br />
-- Cria um SVG contendo um círculo, usando os dados XML brutos acima<br />
local mySvg = svgCreate(500, 500, rawSvgData, onUpdate)<br />
<br />
-- Vincule uma chave para criar um nó filho SVG rect, que acionará o retorno de chamada onUpdate<br />
bindKey("F2", "down", function()<br />
addSVGRectNode(mySvg)<br />
end)<br />
end<br />
addEventHandler("onClientResourceStart", resourceRoot, init)<br />
<br />
-- Adiciona um nó reto ao SVG com cor, tamanho e posição aleatórios<br />
function addSVGRectNode(svg)<br />
-- Obter o documento XML do nosso SVG<br />
local svgXML = svgGetDocumentXML(svg)<br />
<br />
-- Adicione um nó SVG reto, posicionado no centro do documento<br />
local rect = xmlCreateChild(svgXML, "rect")<br />
<br />
local size = math.random(0, 50)<br />
local r, g, b = math.random(10, 99), math.random(10, 99), math.random(10, 99)<br />
<br />
xmlNodeSetAttribute(rect, "x", (size / 2) .. "%")<br />
xmlNodeSetAttribute(rect, "y", (size / 2) .. "%")<br />
xmlNodeSetAttribute(rect, "width", size .. "%")<br />
xmlNodeSetAttribute(rect, "height", size .. "%")<br />
xmlNodeSetAttribute(rect, "fill", "#" .. r .. g .. b)<br />
<br />
-- Aplique nosso XML ao SVG e comece a desenhar via callback<br />
svgSetDocumentXML(svg, svgXML)<br />
end<br />
</syntaxhighlight><br />
<br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.8-9.20979|}}<br />
<br />
==Veja também==<br />
{{PT-BR/SVG functions}}<br />
<br />
[[en:svgCreate]]</div>LordHenry