https://wiki.multitheftauto.com/api.php?action=feedcontributions&user=Pawelo&feedformat=atomMulti Theft Auto: Wiki - User contributions [en]2024-03-29T09:30:29ZUser contributionsMediaWiki 1.39.3https://wiki.multitheftauto.com/index.php?title=GuiCreateRadioButton&diff=72020GuiCreateRadioButton2021-09-06T19:33:13Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>__NOTOC__<br />
{{Client function}}<br />
This function creates a [[Element/GUI/Radio button|radio button]].<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
element guiCreateRadioButton ( float x, float y, float width, float height, string text, bool relative, [element parent = nil] )<br />
</syntaxhighlight> <br />
{{OOP||[[Element/GUI/Radio button|GuiRadioButton]]}}<br />
<br />
===Required Arguments=== <br />
[[Image:gui-radiobutton.png|frame|Example GUI radio buttons.]]<br />
*'''x:''' A float of the 2D x position of the radio button on a player's screen. This is affected by the ''relative'' argument.<br />
*'''y:''' A float of the 2D y position of the radio button on a player's screen. This is affected by the ''relative'' argument.<br />
*'''width:''' A float of the width of the text field next to the radio button. This is affected by the ''relative'' argument.<br />
*'''height:''' A float of the height of the text field next to the radio button. This is affected by the ''relative'' argument.<br />
*'''text:''' The text to be displayed next to the radio button.<br />
*'''relative:''' This is whether sizes and positioning are relative. If this is ''true'', then all x,y,width,height floats must be between 0 and 1, representing measures relative to the parent.<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''parent:''' This is the parent that the radio button is attached to. If the ''relative'' argument is true, sizes and positioning will be made relative to this parent. If the ''relative'' argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning.<br />
''NOTE:'' All radio buttons become grouped together with their parent item. Only ONE radio button per group/parent will be able to be selected at the same time.<br />
<br />
===Returns===<br />
Returns [[element]] of the radio button if it was created succesfully, ''false'' otherwise.<br />
<br />
==Example==<br />
This example creates a radio button then checks if one is selected and if it is, then it's output the title and sets the next radio button selected. (TESTED!)<br />
<syntaxhighlight lang="lua">hi = guiCreateRadioButton(243,204,36,16,"Hi",false)<br />
guiRadioButtonSetSelected(hi,true)<br />
bye = guiCreateRadioButton(243,224,41,16,"Bye",false)<br />
<br />
if(guiRadioButtonGetSelected(hi))then<br />
outputChatBox("Hi "..getPlayerName(localPlayer))<br />
guiRadioButtonSetSelected(bye,true)<br />
else<br />
outputChatBox("Bye "..getPlayerName(localPlayer))<br />
guiRadioButtonSetSelected(hi,true)<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiRadioButtonSetSelected&diff=72019GuiRadioButtonSetSelected2021-09-06T19:31:27Z<p>Pawelo: typo</p>
<hr />
<div>{{Client function}}<br />
__NOTOC__<br />
This function selects or unselects a radio button.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool guiRadioButtonSetSelected ( element guiRadioButton, bool state )<br />
</syntaxhighlight> <br />
{{OOP||[[Element/GUI/Radio button|GuiRadioButton]]:setSelected|selected|guiRadioButtonGetSelected}}<br />
<br />
===Required Arguments=== <br />
*'''guiRadioButton:''' The GUI radio button in which you wish to change the selection state of<br />
*'''state:''' The state of the radio button, where ''true'' indicates selected, and ''false'' indicates unselected.<br />
<br />
===Returns===<br />
Returns ''true'' if the radio button's selection state was successfully set, ''false'' otherwise.<br />
<br />
==Example==<br />
This example creates a radio button then checks if one is selected and if it is, then it's output the title and sets the next radio button selected. (TESTED!)<br />
<syntaxhighlight lang="lua">hi = guiCreateRadioButton(243,204,36,16,"Hi",false)<br />
guiRadioButtonSetSelected(hi,true)<br />
bye = guiCreateRadioButton(243,224,41,16,"Bye",false)<br />
<br />
if(guiRadioButtonGetSelected(hi))then<br />
outputChatBox("Hi "..getPlayerName(localPlayer))<br />
guiRadioButtonSetSelected(bye,true)<br />
else<br />
outputChatBox("Bye "..getPlayerName(localPlayer))<br />
guiRadioButtonSetSelected(hi,true)<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiRadioButtonSetSelected&diff=72018GuiRadioButtonSetSelected2021-09-06T19:31:11Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>{{Client function}}<br />
__NOTOC__<br />
This function selects or unselects a radio button.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool guiRadioButtonSetSelected ( element guiRadioButton, bool state )<br />
</syntaxhighlight> <br />
{{OOP||[[Element/GUI/Radio button|GuiRadioButton]]:setSelected|selected|guiRadioButtongetSelected}}<br />
<br />
===Required Arguments=== <br />
*'''guiRadioButton:''' The GUI radio button in which you wish to change the selection state of<br />
*'''state:''' The state of the radio button, where ''true'' indicates selected, and ''false'' indicates unselected.<br />
<br />
===Returns===<br />
Returns ''true'' if the radio button's selection state was successfully set, ''false'' otherwise.<br />
<br />
==Example==<br />
This example creates a radio button then checks if one is selected and if it is, then it's output the title and sets the next radio button selected. (TESTED!)<br />
<syntaxhighlight lang="lua">hi = guiCreateRadioButton(243,204,36,16,"Hi",false)<br />
guiRadioButtonSetSelected(hi,true)<br />
bye = guiCreateRadioButton(243,224,41,16,"Bye",false)<br />
<br />
if(guiRadioButtonGetSelected(hi))then<br />
outputChatBox("Hi "..getPlayerName(localPlayer))<br />
guiRadioButtonSetSelected(bye,true)<br />
else<br />
outputChatBox("Bye "..getPlayerName(localPlayer))<br />
guiRadioButtonSetSelected(hi,true)<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiRadioButtonGetSelected&diff=72017GuiRadioButtonGetSelected2021-09-06T19:30:49Z<p>Pawelo: </p>
<hr />
<div>{{Client function}}<br />
__NOTOC__ <br />
This function gets a radio button's selection state.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool guiRadioButtonGetSelected( element guiRadioButton )<br />
</syntaxhighlight> <br />
{{OOP||[[Element/GUI/Radio button|GuiRadioButton]]:getSelected|selected|guiRadioButtonSetSelected}}<br />
<br />
===Required Arguments=== <br />
*'''guiRadioButton:''' The radio button you wish to retrieve the selection state of.<br />
<br />
===Returns===<br />
Returns ''true'' if the radio button is selected, ''false'' if it is not.<br />
<br />
==Example==<br />
This example creates a radio button then checks if one is selected and if it is, then it's output the title and sets the next radio button selected. (TESTED!)<br />
<syntaxhighlight lang="lua">hi = guiCreateRadioButton(243,204,36,16,"Hi",false)<br />
guiRadioButtonSetSelected(hi,true)<br />
bye = guiCreateRadioButton(243,224,41,16,"Bye",false)<br />
<br />
if(guiRadioButtonGetSelected(hi))then<br />
outputChatBox("Hi "..getPlayerName(localPlayer))<br />
guiRadioButtonSetSelected(bye,true)<br />
else<br />
outputChatBox("Bye "..getPlayerName(localPlayer))<br />
guiRadioButtonSetSelected(hi,true)<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=71767Template:Useful Functions2021-08-17T09:18:01Z<p>Pawelo: /* GUI functions */</p>
<hr />
<div>__NOTOC__<br />
=== Table functions ===<br />
*[[isValueInTable]] <span style="color:gray; font-family:'Georgia',sans-serif; 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 />
*[[setTableToSql]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function is used to save the table in the database (sql).</span><br />
*[[getTableFromSql]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This functionality is used to obtain saved tables using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql ]).</span><br />
*[[rangeToTable]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function converts a string range to a table containing number values.</span><br />
*[[setTableProtected]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function protects a table and makes it read-only.</span><br />
*[[Sort_Functions]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» These functions are able to sort your tables by a key.</span><br />
*[[table.compare]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks whether two given tables are equal.</span><br />
*[[table.copy]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function copies a whole table and all the tables in that table.</span><br />
*[[table.empty]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks whether a table is empty.</span><br />
*[[table.map]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function merges two or more tables together.</span><br />
*[[table.deepmerge]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function deep merges two tables. Every nested table will be correspondingly merged.</span><br />
*[[table.random]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function retrieves a random value from a table.</span><br />
*[[table.removeValue]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function removes a specified value from a table.</span><br />
*[[table.size]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the absolute size of a table.</span><br />
*[[table.getRandomRows]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns random rows from table.</span><br />
*[[table.element]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a new table with only userdata content.</span><br />
*[[pairsByKeys]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function sort pairs table.</span><br />
*[[addTableChangeHandler]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function monitors the changes of a table.</span><br />
<br />
=== ACL functions ===<br />
*[[aclGroupClone]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function clone a group to another group with/without ACLs and/or objects.</span><br />
*[[getPlayersInACLGroup]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns all players in an ACL group.</span><br />
*[[getPlayerAcls]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a table of all ACL groups on a player.</span><br />
*[[isPlayerInACL]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a player element is in an ACL group.</span><br />
*[[renameAclGroup]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function gives an existing ACL group a new name.</span><br />
*[[getAccountsRanks]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function is used to detect the account name groups and put them in the chat.</span><br />
<br />
=== Account functions ===<br />
*[[getPlayerFromAccountName]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function allows you to create a cinematic camera flight.<br />
<br />
=== Cursor functions ===<br />
*[[getCursorMovedOn]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function draws an animated 2D window on the screen.</span><br />
*[[dxDrawBorderedRectangle]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This is a function that will create a bordered rectangle.</span><br />
*[[dxDrawBorderedText]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This is a function that will create a bordered text.</span><br />
*[[dxDrawDashedLine]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function draws a line with dashes.</span><br />
*[[dxDrawRing]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function draws a ring with dx lines.</span><br />
*[[dxDrawTextOnRectangle]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Esta funcion crea un rectangle con un texto dentro.</span><br />
*[[dxDrawGifImage]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function draws a 3D image in GTA world.</span><br />
*[[dxDrawSprite]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function draw a sprite in the 3D world.</span><br />
*[[dxDrawImageOnElement]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function draws an image on any element.</span><br />
*[[dxDrawLinedRectangle]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This is a function that will create a rectangle outline with dx lines.</span><br />
*[[dxDrawLoading]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function draws a loading bar on the screen.</span><br />
*[[dxDrawOctagon3D]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function creates a 3D Octagon</span><br />
*[[dxDrawPolygon]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function draws a custom polygon on the screen.</span><br />
*[[dxDrawRectangle3D]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function draws a 3D rectangle in GTA world.</span><br />
*[[dxDrawProgressBar]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function simulates a progress bar drawed using DirectDraw.</span><br />
*[[dxDrawTextOnElement]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function draws a text on any element.</span><br />
*[[dxDrawTriangle]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This is a function that will create a triangle with dx lines.</span><br />
*[[dxGetFontSizeFromHeight]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function calculates the font size from given height.</span><br />
*[[dxGetRealFontHeight]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function calculates the height of a font.</span><br />
*[[wordWrap]] <span style="color:gray; font-family:'Georgia',sans-serif; 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 />
*[[dxDrawRombo]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function creates a Rhombus.</span><br />
*[[getScreenStartPositionFromBox]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function helps with getting the correct position for your dx-effects.</span><br />
<br />
=== Effects functions ===<br />
*[[attachEffect]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function allows you attach an effect to an element.</span><br />
<br />
=== Element functions === <br />
*[[getElementSpeed]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the specified element's speed in m/s, km/h or mph.</span><br />
*[[getElementsInDimension]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a table of elements that are in the specified dimension.</span><br />
*[[getElementsWithinMarker]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the nearest element (of a specific type) to a player.</span><br />
*[[isElementInPhotograph]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if an element is moving.</span><br />
*[[isElementWithinAColShape]]<span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if an element is within a collision shape element.</span><br />
*[[multi_check]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks one element to many, handy and clean.</span><br />
*[[setElementSpeed]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function allows you to set the speed of an element in kph or mph units.</span><br />
*[[attachElementToBone]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function allows you to attach an element to ped bone accurately using new bone functions.</span><br />
<br />
=== Events ===<br />
*[[onVehicleWeaponFire]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function allows you to unbind each key bound to a control individually. Use this function with [[bindControlKeys]].</span><br />
*[[getClipboard]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This event returns the contents of the clipboard by pressing ctrl + v / ctrl + V. Event triggered ONLY if cursor is showing.</span><br />
<br />
=== Data functions === <br />
*[[convertDate]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function converts date to another look.</span><br />
*[[byte2human]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function converts an integer (number of bytes) into a human-readable unit.</span><br />
*[[capitalize]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function capitalizes a given string.</span><br />
*[[convertServerTickToTimeStamp]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function converts server ticks to a unix timestamp.</span><br />
*[[convertTextToSpeech]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function converts the provided text to a speech in the provided language which players can hear.</span><br />
*[[findRotation]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function takes two points and returns the direction from point A to point B.</span><br />
*[[findRotation3D]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function takes two sets of XYZ coordinates. It returns the 3D direction from point A to point B.</span><br />
*[[formatDate]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function formats large numbers by adding commas.</span><br />
*[[generateString]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function generates a random string with any characters.</span><br />
*[[generateRandomASCIIString]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a random string which uses ASCII characters. </span><br />
*[[getDistance]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Returns the distance between two elements.</span><br />
*[[getAge]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function calculates the age of a given birthday.</span><br />
*[[getDistanceBetweenPointAndSegment2D]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function returns easter date monthday and month for a given year.</span><br />
*[[getKeyFromValueInTable]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the key of the specified value in a table.</span><br />
*[[getOffsetFromXYZ]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function finds a point based on a starting point, direction and distance.</span><br />
*[[getRealMonth]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a screen relative rotation to a world position.</span><br />
*[[getTimestamp]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the UNIX timestamp of a specified date and time.</span><br />
*[[gradientString]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function transforms a string in a new coloured gradient string.</span><br />
*[[isLeapYear]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function checks whether a provided e-mail string is valid.</span><br />
*[[removeHex]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function is used to remove hexadecimal numbers (colors, for example) from strings.<br />
*[[RGBToHex]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a string representing the color in hexadecimal.</span><br />
*[[secondsToTimeDesc]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function counts the amount of occurences of a string in a string.</span><br />
*[[string.insert]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function inserts a string within another string at a given position.</span><br />
*[[string.explode]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function splits a string at a given separator pattern and returns a table with the pieces.</span><br />
*[[switch]] <span style="color:gray; font-family:'Georgia',sans-serif; 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 />
*[[toHex]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function outputs information about one or more variables using outputConsole.</span><br />
*[[wavelengthToRGBA]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function converts a physical wavelength of light to a RGBA color.</span><br />
*[[getDistanceBetweenElements]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Esta funcion sirve para obtener la distancia entre dos elementos.</span><br />
*[[getFreeDimension]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function get free dimension.</span><br />
*[[hex2rgb]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function convert hex to rgb.</span><br />
*[[tocolor2rgba]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function convert tocolor to rgba.</span><br />
<br />
=== GUI functions === <br />
*[[centerWindow]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function centers a CEGUI window element responsively in any resolution.</span><br />
*[[guiMoveElement]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function moves guiElement by/like using moveObject.</span><br />
*[[isMouseOnGUICloseButton]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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 />
*[[guiSetStaticImageMovable]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function allows you to move a static image like a gui window.</span><br />
=====Comboboxes=====<br />
*[[guiComboBoxAdjustHeight]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function adjusts a CEGUI combobox element to have the correct height.</span><br />
<br />
=====Gridlists=====<br />
*[[guiGridListAddPlayers]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function add all online players to a grid list.</span><br />
*[[guiGridListGetColumnIDFromTitle]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function gets a gridlist's column ID from the column title.</span><br />
*[[guiGridListSetColumnNonSortable]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function makes a gridlist column become non-sortable.</span><br />
*[[guiGridListSetColumnsFixedWidth]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function makes a gridlist have all its columns fixed width.</span><br />
*[[guiGridListGetSelectedText]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a string containing the inner text of a selected gridlist item.</span><br />
*[[getGridListRowIndexFromText]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the GridList row index from the specified text.</span><br />
*[[isTextInGridList]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if some text exist or not in the GridList.</span><br />
*[[convertGridListToText]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function converts grid list contents to text.</span><br />
<br />
=====Labels=====<br />
*[[guiLabelAddEffect]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function creates a marker that is attached to an element.</span><br />
<br />
=== Math functions ===<br />
*[[mathNumber]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function is a workaround for the client-side floating-point precision of 24-bits.</span><br />
*[[math.hypot]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the Hypotenuse of the triangle given by sides x and y.</span><br />
*[[math.percent]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a percentage from two number values.</span><br />
*[[math.round]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Rounds a number whereas the number of decimals to keep and the method may be set.</span><br />
*[[reMap]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Re-maps a number from one range to another.</span><br />
*[[math.isPointInPolygon]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Check if point is inside polygon or not.</span><br />
*[[math.polygonArea]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Compute area of any polygon.</span><br />
*[[math.randomDiff]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Generates a pseudo-random integer that's always different from the last random number generated.</span><br />
*[[math.lerp]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Get val between two integer.</span><br />
*[[math.getBezierPoint]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Get N-th order bezier point.</span><br />
<br />
=== Map functions ===<br />
*[[assignLod]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a table of the alive players client-side.</span><br />
*[[getAlivePlayersInTeam]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a table of the alive players in a team.</span><br />
*[[getPlayersInVehicles]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a table of the players insides vehicles from a specified dimension.</span><br />
*[[getGuestPlayers]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function gets a players not login or players Guest .</span><br />
*[[getOnlineAdmins]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a table of all logged-in administrators.</span><br />
*[[getPedEyesPosition]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function allows you to get peds eyes position.</span><br />
*[[getPedMaxHealth]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a ped's corresponding weapon skill level name.</span><br />
*[[getPlayerFromNamePart]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a player from partial name.</span><br />
*[[getPlayerFromSerial]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a player from their serial.</span><br />
*[[getPlayersByData]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a table of players that have the specified data name.</span><br />
*[[getPlayersInPhotograph]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a table of all players in photograph.</span><br />
*[[isPedAiming]]<span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a pedestrian is aiming their weapon.</span><br />
*[[isPedAimingNearPed]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This is similar to isPedAiming but uses a colshape to be more precise.</span><br />
*[[isPedDrivingVehicle]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a specified pedestrian is driving a vehicle.</span><br />
*[[isPedDiving]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This feature checks that pedestrian is diving in the water.</span><br />
*[[isPlayerInTeam]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a player is in a specified team.</span><br />
<br />
=== Player functions ===<br />
*[[countPlayersInRange]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the number of players that are within a certain range of the specified coordinates.</span><br />
*[[isPlayerHitByVehicle]]<span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function cancels event when a element is hit by a vehicle.</span><br />
*[[warpToPlayer]]<span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function make player warp to another player.</span><br />
*[[getPlayersInRange]]<span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function make a table of players within certain range.</span><br />
*[[getPlayerPreviousAndNextWeapon]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the player previous and next weapon.</span><br />
<br />
=== Resource functions ===<br />
*[[getResourceScripts]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a table of the resource scripts.</span><br />
*[[getResourceSize]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the size of a specified resource in kB(kilobyte)</span><br />
*[[getResourceSettings]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a table of the resource settings.</span><br />
*[[refreshResource]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function refreshes your resource if you changed any of the files<br />
*[[setResourcePriority]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function set resource download priority group.</span><br />
*[[getFilesInResourceFolder]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function gets a list of files that are inside a folder of a resource.</span><br />
<br />
=== Sound functions ===<br />
*[[isSoundFinished]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a sound element has finished.</span><br />
*[[isSoundPlaying]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a sound element is playing or not.</span><br />
*[[stopSoundSlowly]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function stop your sound element slowly.</span><br />
<br />
=== Browser functions ===<br />
*[[playVideo]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function plays a video on the screen.</span><br />
<br />
=== Team functions ===<br />
*[[getTeamFromColor]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a team element by the specified color.</span><br />
*[[getTeamWithFewestPlayers]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function finds you the first empty seat in a vehicle.</span><br />
*[[getNearestVehicle]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function gets a random vehicle.</span><br />
*[[getValidVehicleModels]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns a table of all valid vehicle models.</span><br />
*[[getVehiclesCountByType]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the amount of vehicles by the given type as an integer value.</span><br />
*[[isVehicleEmpty]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks whether a vehicle is empty.</span><br />
*[[isVehicleOccupied]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a specified vehicle is occupied.</span><br />
*[[isVehicleOnRoof]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks whether vehicle is on roof.</span><br />
*[[isVehicleReversing]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a specified vehicle is moving backwards.</span><br />
*[[isVehicleUpgraded]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks is vehicle upgraded by upgrade ID.</span><br />
*[[isVehicleDoubleExhaust]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks is exhaust vehicle double.</span><br />
*[[setVehicleGravityPoint]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.</span><br />
*[[getVehicleTurnVelocityCenterOfMass]]<span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function gets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
*[[setVehicleTurnVelocityCenterOfMass]]<span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function sets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
<br />
=== Weapon functions === <br />
*[[getJetpackWeaponsEnabled]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function tells you how open a dynamic door is in a range from 0 to 1.</span><br />
<br />
=== XML functions ===<br />
*[[getXMLNodes]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns all children of a XML node.</span><br />
<br />
=== Engine functions ===<br />
*[[engineGetCOLsFromLibrary]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function gets the collision data from the col library.</span><br />
*[[engineLoadIMGContainer]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function loads the IMG container.</span><br />
<br />
=== Utility ===<br />
*[[animate]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function allows you to use interpolateBetween without render event and easily used.</span><br />
*[[callClientFunction]] <span style="color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;">» This function applies a fix for hidden coroutine error messages.</span><br />
*[[getBanFromName]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This functions returns the ban of the given playername.</span><br />
*[[getCurrentFPS]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the frames per second at which GTA: SA is running.</span><br />
*[[IfElse]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns one of two values based on a boolean expression.</span><br />
*[[isMouseInCircle]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a cursor position is in circular area or not.</span><br />
*[[isMouseInPosition]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function allows you to check whether the mouse cursor/pointer is within a rectangular position.</span><br />
*[[isCharInString]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This shared function allows you to check if a char specified is in a string value.</span><br />
*[[iterElements]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns ''a time-saving'' iterator for your for-loops.</span><br />
*[[vector3:compare]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This method checks whether two vectors match, with optional precision.</span><br />
*[[preprocessor]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function allow you to use gcc macros.</span><br />
*[[PlotTrajectoryAtTime]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Calculate projectile/water trajectory.</span><br />
*[[getSkinNameFromID]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the name of the skin from the given id.</span><br />
<br />
<noinclude>[[Category:Useful Functions]]</noinclude></div>Pawelohttps://wiki.multitheftauto.com/index.php?title=IsMouseOnGuiElement&diff=71766IsMouseOnGuiElement2021-08-17T09:16:56Z<p>Pawelo: Move page to useful functions</p>
<hr />
<div>__NOTOC__ <br />
{{Useful Function}}<br />
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.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
element isMouseOnGuiElement (element guiElement, element guiElementParent)<br />
</syntaxhighlight> <br />
<br />
==Code==<br />
<section name="Function source" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
function isMouseOnGuiElement(guiElement,guiElementParent)<br />
if isCursorShowing() then<br />
local sx,sy = guiGetScreenSize()<br />
local x,y = getCursorPosition()<br />
local wx,wy = 0,0<br />
x,y = x*sx, y*sy<br />
if guiElementParent then<br />
wx,wy = guiGetPosition(guiElementParent,false)<br />
end<br />
local bx,by = guiGetPosition(guiElement,false)<br />
local ex,ey = guiGetSize(guiElement,false)<br />
if x >= wx+bx and x <= wx+bx+ex and y >= wy+by and y <= wy+by+ey then<br />
return true<br />
end<br />
return false<br />
end<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
===Required Arguments=== <br />
*'''guiElement:''' The GUI element you want to check if the mouse is over it.<br />
*'''guiElementParent:''' The parent element of the element you want to check.<br />
<br />
===Returns===<br />
Returns true if the mouse is over the element, otherwise it returns false.<br />
<br />
==Example== <br />
<br />
<section name="Clientside example" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
local window = guiCreateWindow(500,500,200,200,"Test",false)<br />
local image = guiCreateStaticImage(25,25,50,50,"image.png",false,window)<br />
<br />
addEventHandler("onClientRender",root,function()<br />
if isMouseOnGuiElement(image,window) then<br />
guiStaticImageLoadImage(image,"image2.png")<br />
else<br />
guiStaticImageLoadImage(image,"image.png")<br />
end<br />
end)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=ToggleObjectRespawn&diff=71765ToggleObjectRespawn2021-08-17T07:23:47Z<p>Pawelo: Fix oop def</p>
<hr />
<div>__NOTOC__<br />
{{Client function}}<br />
<br />
{{New feature/item|3.0132|1.3.2|5170|<br />
This function is used to toggle if an object should respawn after it got destroyed<br />
}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool toggleObjectRespawn ( object theObject, bool respawn )<br />
</syntaxhighlight><br />
{{OOP||[[object]]:toggleRespawn}}<br />
===Required Arguments===<br />
*'''theObject''': the object you want to toggle the respawn from<br />
*'''respawn ''': a bool denoting whether we want to enable (''true'') or disable (''false'') respawning<br />
<br />
===Returns===<br />
* ''true'' when the it was changed successfully.<br />
* ''false'' otherwise.<br />
<br />
==Example==<br />
This example adds command ''tos'' that toggles respawn of all the objects.<br />
<syntaxhighlight lang="lua"><br />
local respawn = false<br />
addCommandHandler("tos",<br />
function ()<br />
for i, object in pairs(getElementsByType("object")) do<br />
toggleObjectRespawn(object, not respawn)<br />
end<br />
outputChatBox("Object respawning " .. (respawn and "disabled" or "enabled"))<br />
respawn = not respawn<br />
end)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Client_object_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=IsObjectMoving&diff=71764IsObjectMoving2021-08-17T07:23:05Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>__NOTOC__ <br />
{{Client function}}<br />
{{New feature/item|3.0159|1.5.8|20811|This function checks if an object is moving.}}<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua">bool isObjectMoving ( object theObject )</syntaxhighlight><br />
{{OOP||[[object]]:isMoving|moving}}<br />
===Required Arguments=== <br />
*'''theObject:''' The [[object]]<br />
===Returns===<br />
* ''true'' if the object is moving.<br />
* ''false'' if the object is not moving.<br />
<br />
==Example==<br />
This example creates an object when the resource starts and checks if the object is moving.<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onClientResourceStart", resourceRoot,<br />
function()<br />
local x, y, z = getElementPosition(localPlayer)<br />
object = createObject(1239, x, y, z)<br />
<br />
moveObject(object, 5000, x, y, z + 5)<br />
end<br />
)<br />
<br />
addCommandHandler("getmoving",<br />
function(cmd)<br />
outputChatBox("Is object "..(isObjectMoving(object) and "moving" or "not moving"))<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.8-9.20811|}}<br />
<br />
==See Also==<br />
{{Client_object_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GetThisResource&diff=71649GetThisResource2021-08-10T15:29:23Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>{{Server client function}}<br />
__NOTOC__<br />
This function retrieves the resource from which the function call was made.<br />
{{Note| Every resource has a predefined global variable called ''resource'' that contains the resource pointer for that resource, in other words, the value that this function returns.}}<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
resource getThisResource ( )<br />
</syntaxhighlight><br />
{{OOP|This function is a static function underneath the Resource class.|[[Resource]].getThis}}<br />
<br />
===Returns===<br />
Returns the resource in which the current script is.<br />
<br />
==Example==<br />
This example retrieves the current resource's root element and attaches it to an onResourceStart event handler. This causes the event handler to get called only when the ''current'' resource is started rather than when ''any'' resource is started, thereby reducing unnecessary overhead.<br />
<syntaxhighlight lang="lua"><br />
-- get the root element of this resource (the resource that the script is a part of)<br />
resourceRoot = getResourceRootElement(getThisResource()) <br />
--getThisResource() is the same thing as MTA's secret global variable <br />
--"resource" as explained in the note above. <br />
<br />
-- create a function to handle the command<br />
function onResourceCommand()<br />
local thisResource = getThisResource()<br />
local resourceName = getResourceName(thisResource)<br />
outputChatBox("You are in the " .. resourceName .. " resource!")<br />
end<br />
<br />
-- add the command handler<br />
addCommandHandler("what", onResourceCommand)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Resource_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiCreateMemo&diff=71648GuiCreateMemo2021-08-10T13:58:59Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>__NOTOC__ <br />
{{Client function}}<br />
This function creates a new GUI memo. This is a multiline edit box in which the user can input text.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
gui-memo guiCreateMemo ( float x, float y, float width, float height, string text, bool relative [, element parent = nil ] )<br />
</syntaxhighlight> <br />
{{OOP||[[GuiMemo]]}}<br />
<br />
===Required Arguments=== <br />
[[Image:Gui-memo.png|frame|Example GUI memo.]]<br />
*'''x:''' A float of the 2D x position of the GUI memo on a player's screen. This is affected by the ''relative'' argument.<br />
*'''y:''' A float of the 2D y position of the GUI memo on a player's screen. This is affected by the ''relative'' argument.<br />
*'''width:''' A float of the width of the GUI memo. This is affected by the ''relative'' argument.<br />
*'''height:''' A float of the height of the GUI memo. This is affected by the ''relative'' argument.<br />
*'''text:''' A string of the text that will be displayed by default in the memo.<br />
*'''relative:''' This is whether sizes and positioning are relative. If this is ''true'', then all x,y,width,height floats must be between 0 and 1, representing measures relative to the parent.<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''parent:''' This is the parent that the GUI memo is attached to. If the ''relative'' argument is true, sizes and positioning will be made relative to this parent. If the ''relative'' argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning.<br />
===Element Type===<br />
The Element Type of this element is gui-memo.<br />
===Returns===<br />
Returns a gui-memo element of the created memo if it was successfully created, false otherwise.<br />
<br />
==Example== <br />
{{Client functions}}<br />
<syntaxhighlight lang="lua"><br />
function cMemoFPlayer()<br />
Window = guiCreateWindow(0.3664,0.2764,0.3508,0.3477,"GUI Window",true)<br />
guiCreateMemo(17,79,414,246,"",false,Window)<br />
end<br />
addEventHandler("onClientResourceStart", resourceRoot, cMemoFPlayer)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiMemoGetVerticalScrollPosition&diff=71647GuiMemoGetVerticalScrollPosition2021-08-10T13:58:07Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>{{client function}}<br />
{{New feature/item|3.0156|1.5.5|13771|This function is used to get the vertical scroll position of a memo as a percentage.}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
float guiMemoGetVerticalScrollPosition ( gui-memo theMemo )<br />
</syntaxhighlight><br />
{{OOP||[[GuiMemo]]:getVerticalScrollPosition|verticalScrollPosition|guiMemoSetVerticalScrollPosition}}<br />
<br />
===Required Arguments===<br />
*'''theMemo''': the [[guiCreateMemo|memo]] you want to know the vertical scroll position of.<br />
<br />
===Returns===<br />
Returns a [[float]] ranging between 0 and 100, or '''false''' otherwise.<br />
<br />
==Example==<br />
This example gets the position of a memo called "theMemo" created with [[guiCreateMemo]], and outputs it to the chatbox.<br />
<syntaxhighlight lang="lua"><br />
local theMemo = guiCreateMemo( 0, 0, 200, 100, [[Insert<br />
some<br />
long<br />
text<br />
here]], false )<br />
<br />
if ( theMemo ) then<br />
local position = guiMemoGetVerticalScrollPosition( theMemo )<br />
outputChatBox( "Current scroll position of the memo: " .. position .. "%" )<br />
else<br />
outputChatBox( "Memo not found!" )<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiMemoSetVerticalScrollPosition&diff=71646GuiMemoSetVerticalScrollPosition2021-08-10T13:57:45Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>{{client function}}<br />
{{New feature/item|3.0156|1.5.5|13771|This function is used to set the vertical scroll position of a memo as a percentage.}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool guiMemoSetVerticalScrollPosition ( gui-memo theMemo, float position )<br />
</syntaxhighlight><br />
{{OOP||[[GuiMemo]]:setVerticalScrollPosition|verticalScrollPosition|guiMemoGetVerticalScrollPosition}}<br />
<br />
===Required Arguments===<br />
*'''theMemo''': the [[guiCreateMemo|memo]] you want to change the vertical scroll position of.<br />
*'''position''': a [[float]] ranging between 0 and 100.<br />
<br />
===Returns===<br />
Returns '''true''' if the position was set, '''false''' otherwise.<br />
<br />
==Example==<br />
This example sets the position of a memo called "theMemo" created with [[guiCreateMemo]], and outputs it to the chatbox.<br />
<syntaxhighlight lang="lua"><br />
local theMemo = guiCreateMemo( 0, 0, 200, 100, [[Insert<br />
some<br />
long<br />
text<br />
here]], false )<br />
<br />
if ( theMemo ) then<br />
guiMemoSetVerticalScrollPosition( theMemo, 33.3 ) -- A third from the top<br />
local position = guiMemoGetVerticalScrollPosition( theMemo )<br />
outputChatBox( "Current position of scroll pane: " .. position .. "%" )<br />
else<br />
outputChatBox( "Memo not found!" )<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiMemoIsReadOnly&diff=71645GuiMemoIsReadOnly2021-08-10T13:56:02Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>{{Client function}}<br />
__NOTOC__ <br />
{{New feature/item|3.0156|1.5.5|12419|This function checking if memo is read only or no.}}<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool guiMemoIsReadOnly ( gui-memo theMemo )<br />
</syntaxhighlight> <br />
{{OOP||[[GuiMemo]]:isReadOnly|readOnly|guiMemoSetReadOnly}}<br />
<br />
===Required Arguments=== <br />
*'''theMemo:''' The memo to check read-only status of.<br />
<br />
===Returns===<br />
Returns ''true'' if the memo is read only, ''false'' if the memo isn't read only, ''nil'' otherwise.<br />
<br />
==Example== <br />
{{Client function}}<br />
<syntaxhighlight lang="lua">addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), -- only execute the code when this resource restarts<br />
function( )<br />
memo = guiCreateMemo( 0.4, 0.4, 0.2, 0.2, "This is a memo.", true ) -- create a relative memo GUI element<br />
guiMemoSetReadOnly( memo, true ) -- make it read only, so players won't be able to edit it in-game<br />
addCommandHandler("isReadOnly",function() -- add a command 'isReadOnly'<br />
local isReadOnly = guiMemoIsReadOnly(memo)<br />
outputChatBox("Memo read only: "..isReadOnly) -- show info about memo<br />
end)<br />
end<br />
)</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiMemoSetCaretIndex&diff=71644GuiMemoSetCaretIndex2021-08-10T13:54:39Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>__NOTOC__ <br />
{{Client function}}<br />
This function sets the current position of the caret (the text cursor) within the memo.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool guiMemoSetCaretIndex ( gui-memo theMemo, int index )<br />
</syntaxhighlight> <br />
{{OOP||[[GuiMemo]]:setCaretIndex|caretIndex|guiMemoGetCaretIndex}}<br />
<br />
===Required Arguments=== <br />
*'''theMemo:''' The memo edit box where the caret position is to be changed.<br />
*'''index:''' An integer referring to the desired character position within the box. 0 would be before the first character in the box, 1 before the second, etc.<br />
<br />
===Returns===<br />
Returns ''true'' if the caret was successfully moved, ''false'' otherwise.<br />
<br />
==Example==<br />
This example would create a memo and set the caret before the "H" in "Hi".<br />
<syntaxhighlight lang="lua">local memo = guiCreateMemo(100,100,200,100,"Hi",false)<br />
guiMemoSetCaretIndex(memo,0)--sets the caret before H<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiMemoGetCaretIndex&diff=71643GuiMemoGetCaretIndex2021-08-10T13:54:19Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>{{Client function}}<br />
__NOTOC__<br />
{{New feature/item|3.0135|1.3.5|6054|<br />
This function returns the caret (the text cursor) position within the memo box.<br />
}}<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
int guiMemoGetCaretIndex ( element theElement )<br />
</syntaxhighlight> <br />
{{OOP||[[GuiMemo]]:getCaretIndex|caretIndex|guiMemoSetCaretIndex}}<br />
<br />
===Required Arguments=== <br />
*'''theElement:''' The memo box you want to get the caret position from<br />
<br />
===Returns===<br />
Returns the caret index on success, ''false'' otherwise.<br />
<br />
==Example==<br />
This example outputs the caret position of the memo to the chat<br />
<syntaxhighlight lang="lua"><br />
local memo = guiCreateMemo(0.4,0.1,0.3,0.3,"",true)<br />
<br />
addEventHandler("onClientGUIChanged",memo,function()<br />
outputChatBox("Caret index is: "..guiMemoGetCaretIndex(memo)) -- output index to chat<br />
end)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GetResourceName&diff=71642GetResourceName2021-08-10T13:53:46Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>{{Server client function}}<br />
__NOTOC__<br />
This function gets the name of the specified resource.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
string getResourceName ( resource res )<br />
</syntaxhighlight><br />
{{OOP||[[resource]]:getName|name|renameResource}}<br />
<br />
===Required Arguments=== <br />
*'''res:''' The resource you wish to get the name of.<br />
<br />
===Returns===<br />
Returns a string with the resource name in it, or ''false'' if the resource does not exist.<br />
<br />
==Example==<br />
<section class="server" name="Server" show="true"><br />
This simple example outputs a message in the console whenever a resource starts, stating the name of the resource.<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onResourceStart", getRootElement(),<br />
function(res)<br />
outputConsole("Resource " .. getResourceName(res) .. " just started.")<br />
end<br />
)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Resource functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GetResourceDynamicElementRoot&diff=71640GetResourceDynamicElementRoot2021-08-10T13:46:18Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>__NOTOC__ <br />
{{Server client function}}<br />
This function retrieves the ''dynamic element root'' of a specified [[resource]]. The ''dynamic element root'' is the parent of elements that are created by scripts (e.g. with [[createObject]]) unless they specify a different parent.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
element getResourceDynamicElementRoot ( resource theResource ) <br />
</syntaxhighlight> <br />
{{OOP||[[resource]]:getDynamicElementRoot|dynamicElementRoot}}<br />
<br />
===Required Arguments=== <br />
*'''theResource:''' the resource of which dynamic element root we want.<br />
<br />
===Returns===<br />
Returns an [[element]] of the resource's dynamic element root if the resource specified was valid and active (currently running), ''false'' otherwise.<br />
<br />
==Example==<br />
<br />
This example shows how to get all elements by specific type, created only by resource scripts (not maps).<br />
<syntaxhighlight lang="lua"><br />
-- We have some map files with many objects in our meta.xml.<br />
-- And we have some objects, created by some resource scripts.<br />
<br />
-- createObject(...) -- 1<br />
-- createObject(...) -- 2<br />
-- ...<br />
-- createObject(...) -- 20<br />
<br />
-- After resource start we must found all objects, created only<br />
-- by current resource scripts (not maps) and make them invisible.<br />
<br />
-- `resourceRoot` is predefined script variable containing current resource root pointer<br />
addEventHandler( 'onResourceStart', resourceRoot,<br />
function()<br />
-- `resource` is predefined script variable containing current resource pointer<br />
local thisResourceDynamicRoot = getResourceDynamicElementRoot(resource)<br />
local onlyScriptObjects = getElementsByType( 'object', thisResourceDynamicRoot )<br />
<br />
for scriptObject in ipairs(onlyScriptObjects) do<br />
setElementAlpha( scriptObject, 0 )<br />
end<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Resource_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GetResourceExportedFunctions&diff=71639GetResourceExportedFunctions2021-08-10T13:45:05Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>__NOTOC__<br />
{{Server client function}}<br />
Returns a table containing the names of the functions that a resource exports. It will return the exports of the current resource if there is no argument passed in.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
table getResourceExportedFunctions ( [ resource theResource = getThisResource( ) ] )<br />
</syntaxhighlight><br />
{{OOP||[[resource]]:getExportedFunctions|exportedFunctions}}<br />
<br />
===Optional Arguments===<br />
*'''theResource:''' the [[resource]] of which you want to know the [[call|exported functions]].<br />
<br />
===Returns===<br />
Returns a [[table]] of function names if successful, ''false'' otherwise.<br />
<br />
==Example==<br />
This simple example will output the names of the functions that the "scoreboard" resource exports.<br />
<syntaxhighlight lang="lua"><br />
local res = getResourceFromName ( "scoreboard" )<br />
if res then<br />
local functionNames = getResourceExportedFunctions ( res )<br />
outputConsole ( "The scoreboard resource exports " .. #functionNames .. " functions:" )<br />
for i, name in ipairs ( functionNames ) do<br />
outputConsole ( name )<br />
end<br />
else<br />
outputConsole ( "Unable to find the scoreboard resource." )<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Resource functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GetResourceLastStartTime&diff=71638GetResourceLastStartTime2021-08-10T13:44:33Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>__NOTOC__ <br />
{{server function}}<br />
Used to check the last starting time and date of a resource<br />
<br />
==Syntax== <br />
{{New feature/item|3|1.0|840|<br />
<syntaxhighlight lang="lua"><br />
int getResourceLastStartTime ( resource theResource )<br />
</syntaxhighlight><br />
}}<br />
{{Deprecated_feature|3|1.0|<br />
<syntaxhighlight lang="lua"><br />
string/number getResourceLastStartTime ( resource theResource )<br />
</syntaxhighlight><br />
}} <br />
{{OOP||[[resource]]:getLastStartTime|lastStartTime}}<br />
<br />
===Required Arguments=== <br />
*'''theResource:''' The resource of which you'd like to check the last starting time.<br />
<br />
===Returns===<br />
{{New feature/item|3|1.0|840|<br />
If successful, returns the UNIX timestamp when the resource was last started, or the string "never" if the resource has not been started yet, otherwise false. Use in conjunction with [[getRealTime]] in order to retrieve detailed information. <br />
<br />
}}<br />
{{Deprecated_feature|3|1.0|<br />
Returns a string with the time and date, or false if the resource does not exist.<br />
}}<br />
<br />
==Example== <br />
This function outputs to chatbox when the current resource was started.<br />
<syntaxhighlight lang="lua"><br />
function whenStarted()<br />
local startTime = getResourceLastStartTime ( getThisResource() ) --Get the time and date<br />
outputChatBox( "This resource was started on: " .. startTime ) --tell everybody when the current resource was started.<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Resource functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GetResourceACLRequests&diff=71637GetResourceACLRequests2021-08-10T13:42:15Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>__NOTOC__ <br />
{{server function}}<br />
This function retrieves the ACL request section from the meta.xml file of the given resource.<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
table getResourceACLRequests ( resource theResource ) <br />
</syntaxhighlight> <br />
{{OOP||[[resource]]:getACLRequests|aclRequests}}<br />
<br />
===Required Arguments=== <br />
*'''theResource:''' the resource to get the ACL requests for.<br />
<br />
===Returns===<br />
Returns a ''table'' with the ACL requests for the given resource, or ''false'' if the resource is not valid. A valid resource with no ACL requests will return an empty table.<br />
<br />
==Example==<br />
This function lists ACL requests from all resources in the client console.<br />
<syntaxhighlight lang="lua"><br />
function showAllACLRequests()<br />
for _,resource in ipairs(getResources()) do<br />
local requests = getResourceACLRequests (resource)<br />
if #requests > 0 then<br />
outputConsole( getResourceName(resource).." has "..#requests.." ACL request(s)" )<br />
for i,request in ipairs(requests) do<br />
outputConsole( tostring(i)<br />
.. " name:" .. request.name<br />
.. " access:" .. tostring(request.access)<br />
.. " pending:" .. tostring(request.pending)<br />
.. " who:" .. request.who<br />
.. " date:" .. request.date<br />
)<br />
end<br />
end<br />
end<br />
end<br />
</syntaxhighlight><br />
==Requirements==<br />
{{Requirements|1.2|n/a|}}<br />
==See Also==<br />
{{Resource_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GetResourceLoadTime&diff=71636GetResourceLoadTime2021-08-10T13:41:35Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>__NOTOC__<br />
{{Server function}}<br />
Gets the date and time at which a resource was last loaded in the server.<br />
<br />
==Syntax==<br />
{{New feature/item|3|1.0|840|<br />
<syntaxhighlight lang="lua"><br />
int getResourceLoadTime ( resource res )<br />
</syntaxhighlight><br />
}}<br />
{{Deprecated_feature|3|1.0|<br />
<syntaxhighlight lang="lua"><br />
string getResourceLoadTime ( resource res )<br />
</syntaxhighlight><br />
}}<br />
{{OOP||[[resource]]:getLoadTime|loadTime}}<br />
<br />
===Required Arguments===<br />
*'''res:''' the resource you want to know the load time of.<br />
<br />
===Returns===<br />
{{New feature|3|1.0 r840|<br />
If successful, returns the UNIX timestamp when the resource was loaded, otherwise false. Use in conjunction with [[getRealTime]] in order to retrieve detailed information. <br />
}}<br />
{{Deprecated_feature|3|1.0|<br />
If successful, returns a string with the date and time that the resource was last loaded into memory (for example when the server started, or when the resource was changed and reloaded). Returns ''false'' on failure.<br />
<br />
An example string is "Fri Mar 28 13:51:04 2008".<br />
}}<br />
<br />
==Example==<br />
This code outputs the date and time at which the scoreboard resource was last loaded.<br />
<syntaxhighlight lang="lua" class="server"><br />
local res = getResourceFromName ( "scoreboard" )<br />
if res then<br />
local time = getRealTime(getResourceLoadTime(res)) --Gets all the data we need from UNIX time format, see getRealTime() for more details<br />
outputConsole ( "scoreboard was last loaded on: " .. string.format("%i/%i/%i %i:%i:%i",time.monthday,time.month,time.year,time.hour,time.minute,time.second)) --this will be something like this: scoreboard was last loaded on: 10/07/2017 14:13:10<br />
end<br />
</syntaxhighlight><br />
This code outputs the date and time at which the specified resource started.<br />
<syntaxhighlight lang="lua" class="server"><br />
function getLoadTime(p,c,res)<br />
local resource = getResourceFromName(tostring(res))<br />
if not res or not resource then<br />
outputChatBox("Syntax: /" .. c .. " [Resource Name]")<br />
else<br />
local time = getRealTime(getRealTime().timestamp-getResourceLoadTime(resource))<br />
outputChatBox("The resource " .. res .. " started at " .. string.format("%i/%i/%i %i:%i:%i",time.monthday,time.month,time.year,time.hour,time.minute,time.second))<br />
end<br />
end<br />
addCommandHandler("getResourceLoadTime", getLoadTime, false,false) --adds the command handler<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Resource functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GetResourceLoadFailureReason&diff=71635GetResourceLoadFailureReason2021-08-10T13:39:47Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>{{Server function}}<br />
__NOTOC__<br />
This function retrieves the reason why a resource failed to start.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
string getResourceLoadFailureReason ( resource theResource )<br />
</syntaxhighlight> <br />
{{OOP||[[resource]]:getLoadFailureReason|loadFailureReason}}<br />
<br />
===Required Arguments=== <br />
*'''theResource:''' The resource you wish to check.<br />
<br />
===Returns===<br />
If the resource failed to load, returns a string with the failure reason in it. If it loaded successfully, returns an empty string. Returns ''false'' if the resource doesn't exist.<br />
<br />
==Example== <br />
<section name="Server" class="server" show="true"><br />
This example checks if there's a resource that failed to load, then outputs "Resource: 'resourceName' failed to load because 'reason'." .<br />
<syntaxhighlight lang="lua"><br />
for _,v in ipairs(getResources())do --loop through all the resources<br />
if getResourceState(v)=="failed to load" then --check if it failed to load<br />
outputChatBox("Resource: "..getResourceName(v).." failed to load because: "..getResourceLoadFailureReason(v)..".") --output why it didn't load<br />
end<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Resource functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=RenameResource&diff=71634RenameResource2021-08-10T13:37:47Z<p>Pawelo: Add missing OOP info</p>
<hr />
<div>__NOTOC__<br />
{{Server function}}<br />
This function renames a resource.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool renameResource ( string/resource theResource, string newResourceName, [ string organizationalPath ] )<br />
</syntaxhighlight> <br />
{{OOP||[[resource]]:rename|name|getResourceName}}<br />
===Required Arguments=== <br />
*'''theResource:''' The name of resource or the resource you want to rename.<br />
*'''newResourceName:''' The name of what the resource should be renamed to.<br />
<br />
===Optional Arguments===<br />
*'''organizationalPath:''' If you want to store the new resource inside a category.<br />
<br />
===Returns===<br />
Returns ''true'' if the resource has been renamed successfully, ''false'' otherwise. This could fail if the resource name already is in use, if a directory already exists with the name you've specified (but this isn't a valid resource) or if the name you specify isn't valid. It could also fail if the disk was full or for other similar reasons. Won't work on a started resource or if the resource is not loaded (not known by MTA (use /refresh))<br />
<br />
==Example==<br />
This example renames the resource "reload" to "reload2":<br />
<syntaxhighlight lang="lua">function renameReloadResource()<br />
renameResource("reload", "reload2");<br />
end<br />
addEventHandler("onResourceStart", resourceRoot, renameReloadResource);<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|1.1.1-9.03316|n/a|}}<br />
<br />
==See Also==<br />
{{Resource_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GetResourceOrganizationalPath&diff=71633GetResourceOrganizationalPath2021-08-10T13:12:09Z<p>Pawelo: add oop variable name</p>
<hr />
<div>{{Server function}}<br />
__NOTOC__<br />
This function returns the organizational file path (e.g. ''[admin]'') of a resource.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
string getResourceOrganizationalPath ( resource theResource )<br />
</syntaxhighlight> <br />
{{OOP||[[resource]]:getOrganizationalPath|organizationalPath }}<br />
<br />
===Required Arguments=== <br />
*'''theResource:''' the [[resource]] of which you want to know the organizational path<br />
<br />
===Returns===<br />
Returns the organizational folder name of the [[resource]]. It returns empty string if the resource is on root ''resources'' folder. It returns '''false''' if the resource could not be found.<br />
<br />
==Example==<br />
This example outputs the path of the current resource when it is started.<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onResourceStart", resourceRoot,<br />
function ()<br />
outputChatBox(getResourceName(resource) .. "'s path: " .. getResourceOrganizationalPath(resource))<br />
end)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Resource_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=DxDrawWiredSphere&diff=71560DxDrawWiredSphere2021-08-05T14:55:39Z<p>Pawelo: </p>
<hr />
<div>__NOTOC__ <br />
{{Client function}} <br />
This function drawn same sphere as /showcol. It provides 4 levels of iterations which mean density of sphere. Adjust radius to iterations to get optimum density of mesh. About 50 spheres with iterations = 4 can cause fps drop.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool dxDrawWiredSphere( float x, float y, float z, float radius, int theColor, float fLineWidth, uint iterations )<br />
</syntaxhighlight><br />
<br />
===Required Arguments=== <br />
* '''x, y, z:''' A position in world of sphere.<br />
* '''radius:''' A radius of sphere.<br />
* '''theColor:''' A color of sphere from tocolor function.<br />
* '''fLineWidth:''' A width of line<br />
* '''iterations :''' Number 1, 2, 3 or 4. 1 mean low density, 4 mean high.<br />
<br />
===Returns===<br />
Returns a ''true'' if the operation was successful, ''false'' otherwise.<br />
<br />
==Example== <br />
<syntaxhighlight lang="lua"><br />
local BONE_IDS = {1, 2, 3, 4, 5, 6, 7, 8, 21, 22, 23, 24, 25, 26, 31, 32, 33, 34, 35, 36, 41, 42, 43, 44, 51, 52, 53, 54}<br />
<br />
addEventHandler('onClientRender', root, function()<br />
for k, v in ipairs(BONE_IDS) do<br />
local x, y, z = getPedBonePosition(localPlayer, v)<br />
local color = tocolor(math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255))<br />
dxDrawWiredSphere(x, y, z, 0.1, color, 0.1, 4)<br />
end<br />
end)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.7-9.20328|}}<br />
<br />
==See Also==<br />
{{Drawing_functions}}<br />
[[dxDrawWiredSphere]]</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=EngineRequestModel&diff=71559EngineRequestModel2021-08-05T14:54:46Z<p>Pawelo: </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. After release 1.5.8-20716 this function supports "vehicle" and "object" too.}}<br />
{{note|IMPORTANT:<br />
*before release 1.5.8-20716 this must be "ped".<br />
}}<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
int engineRequestModel ( string elementType [, int parentID ] )<br />
</syntaxhighlight><br />
===Required Arguments===<br />
*'''elementType''': "ped", "vehicle" and "object".<br />
<br />
===Optional Arguments=== <br />
*'''parentID''': The [[Vehicle IDs|vehicle ID]] of the vehicle being allocated. '''(By default this is: 1337 - objects, 400 - vehicles, 7 or PSYCHO for peds)'''<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>Pawelohttps://wiki.multitheftauto.com/index.php?title=EngineGetModelTextureNames&diff=71558EngineGetModelTextureNames2021-08-05T13:33:03Z<p>Pawelo: The argument is not required</p>
<hr />
<div>{{Client function}}<br />
__NOTOC__<br />
This function returns a table of the world textures which are applied to the specified model.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
table engineGetModelTextureNames([string modelId = ""])<br />
</syntaxhighlight> <br />
{{OOP||Engine.getModelTextureNames}}<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''modelId :''' You can either use the model id or the model name.<br />
<br />
===Returns===<br />
Returns a table if this function succeeds, false if it fails for some reason.<br />
<br />
==Example==<br />
This example will output the texture names applied to the Comet.<br />
<syntaxhighlight lang="lua"><br />
for _,name in ipairs( engineGetModelTextureNames( "480" ) ) do<br />
outputConsole( name )<br />
end<br />
</syntaxhighlight><br />
<br />
The model name can also be used.<br />
<syntaxhighlight lang="lua"><br />
for _,name in ipairs( engineGetModelTextureNames( "Comet" ) ) do<br />
outputConsole( name )<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Engine_functions}}<br />
{{Drawing_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=BitReplace&diff=71557BitReplace2021-08-05T13:27:25Z<p>Pawelo: Mark optional params in syntax and add optional params section</p>
<hr />
<div>{{Server client function}}<br />
__NOTOC__<br />
{{New feature/item|3.0132|1.3.2|5340|<br />
This function returns the unsigned number formed by var value with replacement specified at bits field to field + width - 1<br />
}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
uint bitReplace(uint var, uint replaceValue, int field [, int width = 1])<br />
</syntaxhighlight><br />
<br />
===Required arguments===<br />
*'''var:''' The value<br />
*'''replaceValue:''' The replaceValue<br />
*'''field:''' The field number<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''width:''' Number of bits to extract<br />
<br />
===Returns===<br />
Returns the replaced value/bit sequence.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
function replaceColorAlpha(color, alpha)<br />
return bitReplace(color,alpha,24,8) -- return value with replaced bits 24-32 ( the alpha, http://en.wikipedia.org/wiki/RGBA_color_space ) <br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Bit_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=SetVehiclesLODDistance&diff=71556SetVehiclesLODDistance2021-08-05T13:26:34Z<p>Pawelo: </p>
<hr />
<div>{{Client function}}__NOTOC__<br />
{{New feature/item|3.0154|1.5.3|11199|<br />
Sets the distance of vehicles LOD.<br />
}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool setVehiclesLODDistance(float vehiclesDistance [, float trainsAndPlanesDistance = vehiclesDistance * 2.14])<br />
</syntaxhighlight><br />
<br />
===Required Arguments=== <br />
*'''vehiclesDistance:''' general distance used for most vehicles, this value is clamped to 0 – 500<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''trainsAndPlanesDistance:''' distance used for trains and planes, this value is clamped to 0 – 500<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onClientResourceStart",resourceRoot,function()<br />
setVehiclesLODDistance(10)<br />
end)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
* [[engineGetModelLODDistance]]<br />
* [[engineSetModelLODDistance]]<br />
{{Client world functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=SetVehiclesLODDistance&diff=71555SetVehiclesLODDistance2021-08-05T13:24:36Z<p>Pawelo: </p>
<hr />
<div>{{Client function}}__NOTOC__<br />
{{New feature/item|3.0154|1.5.3|11199|<br />
Sets the distance of vehicles LOD.<br />
}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool setVehiclesLODDistance(float vehiclesDistance [, float trainsAndPlanesDistance = vehiclesDistance * 2.14])<br />
</syntaxhighlight><br />
===Required Arguments=== <br />
*'''vehiclesDistance:''' general distance used for most vehicles, this value is clamped to 0 – 500<br />
===Optional Arguments===<br />
*'''trainsAndPlanesDistance:''' distance used for trains and planes, this value is clamped to 0 – 500<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onClientResourceStart",resourceRoot,function()<br />
setVehiclesLODDistance(10)<br />
end)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
* [[engineGetModelLODDistance]]<br />
* [[engineSetModelLODDistance]]<br />
{{Client world functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=SetVehiclesLODDistance&diff=71554SetVehiclesLODDistance2021-08-05T13:24:02Z<p>Pawelo: Mark optional params in syntax</p>
<hr />
<div>{{Client function}}__NOTOC__<br />
{{New feature/item|3.0154|1.5.3|11199|<br />
Sets the distance of vehicles LOD.<br />
}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool setVehiclesLODDistance(float vehiclesDistance [, float trainsAndPlanesDistance = vehiclesDistance * 2.14 ])<br />
</syntaxhighlight><br />
===Required Arguments=== <br />
*'''vehiclesDistance:''' general distance used for most vehicles, this value is clamped to 0 – 500<br />
===Optional Arguments===<br />
*'''trainsAndPlanesDistance:''' distance used for trains and planes, this value is clamped to 0 – 500<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onClientResourceStart",resourceRoot,function()<br />
setVehiclesLODDistance(10)<br />
end)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
* [[engineGetModelLODDistance]]<br />
* [[engineSetModelLODDistance]]<br />
{{Client world functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=IsPedHeadless&diff=71553IsPedHeadless2021-08-05T13:15:47Z<p>Pawelo: </p>
<hr />
<div>__NOTOC__<br />
{{Server client function}}<br />
With this function, you can check if a ped has a head or not.<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool isPedHeadless(ped thePed)<br />
</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''thePed''': The [[ped]] to check.<br />
<br />
===Returns===<br />
Returns ''true'' if the ped is headless, ''false'' otherwise.<br />
<br />
==Example==<br />
<section class="client" name="Client" show="true"><br />
Add a command to check whether the player is a zombie or not<br />
<syntaxhighlight lang="lua"><br />
function checkZombie(commandName)<br />
local player = getLocalPlayer()<br />
-- check whether the player is headless (a zombie)<br />
local message = isPedHeadless(player) and "Yes, you are a zombie!" or "No, you aren't a zombie yet!"<br />
outputChatBox(message)<br />
end<br />
<br />
addCommandHandler("zombie", checkZombie)<br />
</syntaxhighlight><br />
</section><br />
<section class="server" name="Server" show="true"><br />
Add a command to check whether a player is a zombie or not<br />
<syntaxhighlight lang="lua"><br />
function checkZombie(playerSource, commandName, playerTargetNick)<br />
local playerTarget = getPlayerFromName(playerTargetNick)<br />
if (not playerTarget) then return outputChatBox("Player not online!", playerSource, 255, 0, 0) end<br />
<br />
-- check whether the playerTarget is headless (a zombie)<br />
local message = isPedHeadless(playerTarget) and "This Player is a zombie!" or "This player is not a zombie!"<br />
outputChatBox(message, playerSource)<br />
end<br />
<br />
addCommandHandler("zombie", checkZombie)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Ped functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=SetPedHeadless&diff=71552SetPedHeadless2021-08-05T13:14:36Z<p>Pawelo: </p>
<hr />
<div>__NOTOC__<br />
{{Server client function}}<br />
With this function, you can set if a ped has a head or not.<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool setPedHeadless(ped thePed, bool headState)<br />
</syntaxhighlight><br />
[[File:Headless.png|thumb|exmaple]]<br />
{{OOP||[[ped]]:setHeadless|headless}}<br />
<br />
===Required Arguments===<br />
*'''thePed''': The [[ped]] to check.<br />
*'''headState''': head state, use true if you want the ped be headless, use false to give back the head.<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise<br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
This example enables a player to behead themselves, and give them their head back.<br />
<syntaxhighlight lang="lua"><br />
function removeMyHead(thePlayer)<br />
setPedHeadless(thePlayer, true) -- Removes the players head<br />
outputChatBox("You have been beheaded!", thePlayer, 255, 0, 0) -- A confirmation message for the player<br />
end<br />
addCommandHandler("beheadme", removeMyHead)<br />
<br />
function giveBackHead(thePlayer)<br />
setPedHeadless(thePlayer, false) -- Gives the player a head<br />
outputChatBox("You have been given a head!", thePlayer, 255, 0, 0) -- A confirmation message for the player<br />
end<br />
addCommandHandler("headmeup", giveBackHead)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Ped functions}}<br />
[[ru:setPedHeadless]]</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=EngineImportCOL&diff=71551EngineImportCOL2021-08-05T12:40:25Z<p>Pawelo: </p>
<hr />
<div>__NOTOC__<br />
{{Client function}}<br />
{{Deprecated|engineReplaceCOL|}}<br />
<br />
This function imports a RenderWare Collision into the model identified by the model id. This function does not replace the collisions of all models of this type in-game.<br />
<br />
To ensure proper replacement, please do not use this function for vehicles.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool engineImportCOL ( col theCol, int model_id ) <br />
</syntaxhighlight> <br />
<br />
===Required Arguments=== <br />
*'''col:''' The COL that was loaded with [[engineLoadCOL]]<br />
*'''model_id:''' The model id to import the COL into<br />
<br />
===Returns===<br />
Returns ''true'' if the function executed succesfully, ''false'' otherwise.<br />
<br />
==Example== <br />
This example loads a combination of custom DFF, TXD and COL files to replace an in-game model of a set of floors.<br />
<syntaxhighlight lang="lua"><br />
outputChatBox ( "> loading floor objects" )<br />
txd_floors = engineLoadTXD ( "models/office_floors.txd" )<br />
engineImportTXD ( txd_floors, 3781 )<br />
col_floors = engineLoadCOL ( "models/office_floors.col" )<br />
dff_floors = engineLoadDFF ( "models/office_floors.dff" )<br />
engineImportCOL ( col_floors, 3781 )<br />
engineReplaceModel ( dff_floors, 3781 )<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Engine_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiGetText&diff=71541GuiGetText2021-08-05T08:06:55Z<p>Pawelo: Remove redundant comment</p>
<hr />
<div>{{Client function}}<br />
__NOTOC__<br />
This function is used to get the text of GUI elements like edit boxes, labels, buttons etc.<br />
<br />
==Syntax== <br />
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --><br />
<syntaxhighlight lang="lua"><br />
string guiGetText ( element guiElement )<br />
</syntaxhighlight><br />
{{OOP||[[GUI widgets|GuiElement]]:getText|text|guiSetText}}<br />
<br />
===Required Arguments=== <br />
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type --><br />
*'''guiElement:''' element you wish to get text of.<br />
<br />
===Returns===<br />
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check --><br />
Returns a string containing the requested element's text, or false if the gui element passed to the function is invalid.<br />
<br />
==Example== <br />
<!-- Explain what the example is in a single sentance --><br />
This example gets the text of a pre-made gui element and outputs it to chat box.<br />
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --><br />
<syntaxhighlight lang="lua"><br />
-- We create a dummy gui label to get text of<br />
local dummyGUIElement = guiCreateLabel ( 0.45, 0.48, 0.10, 0.04, "Hello world", true )<br />
-- Output the text of the label to chat box<br />
outputChatBox ( "Text in the GUI label: " .. guiGetText ( dummyGUIElement ) )<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc --><br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GetVehicleUpgradeOnSlot&diff=71540GetVehicleUpgradeOnSlot2021-08-05T08:04:22Z<p>Pawelo: normalize page to match others</p>
<hr />
<div>__NOTOC__<br />
{{Server client function}}<br />
This function returns the current upgrade id on the specified vehicle's 'upgrade slot'<br />
An upgrade slot is a certain type of upgrade (eg: exhaust, spoiler), there are 17 slots (0 to 16).<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">int getVehicleUpgradeOnSlot ( vehicle theVehicle, int slot )</syntaxhighlight><br />
{{OOP||[[vehicle]]:getUpgradeOnSlot}}<br />
===Returns===<br />
Returns an ''integer'' with the upgrade on the slot if correct arguments were passed, ''false'' otherwise.<br />
<br />
===Required Arguments===<br />
*'''theVehicle''': The [[vehicle]] whose upgrade you want to retrieve.<br />
*'''slot''': The slot id of the upgrade. ''([[Upgrade list]] ordered by slot number)''<br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
This example prints the name and upgrades on each slot of an entered vehicle to the chat.<br />
<syntaxhighlight lang="lua"><br />
function scriptOnPlayerEnterVehicle ( theVehicle, seat, jacked )<br />
for i=0, 16 do<br />
local upgrade = getVehicleUpgradeOnSlot ( theVehicle, i )<br />
if ( upgrade ) then<br />
outputChatBox ( getVehicleUpgradeSlotName ( i ) .. ": " .. upgrade)<br />
end<br />
end<br />
end<br />
addEventHandler ( "onPlayerVehicleEnter", root, scriptOnPlayerEnterVehicle )<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Vehicle functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=RemoveVehicleUpgrade&diff=71539RemoveVehicleUpgrade2021-08-05T08:03:56Z<p>Pawelo: normalize page to match others</p>
<hr />
<div>__NOTOC__<br />
{{Server client function}}<br />
This function removes an already existing upgrade from the specified vehicle, eg: nos, hydraulics. Defined in San Andreas\data\maps\veh_mods\veh_mods.ide.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">bool removeVehicleUpgrade ( vehicle theVehicle, int upgrade )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''theVehicle''': The [[element]] representing the [[vehicle]] you wish to remove the upgrade from<br />
*'''upgrade''': The ID of the upgrade you wish to remove.<br />
<br />
==Returns==<br />
Returns ''true'' if the upgrade was successfully removed from the vehicle, otherwise ''false''.<br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
This script defines a 'nos' console command that adds a NOS upgrade to the vehicle that the player who executes the command is sitting in. It also adds a 'removenos' command which allows removal of a player's nos.<br />
<syntaxhighlight lang="lua"><br />
function addNOS ( sourcePlayer, command )<br />
theVehicle = getPlayerOccupiedVehicle ( sourcePlayer )<br />
if ( theVehicle ) then<br />
addVehicleUpgrade ( theVehicle, 1010 ) -- NOS 10x<br />
end<br />
end<br />
addCommandHandler ( "nos", addNOS )<br />
<br />
function remNOS ( sourcePlayer, command )<br />
theVehicle = getPlayerOccupiedVehicle ( sourcePlayer )<br />
if ( theVehicle ) then<br />
removeVehicleUpgrade ( theVehicle, 1010 )<br />
end<br />
end<br />
addCommandHandler ( "removenos", remNOS )<br />
</syntaxhighlight><br />
</section><br />
<section name="Client" class="client" show="false"><br />
This script defines a 'nos' console command that adds a NOS upgrade to the vehicle that the player who executes the command is sitting in. It also adds a 'removenos' command which allows removal of a player's nos. This example is clientside and may cause desync.<br />
<syntaxhighlight lang="lua"><br />
function addNOS ( command )<br />
theVehicle = getPlayerOccupiedVehicle ( getLocalPlayer() )<br />
if ( theVehicle ) then<br />
addVehicleUpgrade ( theVehicle, 1010 ) -- NOS 10x<br />
end<br />
end<br />
addCommandHandler ( "nos", addNOS )<br />
<br />
function remNOS ( command )<br />
theVehicle = getPlayerOccupiedVehicle ( getLocalPlayer() )<br />
if ( theVehicle ) then<br />
removeVehicleUpgrade ( theVehicle, 1010 )<br />
end<br />
end<br />
addCommandHandler ( "removenos", remNOS )<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Vehicle functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=SetMarkerIcon&diff=71538SetMarkerIcon2021-08-05T08:03:22Z<p>Pawelo: normalize page to match others</p>
<hr />
<div>__NOTOC__<br />
{{Server client function}}<br />
This function allows changing the icon of a checkpoint marker.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">bool setMarkerIcon ( marker theMarker, string icon )</syntaxhighlight><br />
{{OOP||[[Marker]]:setIcon|icon|getMarkerIcon}}<br />
===Required Arguments===<br />
* '''theMarker:''' The [[marker]] to change the visual style of<br />
* '''icon:''' A string referring to the type of icon, acceptable values are:<br />
**'''"none"''': No icon<br />
**'''"arrow"''': Arrow icon<br />
**'''"finish"''': Finish icon (at end of race)<br />
<br />
==Example==<br />
This example creates a finish marker as you'd expect for the end of a race.<br />
<syntaxhighlight lang="lua">theMarker = createMarker ( 1000, 1000, 1000, 0, 255, 0, 0 ) <br />
setMarkerIcon ( theMarker, "finish" )</syntaxhighlight><br />
<br />
==See Also==<br />
{{Marker functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiProgressBarSetProgress&diff=71537GuiProgressBarSetProgress2021-08-05T07:58:48Z<p>Pawelo: </p>
<hr />
<div>__NOTOC__ <br />
{{Client function}}<br />
This function is used to set the progress of a progressbar as a percentage.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool guiProgressBarSetProgress ( progressBar theProgressbar, float progress )<br />
</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''theProgressbar''': The progressbar you want to change the progress of<br />
*'''progress''': a float ranging from 0 - 100<br />
<br />
===Returns===<br />
Returns true if the progress was set, false otherwise.<br />
<br />
==Example==<br />
This example sets the progress of a bar called "somebar" created with [[guiCreateProgressBar]], and outputs it to the chatbox.<br />
<syntaxhighlight lang="lua"><br />
-- If the progressbar exsist then<br />
if ( somebar ) then<br />
-- set the progress<br />
guiProgressBarSetProgress(somebar, 80)<br />
-- get the progress<br />
progress = guiProgressBarGetProgress(somebar)<br />
-- output to the chatbox<br />
outputChatBox ( "Current progress:" .. progress .. "%" )<br />
else --if the progressbar was not found<br />
outputChatBox ("progressbar not found!")<br />
-- output a message<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GuiProgressBarGetProgress&diff=71536GuiProgressBarGetProgress2021-08-05T07:57:34Z<p>Pawelo: </p>
<hr />
<div>__NOTOC__ <br />
{{Client function}}<br />
This function gets the progress of a progress bar as a percentage.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
float guiProgressBarGetProgress ( progressBar theProgressbar )<br />
</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''theProgressbar''': The progressbar you want to check.<br />
<br />
===Returns===<br />
Returns a [[float]] ranging between 0 and 100.<br />
<br />
==Example==<br />
This example gets the progress of a bar called "somebar" created with [[guiCreateProgressBar]], and outputs it to the chatbox.<br />
<syntaxhighlight lang="lua"><br />
-- If the progressbar exsist then<br />
if ( somebar ) then<br />
-- get the progress<br />
progress = guiProgressBarGetProgress(somebar)<br />
-- output to the chatbox<br />
outputChatBox ( "Current progress:" .. progress .. "%" )<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=AddAccount&diff=68231AddAccount2021-01-13T14:32:11Z<p>Pawelo: Password length limit has been removed 4 years ago - https://github.com/multitheftauto/mtasa-blue/pull/104</p>
<hr />
<div>{{Server function}}<br />
__NOTOC__<br />
This function adds an [[account]] to the list of registered accounts of the current server.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua">account addAccount ( string name, string pass [, bool allowCaseVariations = false ] )<br />
</syntaxhighlight><br />
{{OOP|This function is a static function underneath the Account class.|[[Account]].add ||}}<br />
===Required Arguments=== <br />
*'''name:''' The name of the account you wish to make, this normally is the player's name.<br />
*'''pass:''' The password to set for this account for future logins.<br />
<br />
===Optional Arguments===<br />
*'''allowCaseVariations:''' Whether the username is case sensitive (if this is set to true, usernames "Bob" and "bob" will refer to different accounts)<br />
<br />
===Returns===<br />
Returns an [[account]] or ''false'' if the account already exists or an error occured.<br />
<br />
===Limits===<br />
*'''name:'''<br />
** Minimal account name length is 1 character.<br />
** Account names are case-sensitive if allowCaseVariations is ''true''.<br />
** Account name can not be equal to "*****"<br />
*'''pass:'''<br />
** Minimal account password length is 1 character.<br />
** Maximum account password length '''was''' 30 characters until version 1.5.4-11138. Currently there is no upper limit.<br />
** Account password can not be equal to "*****"<br />
<br />
==Example== <br />
'''Example 1:''' This enables players to register on your server by using /register <password> in the chat window.<br />
<syntaxhighlight lang="lua"><br />
function registerPlayer ( source, commandName, password )<br />
-- Check if the password field is blank or not (only blank if they didnt enter one)<br />
if ( password ~= "" and password ~= nil ) then<br />
--Attempt to add the account, and save its value in a var<br />
local accountAdded = addAccount( getPlayerName(source), password )<br />
if ( accountAdded ) then<br />
-- Tell the user all is done<br />
outputChatBox ( "Thank you " .. getPlayerName(source) .. ", you're now registed, you can login with /login", source )<br />
else<br />
-- There was an error making the account, tell the user<br />
outputChatBox ( "Error creating account, contact the server admin", source )<br />
end<br />
else<br />
-- There was an error in the syntax, tell the user the correct syntax.<br />
outputChatBox ( "Error creating account, correct syntax: /register <password>", source )<br />
end<br />
end<br />
addCommandHandler ( "register", registerPlayer ) -- add the command handler<br />
</syntaxhighlight><br />
<br />
'''This code differs by allowing the user to change their username that they wish to use.'''<br />
<br />
'''Example 2:''' This enables players to register on your server by using /register <username> <password> in the chat window.<br />
<syntaxhighlight lang="lua"><br />
function registerPlayer ( source, commandName, username, password )<br />
if(password ~= "" and password ~= nil and username ~= "" and username ~= nil) then<br />
local accountAdded = addAccount(username,password)<br />
if(accountAdded) then<br />
outputChatBox("Thank you " .. getPlayerName(source) .. ", you're now registed, you can login with /login",source)<br />
else<br />
outputChatBox("Error creating account, contact the server admin.",source)<br />
end<br />
else<br />
outputChatBox("Error creating account, correct syntax: /register <nick> <pass>",source)<br />
end<br />
end<br />
addCommandHandler ( "register", registerPlayer ) -- add the command handler<br />
</syntaxhighlight><br />
<br />
'''Example 3:''' This code differs again so the user can only register once /register <username> <password>.<br />
<syntaxhighlight lang="lua"><br />
bRegisteredOnce = {}<br />
<br />
function registerPlayer ( source, commandName, username, password )<br />
if(password ~= "" and password ~= nil and username ~= "" and username ~= nil and not bRegisteredOnce[source]) then<br />
local accountAdded = addAccount(username,password)<br />
if(accountAdded) then<br />
outputChatBox("Thank you " .. getPlayerName(source) .. ", you're now registed, you can login with /login",source)<br />
bRegisteredOnce[source] = true<br />
else<br />
outputChatBox("Error creating account, contact the server admin.",source)<br />
end<br />
else<br />
if bRegisteredOnce[source] == true then<br />
outputChatBox("You already registered on this server!",source)<br />
else<br />
outputChatBox("Error creating account, correct syntax: /register <nick> <pass>",source)<br />
end<br />
end<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc --><br />
{{Account_functions}}<br />
<br />
[[ar:addAcount]]<br />
[[es:addAcount]]<br />
[[pl:addAccount]]<br />
[[ru:addAccount]]</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=DbConnect&diff=67741DbConnect2020-11-16T16:40:43Z<p>Pawelo: Add undocummented 'queue' option https://github.com/multitheftauto/mtasa-blue/blob/b3065d2d4129935f9b4fd9a7804307d6302b568a/Server/mods/deathmatch/logic/CDatabaseJobQueueManager.cpp#L187</p>
<hr />
<div>__NOTOC__<br />
{{Server function}}<br />
This function opens a connection to a database and returns an element that can be used with [[dbQuery]]. To disconnect use [[destroyElement]].<br />
{{Note|Connecting and disconnecting many times can have a performance impact on the server. For optimal performance it is recommended that you use dbConnect only once when the resource starts, and share the connection element with the whole script.}}<br />
{{Note|If you use MySQL 8 or newer, add this line to mysqld.cnf '''<nowiki>default-authentication-plugin=mysql_native_password</nowiki>'''}}<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
element dbConnect ( string databaseType, string host [, string username = "", string password = "", string options = "" ] )<br />
</syntaxhighlight><br />
{{OOP||[[Connection]]}}<br />
===Required Arguments===<br />
*'''databaseType:''' The type of database. This can be either ''sqlite'' or ''mysql''<br />
*'''host:''' The target to connect to. The format of this depends on the database type.<br />
** For SQLite it is a [[filepath]] to a SQLite database file. If the filepath starts with ":/" then the server's global databases directory is used. The file will be created if it does not exist.<br />
** For MySQL it is a list of key=value pairs separated by semicolons. Supported keys are:<br />
*** '''dbname''': Name of the database to use e.g. ''dbname=test''<br />
*** '''host''': Host address e.g. ''host=127.0.0.1''<br />
*** '''port''': Host port e.g. ''port=1234'' (optional, defaults to standard MySQL port if not used)<br />
*** '''unix_socket''': Unix socket or named pipe to use (optional)<br />
***'''charset''': Communicate with the server using a character which is different from the default e.g. ''charset<nowiki>=</nowiki>utf8'' (optional)<br />
<br />
===Optional Arguments===<br />
*'''username:''' Usually required for MySQL, ignored by SQLite <br />
*'''password:''' Usually required for MySQL, ignored by SQLite <br />
*'''options :''' List of key=value pairs separated by semicolons. Supported keys are:<br />
**'''share''' which can be set to 0 or 1. (Default value for SQLite is "share=1", for MySQL is "share=0"). When set to 1, the connection is shared and will be used by other calls to dbConnect with the same host string. This is usually a good thing for SQLite connections, but not so good for MySQL unless care is taken.<br />
**'''batch''' which can be set to 0 or 1. (Default is "batch=1"). When set to 1, queries called in the same frame are automatically batched together which can significantly speed up inserts/updates. The downside is you lose control of the feature that is used to achieve batching (For SQLite it is transactions, for MySQL it is autocommit mode). Therefore, if you use transactions, lock tables or control autocommit yourself, you may want to disable this feature.<br />
**'''autoreconnect''' which can be set to 0 or 1. (Default value "autoreconnect=1"). When set to 1, dropped connections will automatically be reconnected. Note that session variables (incl. SET NAMES), user variables, table locks and temporary tables will be reset because of the reconnection. So if you use these fancy features, you will need to turn autoreconnect off and cope with dropped connections some other way.<br />
**'''log''' which can be set to 0 or 1. (Default value "log<nowiki>=</nowiki>1"). When set to 0, activity from this connection will not be recorded in the [[Server_Commands#debugdb|database debug log file]].<br />
**'''tag''' (Default value "tag<nowiki>=</nowiki>script"). A string which helps identify activity from this connection in the [[Server_Commands#debugdb|database debug log file]].<br />
**'''suppress''' A comma separated list of error codes to ignore. (eg. "suppress<nowiki>=</nowiki>1062,1169").<br />
**'''multi_statements''' Enable multiple statements (separated by a semi-colon) in one query. Use [[dbPrepareString]] when building a multiple statement query to reduce SQL injection risks.<br />
**'''queue''' Name of the queue to use. (Default value for SQLite is "sqlite", for MySQL default is the host string from the '''host''' argument). Asynchronous database queries in the same queue are processed in order, one at a time. Any name can be used.<br />
<br />
===Returns===<br />
Returns a database connection element unless there are problems, in which case it return ''false''.<br />
<br />
==Example==<br />
This example opens a connection to a SQLite database file in the current resource<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", "file.db" )<br />
</syntaxhighlight><br />
<br />
This example opens a connection to a SQLite database file in another resource<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", ":resname/file.db" )<br />
</syntaxhighlight><br />
<br />
This example opens a connection to a SQLite database file in the global databases directory<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", ":/file.db" )<br />
</syntaxhighlight><br />
<br />
This example opens a connection to a SQLite database file in a sub directory of the global databases directory<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", ":/example/sub/dir/file.db" )<br />
</syntaxhighlight><br />
<br />
This example opens a connection to a MySQL database called 'frank' at server ip 1.2.3.4 using utf8 character set and allows the connection to be shared. Note that changing the database or other connection dependent settings affect all connections that are shared.<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "mysql", "dbname=frank;host=1.2.3.4;charset=utf8", "username", "password", "share=1" )<br />
</syntaxhighlight><br />
<br />
This example opens a connection to a SQLite database is disallows sharing of the connection<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", "file.db", "", "", "share=0" )<br />
</syntaxhighlight><br />
<br />
This example output debug message, if the connection with SQLite database was established or not<br />
<syntaxhighlight lang="lua"><br />
test_db = dbConnect( "sqlite", "file.db" )<br />
<br />
if test_db then<br />
outputDebugString( "Connection with database was successfully established." )<br />
else<br />
outputDebugString( "Connection with database couldn't be established." )<br />
end<br />
</syntaxhighlight><br />
<br />
The folowing example shows how you could approach a common resource for database operations with exported functions ('''query''' and '''execute'''):<br />
<br />
<syntaxhighlight lang="lua"><br />
function connect()<br />
DBConnection = dbConnect( "mysql", "dbname=DBNAME;host=HOST;charset=utf8", "USERNAME", "PASSWORD" )<br />
if (not DBConnection) then<br />
outputDebugString("Error: Failed to establish connection to the MySQL database server")<br />
else<br />
outputDebugString("Success: Connected to the MySQL database server")<br />
end<br />
end<br />
<br />
addEventHandler("onResourceStart",resourceRoot, connect)<br />
<br />
function query(...)<br />
local queryHandle = dbQuery(DBConnection, ...)<br />
if (not queryHandle) then<br />
return nil<br />
end<br />
local rows = dbPoll(queryHandle, -1)<br />
return rows<br />
end<br />
<br />
function execute(...)<br />
local queryHandle = dbQuery(DBConnection, ...)<br />
local result, numRows = dbPoll(queryHandle, -1)<br />
return numRows<br />
end<br />
<br />
function getDBConnection()<br />
return DBConnection<br />
end<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|1.1.1-9.03328|n/a}}<br />
<br />
==Changelog==<br />
{{ChangelogHeader}}<br />
{{ChangelogItem|1.3.1-9.04817|Added options 'log', 'tag' and 'suppress'}}<br />
{{ChangelogItem|1.3.5-9.06386|Added option 'charset'}}<br />
{{ChangelogItem|1.5.2-9.07972|Added option 'multi_statements'}}<br />
{{ChangelogItem|1.5.4-9.11138|Added option 'queue'}}<br />
<br />
==See Also==<br />
{{SQL_functions}}<br />
<br />
[[ru:dbConnect]]</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=Resource_Web_Access&diff=60253Resource Web Access2018-11-03T18:27:19Z<p>Pawelo: Add Node.js SDK to the list (external link to npmjs)</p>
<hr />
<div>The Multi Theft Auto Server provides a web interface that resources can use in a variety of ways. This document's purpose is to explain what these ways are and how to go about using them.<br />
<br />
==Overview==<br />
There are two key parts that make up this system. The first is a standard web server that allows web browsers to request pages and files you have in a resource. The second is a system for allowing web browsers to call functions you have exported from your resource.<br />
<br />
==Pages==<br />
===Specifying a file in the meta===<br />
You can specify in your resource's meta file that certain files are accessible through the web server. To do this, you add a line:<br />
<syntaxhighlight lang="xml"><br />
<html src="filename.ext" /><br />
</syntaxhighlight><br />
You can then access this file from your web browser by visiting: http://host:port/resourcename/filename.ext<br/><br />
For example, on a locally hosted server using default http port with webmap started: http://127.0.0.1:22005/webmap/map.htm<br />
<br />
<br />
===Binary files===<br />
Despite the misleading name, files specified using the html node can be of any type. If they are binary files (like images, zip files) then you need to specify this in the meta file, by adding ''raw="true"'' to the ''html'' node. This means that the files are not preprocessed before being sent to the web browser.<br />
<br />
For example:<br />
<syntaxhighlight lang="xml"><br />
<html src="image.gif" raw="true" /><br />
</syntaxhighlight><br />
<br />
===Parsed files===<br />
If a file is not specified in the meta file as "raw", then it is passed through a pre-processor before it is returned to the client. This pre-processor works much like PHP or ASP, but uses LUA. You can embed standard MTA scripts within HTML pages, controlling the output. Almost all standard MTA functions work, plus a number of special [[Template:HTTP functions|HTTP Functions]], such as [[httpWrite]], a function that outputs text to the buffer.<br />
<br />
For example:<br />
<syntaxhighlight lang="html4strict"><br />
<html><br />
<body><br />
This resource is called <* httpWrite( getResourceName(getThisResource()) ) *><br />
</body><br />
<html><br />
</syntaxhighlight><br />
<br />
There is a shorthand (in common with PHP and ASP) for this code, meaning that you can also write the above code as:<br />
<br />
<syntaxhighlight lang="html4strict"><br />
<html><br />
<body><br />
This resource is called <* = getResourceName(getThisResource()) *><br />
</body><br />
<html><br />
</syntaxhighlight><br />
<br />
Aside from HTTP functions, embedded Lua has access to the following environment variables that contain information about how the page was requested:<br />
* table '''requestHeaders''': This is a table containing all the headers that were requested with the page. You can set returned headers using [[httpSetResponseHeader]]. <br />
* table '''form''': This is a table containing all the form data submitted to the page using HTTP POST combined with any variables passed in the querystring with HTTP GET.<br />
* table '''cookies''': This is a table of all the cookies. You can modify cookies using [[httpSetResponseCookie]].<br />
* string '''hostname''': This is a string containing the IP address or hostname that requested the page.<br />
* string '''url''': This is the URL of the page.<br />
* account '''user''': This is the account of the current user.<br />
<br />
It's important to note that parsed files are run in a separate virtual machine from the rest of your resource's code. As such, if you want to call a function in your resource's main code, you need to export the function and use the [[call]] function from your parsed file.<br />
<br />
==Calls==<br />
You can specify that certain exported functions in your resource are able to be called from the HTTP interface. All the SDKs (listed below) allow you to call these functions from a remote location. <br />
<br />
To specify an exported http-accessible function, add the following to your meta.xml file:<br />
<syntaxhighlight lang="xml"><br />
<export function='functionName' http='true' /><br />
</syntaxhighlight><br />
<br />
You can code your function just as you would any normal function, returning as many values as you want, including tables and resources and most importantly elements. You ''cannot'' however return other 'userdata' values such as [[xmlnode|xmlnodes]] or functions.<br />
<br />
===Protocol===<br />
{{note_box|You don't need to know this unless you're writing your own HTTP request code. You can just use one of the [[#SDK|SDKs listed below]].}}<br />
<br />
Calls are done by requesting ''<nowiki>http://<your IP>:<your port>/<resource_name>/call/<exported_function_name></nowiki>'' using HTTP POST. The body of the request should be a JSON array of the arguments for the function.<br />
<br />
The request will return a JSON array of the value(s) returned from the function as the HTTP response.<br />
<br />
The server supports HTTP Basic authentication and you can configure access via the ACL and the built-in accounts system.<br />
<br />
===Calls from the HTTP web interface===<br />
Using calls is probably easiest from the web interface and can be done almost seamlessly.<br />
<br />
First, add this to your meta.xml file:<br />
<syntaxhighlight lang="xml"><br />
<include resource="ajax" /><br />
</syntaxhighlight><br />
<br />
Secondly, add the following to the <head> section of the page you want to call from:<br />
<syntaxhighlight lang="lua"><br />
<* = exports.ajax:start(getResourceName(getThisResource())) *><br />
</syntaxhighlight><br />
<br />
Finally, you can create a javascript block in your page and call your functions almost as if they were local. The only difference is that the calls are aysnchronous - you should specify a callback function as the last argument for your call. This is called when the function returns.<br />
<br />
Here's a simple example.<br />
<br />
'''meta.xml'''<br />
<syntaxhighlight lang="xml"><br />
<meta><br />
<include resource="ajax" /><br />
<script src='code.lua' /><br />
<html src='page.htm' default='true' /><br />
<export function='showChatMessage' http='true' /><br />
</meta><br />
</syntaxhighlight><br />
<br />
'''code.lua'''<br />
<syntaxhighlight lang="lua"><br />
function showChatMessage ( message )<br />
outputChatBox ( message )<br />
return 5;<br />
end<br />
</syntaxhighlight><br />
<br />
'''page.htm'''<br />
<syntaxhighlight lang="html4strict"><br />
<html><br />
<head><br />
<* = exports.ajax:start(getResourceName(getThisResource())) *><br />
<script type='text/javascript'><br />
function say() {<br />
var message = document.getElementById('message')<br />
showChatMessage ( message.value, <br />
function ( number ) {<br />
// the function has been called and returned something<br />
message.value = "The function returned " + number;<br />
}<br />
);<br />
}<br />
</script><br />
</head><br />
<body><br />
<input type='text' id='message' /><input type='button' value='say' onclick='say();' /><br />
</body><br />
</html><br />
</syntaxhighlight><br />
<br />
You can see (fairly complex) examples of how this can be done in the resources ''resourcebrowser'', ''resourcemanager'' and ''webadmin''.<br />
<br />
==Securing the web interface==<br />
The [[ACL]] has a number of rights that can affect what files can be accessed.<br />
{{Deprecated feature|3.0139|1.3.1|<br />
* general.http: If disabled, none of the http files can be accessed (except by game clients)<br />
** '''Important Note''': ''If 'general.http' is enabled, http access to all resources (for that ACL) is enabled by default. To disable http access you have to explicitly block access to resources that contain exported http functions.''<br />
** '''Important Note''': ''If 'general.http' is enabled on an ACL which has a user with no password (i.e. user.* or user.guest or user.http_guest), it is essential that you explicitly block access to resources that contain exported http functions.''<br />
* resource.'''ResourceName''': If disabled, none of the files in the resource can be accessed<br />
* resource.'''ResourceName'''.file.'''FileName''': If disabled, the file named cannot be accessed<br />
* resource.'''ResourceName'''.function.'''FunctionName''': If disabled, the function cannot be called<br />
These work as with other ACL rights - you can disable them for normal users and just enable them for Admin users, or any other group of users you wish.<br />
}}<br />
{{New_feature|3.0139|1.3.1|<br />
* '''resource.ResourceName.http''': If enabled, the resource will be accessible from http://server_ip:22005/ResourceName/<br />
This works as with other ACL rights - You can enable it just for Admin users, or any other group of users you wish.<br />
}}<br />
<br />
==SDK==<br />
There are a number of so-called 'SDKs' available that allow you to interface with the server from other programming languages. With these you could (in theory) write whole gamemodes. In practice this is probably a bad idea, but it is useful for statistics and administration. The PHP SDK is the most developed version. Feel free to modify or create your own SDKs - if you do please send us a copy.<br />
<br />
* [[JavaSDK|Java SDK]]<br />
* [[Javascript SDK]]<br />
* [https://www.npmjs.com/package/mtasa Node.js SDK]<br />
* [[Perl SDK]]<br />
* [[PHP SDK]]<br />
* [[CSharp SDK|C# SDK]]<br />
<br />
==See Also==<br />
[[callRemote]] - Allows game servers to call functions on PHP pages (with the PHP SDK) and on other game servers.<br />
[[Category:Scripting Concepts]]<br />
[[ru:Resource Web Access]]<br />
[[Category:Tutorials]]</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=RefreshResources&diff=52943RefreshResources2017-12-01T19:06:06Z<p>Pawelo: typo</p>
<hr />
<div>{{Server function}}<br />
__NOTOC__<br />
This function finds new resources and checks for changes to the current ones.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool refreshResources ( [ bool refreshAll = false, resource targetResource = nil ] )<br />
</syntaxhighlight><br />
<br />
===Optional Arguments===<br />
{{OptionalArg}}<br />
*'''refreshAll''': If ''true'' MTA will check for changes in all resources. If ''false'', MTA will only check for new resources and try to reload resources with errors<br />
{{New items|5.0155|1.5.5-9.11718|<br />
*'''targetResource''': If set, the refresh is restricted to the supplied resource only<br />
}}<br />
'''Note:''' Checking for changes in all resources can result in lag for a short period of time. It should generally be avoided to set refreshAll to ''true''.<br />
<br />
===Returns===<br />
Returns true if refresh was successful, false otherwise.<br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
This example will refresh resources when a player uses the /refreshresources command just like the hardcoded /refreshall.<br />
<syntaxhighlight lang="lua"><br />
function commandRefreshResources(player)<br />
refreshResources(true)<br />
outputChatBox("Resources refreshed", player, 255, 255, 0)<br />
end<br />
addCommandHandler("refreshresources", commandRefreshResources)<br />
</syntaxhighlight><br />
<br />
<br />
This example will refresh only the named resource:<br />
<syntaxhighlight lang="lua"><br />
refreshResources(true, getResourceFromName("admin"))<br />
</syntaxhighlight><br />
</section><br />
<br />
==Changelog==<br />
{{ChangelogHeader}}<br />
{{ChangelogItem|1.5.5-9.11718|Added targetResource argument}}<br />
<br />
==See Also==<br />
{{Resource_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=IsInsideRadarArea&diff=52925IsInsideRadarArea2017-11-26T17:42:10Z<p>Pawelo: Add warning regarding the negative dimensions of radararea</p>
<hr />
<div>__NOTOC__ <br />
{{Server client function}}<br />
This function checks if a 2D position is inside a [[radararea|radar area]] or not.<br />
{{MessageBox|bordercolorhex=FFB2B2|bgcolorhex=FFE5E5|image=File:Dialog-warning.png|title=Warning:|message= Before 1.5.5 [https://buildinfo.mtasa.com/?Author=&Branch=&Revision=11746 r11746], this function does not always work correctly if dimensions of the radararea (sizeX or sizeY) are negative numbers.}} <!-- The {Warning} template didn't want to work with an external link to buildinfo, so I had to use the {MessageBox} template --><br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool isInsideRadarArea ( radararea theArea, float posX, float posY )<br />
</syntaxhighlight> <br />
{{OOP||[[radararea]]:isInside}}<br />
<br />
===Required Arguments=== <br />
*'''theArea:''' The [[radararea|radar area]] you're checking the position against.<br />
*'''posX:''' The X coordinate of the position you're checking.<br />
*'''posY:''' The Y coordinate of the position you're checking.<br />
<br />
===Returns===<br />
Returns ''true'' if the position is inside the radar area, ''false'' if it isn't or if any parameters are invalid.<br />
<br />
==Example== <br />
This function checks if an element is within a radar area.<br />
<syntaxhighlight lang="lua"><br />
function isElementInsideRadarArea ( theElement, theArea )<br />
-- get the x, y coordinates from getElementPosition (z gets silently discarded)<br />
local posX, posY = getElementPosition( theElement )<br />
-- call isInsideRadarArea with those coordinates and return its result<br />
return isInsideRadarArea ( theArea, posX, posY )<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Radar area functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=CreateRadarArea&diff=52924CreateRadarArea2017-11-26T17:34:16Z<p>Pawelo: Fix parameter naming to make them less confusing, because radararea dimensions can be negative numbers</p>
<hr />
<div>__NOTOC__ <br />
{{Server client function}}<br />
This function can be used to create custom radar areas on the radar.<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
radararea createRadarArea ( float startPosX, float startPosY, float sizeX, float sizeY, [ int r = 255, int g = 0, int b = 0, int a = 255, element visibleTo = getRootElement() ] ) <br />
</syntaxhighlight> <br />
{{OOP||[[radararea|RadarArea]]}}<br />
<br />
===Required Arguments=== <br />
*'''startPosX:''' A float representing the origin 'x' position of the radar area.<br />
*'''startPosY:''' A float representing the origin 'y' position of the radar area.<br />
*'''sizeX:''' A float representing the width of the radar area.<br />
*'''sizeY:''' A float representing the height of the radar area.<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
<br />
*'''r:''' An integer representing the amount of red in the color. Maximum value is 255<br />
*'''g:''' An integer representing the amount of green in the color. Maximum value is 255<br />
*'''b:''' An integer representing the amount of blue in the color. Maximum value is 255<br />
*'''a:''' An integer representing the amount of alpha in the color. This allows setting the transparency of the radar area. 255 is opaque and 0 is transparent.<br />
*'''visibleTo:''' An [[element]] that you wish to restrict the [[visibility]] of the radar area to. (Server function only)<br />
<br />
==Example== <br />
<section name="Server" class="server" show="true"><br />
This example creates a radar area for the King of the hill script, and a colsquare. When the player enters the radar area it flashes, and stops flashing when a player leaves it.<br />
<syntaxhighlight lang="lua"><br />
-- create our hill area for our gamemode<br />
local hillArea = createColRectangle ( -2171.0678710938, 678.17950439453, 15, 15 )<br />
local hillRadar = createRadarArea ( -2183.5678710938, 705.67950439453, 40, -40, 0, 255, 0, 175 )<br />
<br />
-- add hill_Enter as a handler for when a player enters the hill area<br />
function hill_Enter ( thePlayer, matchingDimension )<br />
-- announce to everyone that the player entered the hill<br />
if (getElementType(thePlayer) == "player") then<br />
outputChatBox( getPlayerName(thePlayer) .. " entered the zone!", getRootElement(), 255, 255, 109 )<br />
setRadarAreaFlashing ( hillRadar, true )<br />
end<br />
end<br />
addEventHandler ( "onColShapeHit", hillArea, hill_Enter )<br />
<br />
-- add hill_Enter as a handler for when a player leaves the hill area<br />
function hill_Exit ( thePlayer, matchingDimension )<br />
-- check if the player is not dead<br />
if (getElementType(thePlayer) == "player") then<br />
if isPedDead ( thePlayer ) ~= true then<br />
-- if he was alive, announce to everyone that the player has left the hill<br />
outputChatBox ( getPlayerName(thePlayer) .. " left the zone!", getRootElement(), 255, 255, 109 )<br />
setRadarAreaFlashing ( hillRadar, false )<br />
end<br />
end<br />
end<br />
addEventHandler ( "onColShapeLeave", hillArea, hill_Exit )<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Radar area_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=AddCommandHandler&diff=52832AddCommandHandler2017-11-15T17:21:26Z<p>Pawelo: Fixed handler functions parameter descriptions</p>
<hr />
<div>__NOTOC__ <br />
{{Server client function}}<br />
{{Note_box|It is strongly advised that you do not use the same name for your handler function as the command name, as this can lead to confusion if multiple handler functions are used. Use a name that describes your handler's purpose more specifically.}}<br />
This function will attach a scripting function (handler) to a console command, so that whenever a player or administrator uses the command the function is called.<br />
'''Note:''' You cannot use "check", "list" or "test" as a command name.<br />
<br />
Multiple command handlers can be attached to a single command, and they will be called in the order that the handlers were attached. Equally, multiple commands can be handled by a single function, and the ''commandName'' parameter used to decide the course of action.<br />
<br />
For users, a command is in the format:<br />
<br />
''commandName'' ''argument1'' ''argument2''<br />
<br />
This can be triggered from the player's console or directly from the chat box by prefixing the message with a forward slash (''/''). For server side handlers, the server admin is also able to trigger these directly from the server's console in the same way as they are triggered from a player's console.<br />
<br />
==Syntax== <br />
<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool addCommandHandler ( string commandName, function handlerFunction, [bool restricted = false, bool caseSensitive = true] )<br />
</syntaxhighlight> <br />
<br />
===Required Arguments===<br />
*'''commandName:''' This is the name of the command you wish to attach a handler to. This is what must be typed into the console to trigger the function.<br />
*'''handlerFunction:''' This is the function that you want the command to trigger, which has to be defined before you add the handler. This function can take two parameters, playerSource and commandName, followed by as many parameters as you expect after your command (see below). These are all optional.<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''restricted:''' Specify whether or not this command should be restricted by default. Use this on commands that should be inaccessible to everyone as default except special users specified in the ACL (Access Control List). This is to make sure admin commands such as ie. 'punish' won't be available to everyone if a server administrator forgets masking it in ACL. Make sure to add the command to your ACL under the proper group for it to be usefull (i.e <right name="command.killEveryone" access="true"></right>). This argument defaults to false if nothing is specified.<br />
{{New feature|3|1.0|<br />
*'''caseSensitive:''' Specifies if the command handler will ignore the case for this command name.<br />
}}<br />
<br />
</section><br />
<br />
<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
bool addCommandHandler ( string commandName, function handlerFunction, [bool caseSensitive = true] )<br />
</syntaxhighlight> <br />
<br />
===Required Arguments===<br />
*'''commandName:''' This is the name of the command you wish to attach a handler to. This is what must be typed into the console to trigger the function.<br />
*'''handlerFunction:''' This is the function that you want the command to trigger, which has to be defined before you add the handler. This function can take commandName parameter, followed by as many parameters as you expect after your command (see below). These are all optional.<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
{{New feature|3|1.0|<br />
*'''caseSensitive:''' Specifies if the command handler will ignore the case for this command name.<br />
}}<br />
</section><br />
<br />
====Handler function parameters====<br />
These are the parameters for the handler function that is called when the command is used.<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua">player playerSource, string commandName, [string arg1, string arg2, ...] </syntaxhighlight><br />
<br />
* '''playerSource:''' The player who triggered the command or the [[Element/Console|server console]]. If not triggered by a player (e.g. by admin) or server console, this will be ''false''.<br />
* '''commandName:''' The name of the command triggered. This is useful if multiple commands go through one function.<br />
* '''arg1, arg2, ...:''' Each word after command name in the original command is passed here in a seperate variable. If there is no value for an argument, its variable will contain [[nil]]. You can deal with a variable number of arguments using the vararg expression, as shown in '''Server Example 2''' below.<br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"> string commandName, [string arg1, string arg2, ...] </syntaxhighlight><br />
* '''commandName:''' The name of the command triggered. This is useful if multiple commands go through one function.<br />
* '''arg1, arg2, ...:''' Each word after command name in the original command is passed here in a seperate variable. If there is no value for an argument, its variable will contain [[nil]]. You can deal with a variable number of arguments using the vararg expression, as shown in '''Server Example 2''' below.<br />
</section><br />
<br />
===Returns===<br />
Returns ''true'' if the command handler was added successfully, ''false'' otherwise.<br />
<br />
==Examples== <br />
<section name="Server" class="server" show="true"><br />
'''Example 1:''' This example defines a command handler for the command ''createmarker''. This will create a red marker at the position of the player player who uses it.<br />
<syntaxhighlight lang="lua"><br />
-- Define our function that will handle this command<br />
function consoleCreateMarker ( playerSource, commandName )<br />
-- If a player triggered it (rather than the admin) then<br />
if ( playerSource ) then<br />
-- Get that player's position<br />
local x, y, z = getElementPosition ( playerSource )<br />
-- Create a size 2, red checkpoint marker at their position<br />
createMarker ( x, y, z, "checkpoint", 2, 255, 0, 0, 255 )<br />
-- Output it in his chat box<br />
outputChatBox ( "You got a red marker", playerSource )<br />
end<br />
end<br />
-- Attach the 'consoleCreateMarker' function to the "createmarker" command<br />
addCommandHandler ( "createmarker", consoleCreateMarker )<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Server" class="server" show="hide"><br />
'''Example 2:''' This example makes use of Lua's vararg expression to implement a ''check_parameters'' command to count the number of parameters passed, merge them all into a single string and output it. This is also shows you how you can use table.concat to merge all the passed arguments. This is particularly useful when you want to read in a sentence of text passed from the user. <br />
<syntaxhighlight lang="lua"><br />
-- Define our function that will handle this command (which can accept a variable number of arguments after commandName)<br />
function consoleCheckParameters ( playerSource, commandName, ... )<br />
-- If a player, not an admin, triggered it,<br />
if playerSource then<br />
local arg = {...}<br />
-- Get the number of arguments in the arg table (arg table is the same as: {...})<br />
local parameterCount = #arg<br />
-- Output it to the player's chatbox<br />
outputChatBox ( "Number of parameters: " .. parameterCount, playerSource )<br />
-- Join them together in a single comma-separated string<br />
local stringWithAllParameters = table.concat( arg, ", " )<br />
-- Output this parameter list to the player's chatbox<br />
outputChatBox ( "Parameters passed: " .. stringWithAllParameters, playerSource )<br />
end<br />
end<br />
-- Attach the 'consoleCheckParameters' function to the "check_parameters" command<br />
addCommandHandler ( "check_parameters", consoleCheckParameters )<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Server" class="server" show="hide"><br />
'''Example 3:''' This example shows using a single function to handle multiple command handlers. This isn't advised for general usage, as it makes code harder to understand, but where multiple command handlers share some logic, it can be a useful way of reducing duplicated code. Generally, it would be preferable to put this shared logic in a separate function instead, as this gives you more control over the flow.<br />
<!-- commands are case sensitive by default, in this example too --><br />
<syntaxhighlight lang="lua"><br />
-- make the function<br />
function moneyCmd(player, commandName, amount)<br />
if getElementData(player, "canUseMoneyFunctions") then -- the shared logic<br />
if commandName == "givemoney" then<br />
amount = tonumber(amount)<br />
if amount then<br />
givePlayerMoney(player, amount)<br />
else<br />
outputChatBox("[usage] /givemoney [amount]", player)<br />
end<br />
else if commandName == "takemoney" then<br />
amount = tonumber(amount)<br />
if amount then<br />
takePlayerMoney(player, amount)<br />
else<br />
outputChatBox("[usage] /takemoney [amount]", player)<br />
end<br />
end<br />
else<br />
outputChatBox("You aren't able to use this command", player)<br />
end<br />
end<br />
<br />
addCommandHandler("givemoney", moneyCmd);<br />
addCommandHandler("takemoney", moneyCmd);<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="false"><br />
'''Example 1:''' This example warps the local player to a random nearby location (useful for when a player gets stuck somewhere).<br />
<br />
<syntaxhighlight lang="lua">function escapeMe ( commandName )<br />
local x, y, z = getElementPosition ( localPlayer ) --Get player's position<br />
setElementPosition ( localPlayer, x+(math.random(-10,10)), y+(math.random(-10,10)), z+(math.random(1,15)) ) --Move a player randomly to a nearby location. X is current x + a number between -10, 10 and so on.<br />
end <br />
addCommandHandler ( "escape", escapeMe ) --When player types "/escape" in chatbox or "escape" in console<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Server functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=SetObjectStatic&diff=44810SetObjectStatic2015-03-20T16:06:59Z<p>Pawelo: Fixed typo</p>
<hr />
<div>__NOTOC__<br />
{{Client function}}<br />
{{Deprecated|setElementFrozen|}}<br />
<br />
Makes an object static or non-static. Static objects are rock solid in one place, unaffected by gravity and pushing. Nonstatic objects can fall, be pushed around etc.<br />
<br />
'''Note1:''' Not all objects that are static by default can be made nonstatic.<br\><br />
'''Note2:''' Dynamic objects with a "destroyed" state are still destroyable. Use [[isElementOnScreen]] to detect, destroy, and recreate these objects.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool setObjectStatic ( object theObject, bool toggle )<br />
</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''theObject:''' the object whose behaviour you want to change.<br />
*'''toggle:''' ''true'' makes the object static, ''false'' makes it nonstatic.<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
<br />
==Example==<br />
<br />
==See Also==<br />
{{Client_object_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=GetKeyBoundToCommand&diff=44434GetKeyBoundToCommand2015-02-09T20:03:50Z<p>Pawelo: </p>
<hr />
<div>__NOTOC__<br />
{{Client function}}<br />
This function allow you get first key bound to command.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
string getKeyBoundToCommand( string command )<br />
</syntaxhighlight><br />
<br />
===Required Arguments=== <br />
*'''command:''' command what you need check.<br />
<br />
===Returns===<br />
Returns a string of first key binded to current command.<br />
<br />
==Example== <br />
This example adds a /getcommandbind command, allowing players to see what keys are bound to the given command.<br />
<syntaxhighlight lang="lua"><br />
--This function is executed when the player uses the /getcommandbind [command] command.<br />
--It outputs the key the command is bound to (if it is bound).<br />
local function playerCommand(_, command)<br />
if not command then --if no command name was given, output a syntax error message.<br />
outputChatBox("* Syntax: /getcommandbind [command name] .", 255, 0, 0)<br />
return<br />
end<br />
<br />
local keyName = getKeyBoundToCommand(command)<br />
if keyName then<br />
outputChatBox("* The command /"..command.." is bound to the "..keyName.." key.", 0, 0, 255)<br />
else<br />
outputChatBox("* The command /"..command.." is not bound to any keys.", 0, 0, 255)<br />
end<br />
end<br />
addCommandHandler("getcommandbind", playerCommand)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Input_functions}}</div>Pawelohttps://wiki.multitheftauto.com/index.php?title=OOP_client&diff=43334OOP client2014-12-17T19:19:56Z<p>Pawelo: Added missing `destroy` method in Element class</p>
<hr />
<div>The new OOP in MTA allows for better code organization and readability. This is a list of [[Client_Scripting_Functions|client-side functions]].<br />
<br />
''See also: [[OOP]]''<br />
<br />
<br />
==Element==<br />
<br />
areCollisionsEnabled (function: [[getElementCollisionsEnabled]])<br />
attach (function: [[attachElements]])<br />
clearVisibleTo (function: [[clearElementVisibleTo]])<br />
clone (function: [[cloneElement]])<br />
create (function: [[createElement]])<br />
destroy (function: [[destroyElement]])<br />
detach (function: [[detachElements]])<br />
getAllByType (function: [[getElementsByType]])<br />
getAllData (function: [[getAllElementData]])<br />
getAlpha (function: [[getElementAlpha]])<br />
getAttachedElements (function: [[getAttachedElements]])<br />
getAttachedOffsets (function: [[getElementAttachedOffsets]])<br />
getAttachedTo (function: [[getElementAttachedTo]])<br />
getBoundingBox (function: [[getElementBoundingBox]])<br />
getByID (function: [[getElementByID]])<br />
getByType (function: [[getElementsByType]])<br />
getChild (function: [[getElementChild]])<br />
getChildren (function: [[getElementChildren]])<br />
getChildrenCount (function: [[getElementChildrenCount]])<br />
getColShape (function: [[getElementColShape]])<br />
getData (function: [[getElementData]])<br />
getDimension (function: [[getElementDimension]])<br />
getDistanceFromCentreOfMassToBaseOfModel (function: [[GetElementDistanceFromCentreOfMassToBaseOfModel]])<br />
getHealth (function: [[getElementHealth]])<br />
getID (function: [[getElementID]])<br />
getInterior (function: [[getElementInterior]])<br />
getLowLOD (function: [[getLowLODElement]])<br />
getModel (function: [[getElementModel]])<br />
getParent (function: [[getElementParent]])<br />
getSyncer (function: [[getElementSyncer]])<br />
getType (function: [[getElementType]])<br />
getVelocity (function: [[getElementVelocity]])<br />
getWithinColShape (function: [[getElementsWithinColShape]])<br />
getZoneName (function: [[getElementZoneName]])<br />
isAttached (function: [[isElementAttached]])<br />
isCallPropagationEnabled (function: [[isElementCallPropagationEnabled]])<br />
isDoubleSided (function: [[isElementDoubleSided]])<br />
isFrozen (function: [[isElementFrozen]])<br />
isInWater (function: [[isElementInWater]])<br />
isLowLOD (function: [[isElementLowLOD]])<br />
isVisibleTo (function: [[isElementVisibleTo]])<br />
isWithinColShape (function: [[isElementWithinColShape]])<br />
isWithinMarker (function: [[isElementWithinMarker]])<br />
removeData (function: [[removeElementData]])<br />
setAlpha (function: [[setElementAlpha]])<br />
setAttachedOffsets (function: [[setElementAttachedOffsets]])<br />
setCallPropagationEnabled (function: [[setElementCallPropagationEnabled]])<br />
setCollisionsEnabled (function: [[setElementCollisionsEnabled]])<br />
setData (function: [[setElementData]])<br />
setDimension (function: [[setElementDimension]])<br />
setDoubleSided (function: [[setElementDoubleSided]])<br />
setFrozen (function: [[setElementFrozen]])<br />
setHealth (function: [[setElementHealth]])<br />
setID (function: [[setElementID]])<br />
setInterior (function: [[setElementInterior]])<br />
setLowLOD (function: [[setLowLODElement]])<br />
setMatrix (function: [[setElementMatrix]])<br />
setModel (function: [[setElementModel]])<br />
setParent (function: [[setElementParent]])<br />
setPosition (function: [[setElementPosition]])<br />
setVelocity (function: [[setElementVelocity]])<br />
setVisibleTo (function: [[setElementVisibleTo]])<br />
<br />
==Vehicle==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
addUpgrade (function: [[addVehicleUpgrade]])<br />
attachTrailer (function: [[attachTrailerToVehicle]])<br />
blow (function: [[blowVehicle]])<br />
create (function: [[createVehicle]])<br />
detachTrailer (function: [[detachTrailerFromVehicle]])<br />
fix (function: [[fixVehicle]])<br />
getAdjustableProperty (function: [[getVehicleAdjustableProperty]])<br />
getColor (function: [[getVehicleColor]])<br />
getCompatibleUpgrades (function: [[getVehicleCompatibleUpgrades]])<br />
getComponentPosition (function: [[getVehicleComponentPosition]])<br />
getComponentRotation (function: [[getVehicleComponentRotation]])<br />
getComponents (function: [[getVehicleComponents]])<br />
getComponentVisible (function: [[getVehicleComponentVisible]])<br />
getController (function: [[getVehicleController]])<br />
getDoorOpenRatio (function: [[getVehicleDoorOpenRatio]])<br />
getDoorState (function: [[getVehicleDoorState]])<br />
getEngineState (function: [[getVehicleEngineState]])<br />
getGear (function: [[getVehicleCurrentGear]])<br />
getGravity (function: [[getVehicleGravity]])<br />
getHandling (function: [[getVehicleHandling]])<br />
getHeadLightColor (function: [[getVehicleHeadLightColor]])<br />
getHelicopterRotorSpeed (function: [[getHelicopterRotorSpeed]])<br />
getLandingGearDown (function: [[getVehicleLandingGearDown]])<br />
getLightState (function: [[getVehicleLightState]])<br />
getMaxPassengers (function: [[getVehicleMaxPassengers]])<br />
getName (function: [[getVehicleName]])<br />
getNitroCount (function: [[getVehicleNitroCount]])<br />
getNitroLevel (function: [[getVehicleNitroLevel]])<br />
getOccupant (function: [[getVehicleOccupant]])<br />
getOccupants (function: [[getVehicleOccupants]])<br />
getOverrideLights (function: [[getVehicleOverrideLights]])<br />
getPaintjob (function: [[getVehiclePaintjob]])<br />
getPanelState (function: [[getVehiclePanelState]])<br />
getPlateText (function: [[getVehiclePlateText]])<br />
getSirens (function: [[getVehicleSirens]])<br />
getSirensOn (function: [[getVehicleSirensOn]])<br />
getTowedByVehicle (function: [[getVehicleTowedByVehicle]])<br />
getTowingVehicle (function: [[getVehicleTowingVehicle]])<br />
getTrainDirection (function: [[getTrainDirection]])<br />
getTrainSpeed (function: [[getTrainSpeed]])<br />
getTurnVelocity (function: [[getVehicleTurnVelocity]])<br />
getTurretPosition (function: [[getVehicleTurretPosition]])<br />
getUpgrades (function: [[getVehicleUpgrades]])<br />
getUpgradeSlotName (function: [[getVehicleUpgradeSlotName]])<br />
getVariant (function: [[getVehicleVariant]])<br />
getVehicleType (function: [[getVehicleType]])<br />
getWheelStates (function: [[getVehicleWheelStates]])<br />
isBlown (function: [[isVehicleBlown]])<br />
isDamageProof (function: [[isVehicleDamageProof]])<br />
isFuelTankExplodable (function: [[isVehicleFuelTankExplodable]])<br />
isLocked (function: [[isVehicleLocked]])<br />
isNitroActivated (function: [[isVehicleNitroActivated]])<br />
isNitroRecharging (function: [[isVehicleNitroRecharging]])<br />
isOnGround (function: [[isVehicleOnGround]])<br />
isTaxiLightOn (function: [[isVehicleTaxiLightOn]])<br />
isTrainDerailable (function: [[setTrainDerailable]])<br />
isTrainDerailed (function: [[isTrainDerailed]])<br />
removeUpgrade (function: [[removeVehicleUpgrade]])<br />
resetComponentPosition (function: [[resetVehicleComponentPosition]])<br />
resetComponentRotation (function: [[resetVehicleComponentRotation]])<br />
setAdjustableProperty (function: [[setVehicleAdjustableProperty]])<br />
setColor (function: [[setVehicleColor]])<br />
setComponentPosition (function: [[setVehicleComponentPosition]])<br />
setComponentRotation (function: [[setVehicleComponentRotation]])<br />
setComponentVisible (function: [[setVehicleComponentVisible]])<br />
setDamageProof (function: [[setVehicleDamageProof]])<br />
setDirtLevel (function: [[setVehicleDirtLevel]])<br />
setDoorOpenRatio (function: [[setVehicleDoorOpenRatio]])<br />
setDoorState (function: [[setVehicleDoorState]])<br />
setDoorsUndamageable (function: [[setVehicleDoorsUndamageable]])<br />
setEngineState (function: [[setVehicleEngineState]])<br />
setFuelTankExplodable (function: [[setVehicleFuelTankExplodable]])<br />
setGravity (function: [[setVehicleGravity]])<br />
setHeadLightColor (function: [[setVehicleHeadLightColor]])<br />
setHelicopterRotorSpeed (function: [[setHelicopterRotorSpeed]])<br />
setLandingGearDown (function: [[setVehicleLandingGearDown]])<br />
setLightState (function: [[setVehicleLightState]])<br />
setLocked (function: [[setVehicleLocked]])<br />
setNitroActivated (function: [[setVehicleNitroActivated]])<br />
setNitroCount (function: [[setVehicleNitroCount]])<br />
setNitroLevel (function: [[setVehicleNitroLevel]])<br />
setOverrideLights (function: [[setVehicleOverrideLights]])<br />
setPaintjob (function: [[setVehiclePaintjob]])<br />
setPanelState (function: [[setVehiclePanelState]])<br />
setSirens (function: [[setVehicleSirens]])<br />
setSirensOn (function: [[setVehicleSirensOn]])<br />
setTaxiLightOn (function: [[setVehicleTaxiLightOn]])<br />
setTrainDerailable (function: [[setTrainDerailable]])<br />
setTrainDerailed (function: [[setTrainDerailed]])<br />
setTrainDirection (function: [[setTrainDirection]])<br />
setTrainSpeed (function: [[setTrainSpeed]])<br />
setTurnVelocity (function: [[setVehicleTurnVelocity]])<br />
setTurretPosition (function: [[setVehicleTurretPosition]])<br />
setVariant (function: [[setVehicleVariant]])<br />
setWheelStates (function: [[setVehicleWheelStates]])<br />
<br />
==Ped==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
addClothes (function: [[addPedClothes]])<br />
canBeKnockedOffBike (function: [[canPedBeKnockedOffBike]])<br />
create (function: [[createPed]])<br />
doesHaveJetPack (function: [[doesPedHaveJetPack]])<br />
getAmmoInClip (function: [[getPedAmmoInClip]])<br />
getAnalogControlState (function: [[getPedAnalogControlState]])<br />
getAnimation (function: [[getPedAnimation]])<br />
getAnimationData (function: [[getPedAnimationData]])<br />
getArmor (function: [[getPedArmor]])<br />
getBodyPartName (function: [[getBodyPartName]])<br />
getBonePosition (function: [[getPedBonePosition]])<br />
getCameraRotation (function: [[getPedCameraRotation]])<br />
getClothes (function: [[getPedClothes]])<br />
getClothesByTypeIndex (function: [[getClothesByTypeIndex]])<br />
getClothesTypeName (function: [[getClothesTypeName]])<br />
getContactElement (function: [[getPedContactElement]])<br />
getControlState (function: [[getPedControlState]])<br />
getMoveState (function: [[getPedMoveState]])<br />
getOccupiedVehicle (function: [[GetPedOccupiedVehicle]])<br />
getOxygenLevel (function: [[getPedOxygenLevel]])<br />
getSimplestTask (function: [[getPedSimplestTask]])<br />
getStat (function: [[getPedStat]])<br />
getTarget (function: [[getPedTarget]])<br />
getTargetCollision (function: [[getPedTargetCollision]])<br />
getTargetEnd (function: [[getPedTargetEnd]])<br />
getTargetStart (function: [[getPedTargetStart]])<br />
getTask (function: [[getPedTask]])<br />
getTotalAmmo (function: [[getPedTotalAmmo]])<br />
getTypeIndexFromClothes (function: [[getTypeIndexFromClothes]])<br />
getValidModels (function: [[getValidPedModels]])<br />
getVoice (function: [[getPedVoice]])<br />
getWalkingStyle (function: [[getPedWalkingStyle]])<br />
getWeapon (function: [[getPedWeapon]])<br />
getWeaponMuzzlePosition (function: [[getPedWeaponMuzzlePosition]])<br />
isChocking (function: [[isPedChoking]])<br />
isDoingGangDriveby (function: [[isPedDoingGangDriveby]])<br />
isDoingTask (function: [[isPedDoingTask]])<br />
isDucked (function: [[isPedDucked]])<br />
isHeadless (function: [[isPedHeadless]])<br />
isInVehicle (function: [[isPedInVehicle]])<br />
isOnFire (function: [[isPedOnFire]])<br />
isOnGround (function: [[isPedOnGround]])<br />
isTargetingMarkerEnabled (function: [[isPedTargetingMarkerEnabled]])<br />
removeClothes (function: [[removePedClothes]])<br />
removeFromVehicle (function: [[removePedFromVehicle]])<br />
setAimTarget (function: [[setPedAimTarget]])<br />
setAnalogControlState (function: [[setPedAnalogControlState]])<br />
setAnimation (function: [[setPedAnimation]])<br />
setAnimationProgress (function: [[setPedAnimationProgress]])<br />
setCameraRotation (function: [[setPedCameraRotation]])<br />
setCanBeKnockedOffBike (function: [[setPedCanBeKnockedOffBike]])<br />
setControlState (function: [[setPedControlState]])<br />
setDoingGangDriveby (function: [[setPedDoingGangDriveby]])<br />
setFootBloodEnabled (function: [[setPedFootBloodEnabled]])<br />
setHeadless (function: [[setPedHeadless]])<br />
setLookAt (function: [[setPedLookAt]])<br />
setOnFire (function: [[setPedOnFire]])<br />
setOxygenLevel (function: [[setPedOxygenLevel]])<br />
setTargetingMarkerEnabled (function: [[setPedTargetingMarkerEnabled]])<br />
setVoice (function: [[setPedVoice]])<br />
setWalkingStyle (function: [[setPedWalkingStyle]])<br />
setWeaponSlot (function: [[setPedWeaponSlot]])<br />
warpIntoVehicle (function: [[warpPedIntoVehicle]])<br />
<br />
==Player==<br />
''Inherited from [[#Ped|Ped]]''<br />
<br />
create (function: [[getPlayerFromName]])<br />
getBlurLevel (function: [[getPlayerBlurLevel]])<br />
getMapBoundingBox (function: [[getPlayerMapBoundingBox]])<br />
getMoney (function: [[getPlayerMoney]])<br />
getName (function: [[getPlayerName]])<br />
getNametagColor (function: [[getPlayerNametagColor]])<br />
getNametagText (function: [[getPlayerNametagText]])<br />
getPing (function: [[getPlayerPing]])<br />
getSerial (function: [[getPlayerSerial]])<br />
getTeam (function: [[getPlayerTeam]])<br />
getWantedLevel (function: [[getPlayerWantedLevel]])<br />
giveMoney (function: [[givePlayerMoney]])<br />
isHudComponentVisible (function: [[isPlayerHudComponentVisible]])<br />
isMapForced (function: [[isPlayerMapForced]])<br />
isMapVisible (function: [[isPlayerMapVisible]])<br />
isNametagShowing (function: [[isPlayerNametagShowing]])<br />
setBlurLevel (function: [[setPlayerBlurLevel]])<br />
setMoney (function: [[setPlayerMoney]])<br />
setNametagColor (function: [[setPlayerNametagColor]])<br />
setNametagShowing (function: [[setPlayerNametagShowing]])<br />
setNametagText (function: [[setPlayerNametagText]])<br />
showHudComponent (function: [[showPlayerHudComponent]])<br />
takeMoney (function: [[takePlayerMoney]])<br />
<br />
==Object==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
break (function: [[breakObject]])<br />
create (function: [[createObject]])<br />
getMass (function: [[getObjectMass]])<br />
getScale (function: [[getObjectScale]])<br />
isBreakable (function: [[isObjectBreakable]])<br />
move (function: [[moveObject]])<br />
respawn (function: [[respawnObject]])<br />
setBreakable (function: [[setObjectBreakable]])<br />
setMass (function: [[setObjectMass]])<br />
setScale (function: [[setObjectScale]])<br />
stop (function: [[stopObject]])<br />
toggleObjectRespawn (function: [[toggleObjectRespawn]])<br />
<br />
==Marker==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[createMarker]])<br />
getColor (function: [[getMarkerColor]])<br />
getCount (function: [[getMarkerCount]])<br />
getIcon (function: [[getMarkerIcon]])<br />
getSize (function: [[getMarkerSize]])<br />
getTarget (function: [[getMarkerTarget]])<br />
getType (function: [[getMarkerType]])<br />
setColor (function: [[setMarkerColor]])<br />
setIcon (function: [[setMarkerIcon]])<br />
setSize (function: [[setMarkerSize]])<br />
setTarget (function: [[setMarkerTarget]])<br />
setType (function: [[setMarkerType]])<br />
<br />
==Blip==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[createBlip]])<br />
createAttachedTo (function: [[createBlipAttachedTo]])<br />
getColor (function: [[getBlipColor]])<br />
getIcon (function: [[getBlipIcon]])<br />
getOrdering (function: [[getBlipOrdering]])<br />
getSize (function: [[getBlipSize]])<br />
getVisibleDistance (function: [[getBlipVisibleDistance]])<br />
setColor (function: [[setBlipColor]])<br />
setIcon (function: [[setBlipIcon]])<br />
setOrdering (function: [[setBlipOrdering]])<br />
setSize (function: [[setBlipSize]])<br />
setVisibleDistance (function: [[setBlipVisibleDistance]])<br />
<br />
==Pickup==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[createPickup]])<br />
getAmmo (function: [[getPickupAmmo]])<br />
getAmount (function: [[getPickupAmount]])<br />
getType (function: [[getPickupType]])<br />
getWeapon (function: [[getPickupWeapon]])<br />
setType (function: [[setPickupType]])<br />
<br />
==ColShape==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
Circle (function: [[createColCircle]])<br />
Cuboid (function: [[createColCuboid]])<br />
getElementsWithin (function: [[getElementsWithinColShape]])<br />
isElementWithin (function: [[isElementWithinColShape]])<br />
Polygon (function: [[createColPolygon]])<br />
Rectangle (function: [[createColRectangle]])<br />
Sphere (function: [[createColSphere]])<br />
Tube (function: [[createColTube]])<br />
<br />
==Projectile==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[createProjectile]])<br />
getCounter (function: [[getProjectileCounter]])<br />
getCreator (function: [[getProjectileCreator]])<br />
getForce (function: [[getProjectileForce]])<br />
getTarget (function: [[getProjectileTarget]])<br />
getType (function: [[getProjectileType]])<br />
setCounter (function: [[setProjectileCounter]])<br />
<br />
==RadarArea==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[createRadarArea]])<br />
getColor (function: [[getRadarAreaColor]])<br />
getSize (function: [[getRadarAreaSize]])<br />
isFlashing (function: [[isRadarAreaFlashing]])<br />
isInside (function: [[isInsideRadarArea]])<br />
setColor (function: [[setRadarAreaColor]])<br />
setFlashing (function: [[setRadarAreaFlashing]])<br />
setSize (function: [[setRadarAreaSize]])<br />
<br />
==Team==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
countPlayers (function: [[countPlayersInTeam]])<br />
create (function: [[getTeamFromName]])<br />
getColor (function: [[getTeamColor]])<br />
getFriendlyFire (function: [[getTeamFriendlyFire]])<br />
getFromName (function: [[getTeamFromName]])<br />
getName (function: [[getTeamName]])<br />
<br />
==Water==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[createWater]])<br />
getColor (function: [[getWaterColor]])<br />
getLevel (function: [[getWaterLevel]])<br />
getVertexPosition (function: [[getWaterVertexPosition]])<br />
getWaveHeight (function: [[getWaveHeight]])<br />
isDrawnLast (function: [[isWaterDrawnLast]])<br />
resetColor (function: [[resetWaterColor]])<br />
resetLevel (function: [[resetWaterLevel]])<br />
setColor (function: [[setWaterColor]])<br />
setDrawnLast (function: [[setWaterDrawnLast]])<br />
setLevel (function: [[setWaterLevel]])<br />
setVertexPosition (function: [[setWaterVertexPosition]])<br />
setWaveHeight (function: [[setWaveHeight]])<br />
testLineAgainst (function: [[testLineAgainstWater]])<br />
<br />
==Sound==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[playSound]])<br />
getBPM (function: [[getSoundBPM]])<br />
getEffects (function: [[getSoundEffects]])<br />
getFFTData (function: [[getSoundFFTData]])<br />
getLength (function: [[getSoundLength]])<br />
getLevelData (function: [[getSoundLevelData]])<br />
getMetaTags (function: [[getSoundMetaTags]])<br />
getPan (function: [[getSoundPan]])<br />
getPlaybackPosition (function: [[getSoundPosition]])<br />
getProperties (function: [[getSoundProperties]])<br />
getSpeed (function: [[getSoundSpeed]])<br />
getVolume (function: [[getSoundVolume]])<br />
getWaveData (function: [[getSoundWaveData]])<br />
isPaused (function: [[isSoundPaused]])<br />
setEffectEnabled (function: [[setSoundEffectEnabled]])<br />
setPan (function: [[setSoundPan]])<br />
setPaused (function: [[setSoundPaused]])<br />
setPlaybackPosition (function: [[setSoundPosition]])<br />
setProperties (function: [[setSoundProperties]])<br />
setSpeed (function: [[setSoundSpeed]])<br />
setVolume (function: [[setSoundVolume]])<br />
stop (function: [[stopSound]])<br />
<br />
==Sound3D==<br />
''Inherited from [[#Sound|Sound]]''<br />
<br />
create (function: [[playSound3D]])<br />
getMaxDistance (function: [[getSoundMaxDistance]])<br />
getMinDistance (function: [[getSoundMinDistance]])<br />
setMaxDistance (function: [[setSoundMaxDistance]])<br />
setMinDistance (function: [[setSoundMinDistance]])<br />
<br />
==Weapon==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[createWeapon]])<br />
fire (function: [[fireWeapon]])<br />
getAmmo (function: [[getWeaponAmmo]])<br />
getClipAmmo (function: [[getWeaponClipAmmo]])<br />
getFiringRate (function: [[getWeaponFiringRate]])<br />
getFlags (function: [[getWeaponFlags]])<br />
getOwner (function: [[getWeaponOwner]])<br />
getProperty (function: [[setWeaponProperty]])<br />
getState (function: [[getWeaponState]])<br />
getTarget (function: [[getWeaponTarget]])<br />
resetFiringRate (function: [[resetWeaponFiringRate]])<br />
setAmmo (function: [[setWeaponAmmo]])<br />
setClipAmmo (function: [[setWeaponClipAmmo]])<br />
setFiringRate (function: [[setWeaponFiringRate]])<br />
setFlags (function: [[setWeaponFlags]])<br />
setOwner (function: [[setWeaponOwner]])<br />
setProperty (function: [[setWeaponProperty]])<br />
setState (function: [[setWeaponState]])<br />
setTarget (function: [[setWeaponTarget]])<br />
<br />
==Effect==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
addBlood (function: [[fxAddBlood]])<br />
addBulletImpact (function: [[fxAddBulletImpact]])<br />
addBulletSplash (function: [[fxAddBulletSplash]])<br />
addDebris (function: [[fxAddDebris]])<br />
addFootSplash (function: [[fxAddFootSplash]])<br />
addGlass (function: [[fxAddGlass]])<br />
addGunshot (function: [[fxAddGunshot]])<br />
addPunchImpact (function: [[fxAddPunchImpact]])<br />
addSparks (function: [[fxAddSparks]])<br />
addTankFire (function: [[fxAddTankFire]])<br />
addTyreBurst (function: [[fxAddTyreBurst]])<br />
addWaterHydrant (function: [[fxAddWaterHydrant]])<br />
addWaterSplash (function: [[fxAddWaterSplash]])<br />
addWood (function: [[fxAddWood]])<br />
create (function: [[createEffect]])<br />
getDensity (function: [[getEffectDensity]])<br />
getSpeed (function: [[getEffectSpeed]])<br />
setDensity (function: [[setEffectDensity]])<br />
setSpeed (function: [[setEffectSpeed]])<br />
<br />
==GuiElement==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
bringToFront (function: [[guiBringToFront]])<br />
moveToBack (function: [[guiMoveToBack]])<br />
isChatBoxInputActive (function: [[isChatBoxInputActive]])<br />
isConsoleActive (function: [[isConsoleActive]])<br />
isDebugViewActive (function: [[isDebugViewActive]])<br />
isMainMenuActive (function: [[isMainMenuActive]])<br />
isMTAWindowActive (function: [[isMTAWindowActive]])<br />
isTransferBoxActive (function: [[isTransferBoxActive]])<br />
isInputEnabled (function: [[guiGetInputEnabled]])<br />
getInputMode (function: [[guiGetInputMode]])<br />
getScreenSize (function: [[guiGetScreenSize]])<br />
getProperties (function: [[guiGetProperties]])<br />
getAlpha (function: [[guiGetAlpha]])<br />
getFont (function: [[guiGetFont]])<br />
getEnabled (function: [[guiGetEnabled]])<br />
getVisible (function: [[guiGetVisible]])<br />
getText (function: [[guiGetText]])<br />
getPosition (function: [[guiGetPosition]])<br />
getSize (function: [[guiGetSize]])<br />
getProperty (function: [[guiGetProperty]])<br />
setInputEnabled (function: [[guiSetInputEnabled]])<br />
setAlpha (function: [[guiSetAlpha]])<br />
setEnabled (function: [[guiSetEnabled]])<br />
setFont (function: [[guiSetFont]])<br />
setVisible (function: [[guiSetVisible]])<br />
setText (function: [[guiSetText]])<br />
setInputMode (function: [[guiSetInputMode]])<br />
setProperty (function: [[guiSetProperty]])<br />
setPosition (function: [[guiSetPosition]])<br />
setSize (function: [[guiSetSize]])<br />
==GuiWindow==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateWindow]])<br />
setMovable (function: [[guiWindowSetMovable]])<br />
setSizable (function: [[guiWindowSetSizable]])<br />
==GuiButton==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateButton]])<br />
==GuiEdit==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateEdit]])<br />
getCaretIndex (function: [[guiEditGetCaretIndex]])<br />
setCaretIndex (function: [[guiEditSetCaretIndex]])<br />
setReadOnly (function: [[guiEditSetReadOnly]])<br />
setMasked (function: [[guiEditSetMasked]])<br />
setMaxLength (function: [[guiEditSetMaxLength]])<br />
==GuiLabel==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateLabel]])<br />
getFontHeight (function: [[guiLabelGetFontHeight]])<br />
getTextExtent (function: [[guiLabelGetTextExtent]])<br />
getColor (function: [[guiLabelGetColor]])<br />
setColor (function: [[guiLabelSetColor]])<br />
setHorizontalAlign (function: [[guiLabelSetHorizontalAlign]])<br />
setVerticalAlign (function: [[guiLabelSetVerticalAlign]])<br />
==GuiMemo==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateMemo]])<br />
getCaretIndex (function: [[guiMemoGetCaretIndex]])<br />
setCaretIndex (function: [[guiMemoSetCaretIndex]])<br />
setReadOnly (function: [[guiMemoSetReadOnly]])<br />
==GuiStaticImage==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateStaticImage]])<br />
loadImage (function: [[guiStaticImageLoadImage]])<br />
==GuiComboBox==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateComboBox]])<br />
addItem (function: [[guiComboBoxAddItem]])<br />
clear (function: [[guiComboBoxClear]])<br />
removeItem (function: [[guiComboBoxRemoveItem]])<br />
getSelected (function: [[guiComboBoxGetSelected]])<br />
getItemText (function: [[guiComboBoxGetItemText]])<br />
setItemText (function: [[guiComboBoxSetItemText]])<br />
setSelected (function: [[guiComboBoxSetSelected]])<br />
==GuiCheckBox==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateCheckBox]])<br />
getSelected (function: [[guiCheckBoxGetSelected]])<br />
setSelected (function: [[guiCheckBoxSetSelected]])<br />
==GuiRadioButton==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateRadioButton]])<br />
getSelected (function: [[guiRadioButtonGetSelected]])<br />
setSelected (function: [[guiRadioButtonSetSelected]])<br />
==GuiScrollPane==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateScrollPane]])<br />
getHorizontalScrollPosition (function: [[guiScrollPaneGetHorizontalScrollPosition]])<br />
getVerticalScrollPosition (function: [[guiScrollPaneGetVerticalScrollPosition]])<br />
setHorizontalScrollPosition (function: [[guiScrollPaneSetHorizontalScrollPosition]])<br />
setScrollBars (function: [[guiScrollPaneSetScrollBars]])<br />
setVerticalScrollPosition (function: [[guiScrollPaneSetVerticalScrollPosition]])<br />
==GuiScrollBar==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateScrollBar]])<br />
getScrollPosition (function: [[guiScrollBarGetScrollPosition]])<br />
setScrollPosition (function: [[guiScrollBarSetScrollPosition]])<br />
==GuiProgressBar==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateProgressBar]])<br />
getProgress (function: [[guiProgressBarGetProgress]])<br />
setProgress (function: [[guiProgressBarSetProgress]])<br />
==GuiGridlist==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateGridList]])<br />
addColumn (function: [[guiGridListAddColumn]])<br />
addRow (function: [[guiGridListAddRow]])<br />
autoSizeColumn (function: [[guiGridListAutoSizeColumn]])<br />
clear (function: [[guiGridListClear]])<br />
insertRowAfter (function: [[guiGridListInsertRowAfter]])<br />
removeColumn (function: [[guiGridListRemoveColumn]])<br />
removeRow (function: [[guiGridListRemoveRow]])<br />
getItemData (function: [[guiGridListGetItemData]])<br />
getItemText (function: [[guiGridListGetItemText]])<br />
getRowCount (function: [[guiGridListGetRowCount]])<br />
getSelectedItem (function: [[guiGridListGetSelectedItem]])<br />
getItemColor (function: [[guiGridListGetItemColor]])<br />
getColumnTitle (function: [[guiGridListGetColumnTitle]])<br />
getHorizontalScrollPosition (function: [[guiGridListGetHorizontalScrollPosition]])<br />
getVerticalScrollPosition (function: [[guiGridListGetVerticalScrollPosition]])<br />
getSelectedCount (function: [[guiGridListGetSelectedCount]])<br />
getSelectedItems (function: [[guiGridListGetSelectedItems]])<br />
getColumnCount (function: [[guiGridListGetColumnCount]])<br />
setItemData (function: [[guiGridListSetItemData]])<br />
setItemText (function: [[guiGridListSetItemText]])<br />
setScrollBars (function: [[guiGridListSetScrollBars]])<br />
setSelectedItem (function: [[guiGridListSetSelectedItem]])<br />
setSelectionMode (function: [[guiGridListSetSelectionMode]])<br />
setSortingEnabled (function: [[guiGridListSetSortingEnabled]])<br />
setColumnWidth (function: [[guiGridListSetColumnWidth]])<br />
setItemColor (function: [[guiGridListSetItemColor]])<br />
setColumnTitle (function: [[guiGridListSetColumnTitle]])<br />
setHorizontalScrollPosition (function: [[guiGridListSetHorizontalScrollPosition]])<br />
setVerticalScrollPosition (function: [[guiGridListSetVerticalScrollPosition]])<br />
==GuiTabPanel==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateTabPanel]])<br />
getSelectedTab (function: [[guiGetSelectedTab]])<br />
setSelectedTab (function: [[guiSetSelectedTab]])<br />
==GuiTab==<br />
''Inherited from [[#GuiElement|GuiElement]]''<br />
<br />
create (function: [[guiCreateTab]])<br />
delete (function: [[guiDeleteTab]])<br />
==GuiFont==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[guiCreateFont]])<br />
==Resource==<br />
create (function: [[getResourceFromName]])<br />
fromName (function: [[getResourceFromName]])<br />
getGuiElement (function: [[getResourceGUIElement]])<br />
getRootElement (function: [[getResourceRootElement]])<br />
getName (function: [[getResourceName]])<br />
getThis (function: [[getThisResource]])<br />
getConfig (function: [[getResourceConfig]])<br />
getConfig (function: [[getResourceConfig]])<br />
getDynamicElementRoot (function: [[getResourceDynamicElementRoot]])<br />
getExportedFunctions (function: [[getResourceExportedFunctions]])<br />
getState (function: [[getResourceState]])<br />
==Timer==<br />
create (function: [[setTimer]])<br />
destroy (function: [[killTimer]])<br />
reset (function: [[resetTimer]])<br />
isValid (function: [[isTimer]])<br />
getDetails (function: [[getTimerDetails]])<br />
==File==<br />
create (function: [[fileOpen]])<br />
destroy (function: [[fileClose]])<br />
close (function: [[fileClose]])<br />
new (function: [[fileCreate]])<br />
delete (function: [[fileDelete]])<br />
exists (function: [[fileExists]])<br />
flush (function: [[fileFlush]])<br />
getPos (function: [[fileGetPos]])<br />
getSize (function: [[fileGetSize]])<br />
isEOF (function: [[fileIsEOF]])<br />
read (function: [[fileRead]])<br />
rename (function: [[fileRename]])<br />
setPos (function: [[fileSetPos]])<br />
write (function: [[fileWrite]])<br />
copy (function: [[fileCopy]])<br />
==XML==<br />
load (function: [[xmlLoadFile]])<br />
unload (function: [[xmlUnloadFile]])<br />
copy (function: [[xmlCopyFile]])<br />
create (function: [[xmlCreateFile]])<br />
destroy (function: [[xmlDestroyNode]])<br />
setValue (function: [[xmlNodeGetValue]])<br />
setAttribute (function: [[xmlNodeSetAttribute]])<br />
setValue (function: [[xmlNodeSetValue]])<br />
saveFile (function: [[xmlSaveFile]])<br />
createChild (function: [[xmlCreateChild]])<br />
findChild (function: [[xmlFindChild]])<br />
getAttributes (function: [[xmlNodeGetAttributes]])<br />
getChildren (function: [[xmlNodeGetChildren]])<br />
getName (function: [[xmlNodeGetName]])<br />
getParent (function: [[xmlNodeGetParent]])<br />
getAttribute (function: [[xmlNodeGetAttribute]])<br />
setName (function: [[xmlNodeSetName]])<br />
==Camera==<br />
fade (function: [[fadeCamera]])<br />
getTarget (function: [[getCameraTarget]])<br />
getInterior (function: [[getCameraInterior]])<br />
getViewMode (function: [[getCameraViewMode]])<br />
getGoggleEffect (function: [[getCameraGoggleEffect]])<br />
setInterior (function: [[setCameraInterior]])<br />
setTarget (function: [[setCameraTarget]])<br />
setViewMode (function: [[setCameraViewMode]])<br />
setGoggleEffect (function: [[setCameraGoggleEffect]])<br />
setClip (function: [[setCameraClip]])<br />
==Engine==<br />
restoreCOL (function: [[engineRestoreCOL]])<br />
restoreModel (function: [[engineRestoreModel]])<br />
setAsynchronousLoading (function: [[engineSetAsynchronousLoading]])<br />
setModelLODDistance (function: [[engineSetModelLODDistance]])<br />
getVisibleTextureName (function: [[engineGetVisibleTextureNames]])<br />
getModelLODDistance (function: [[engineGetModelLODDistance]])<br />
getModelTextureNames (function: [[engineGetModelTextureNames]])<br />
getModelIDFromName (function: [[engineGetModelIDFromName]])<br />
getModelNameFromID (function: [[engineGetModelNameFromID]])<br />
==EngineCOL==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[engineLoadCOL]])<br />
replace (function: [[engineReplaceCOL]])<br />
==EngineTXD==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[engineLoadTXD]])<br />
import (function: [[engineImportTXD]])<br />
==EngineDFF==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
create (function: [[engineLoadDFF]])<br />
replace (function: [[engineReplaceModel]])<br />
==DxMaterial==<br />
''Inherited from [[#Element|Element]]''<br />
<br />
getSize (function: [[dxGetMaterialSize]])<br />
==DxTexture==<br />
''Inherited from [[#DxMaterial|DxMaterial]]''<br />
<br />
create (function: [[dxCreateTexture]])<br />
setEdge (function: [[dxSetTextureEdge]])<br />
setPixels (function: [[dxSetTexturePixels]])<br />
getPixels (function: [[dxGetTexturePixels]])<br />
==DxFont==<br />
create (function: [[dxCreateFont]])<br />
getHeight (function: [[dxGetFontHeight]])<br />
getTextWidth (function: [[dxGetTextWidth]])<br />
==DxShader==<br />
''Inherited from [[#DxMaterial|DxMaterial]]''<br />
<br />
create (function: [[dxCreateShader]])<br />
setValue (function: [[dxSetShaderValue]])<br />
setTessellation (function: [[dxSetShaderTessellation]])<br />
setTransform (function: [[dxSetShaderTransform]])<br />
value (function: [[dxGetFontHeight]])<br />
==DxScreenSource==<br />
create (function: [[dxCreateScreenSource]])<br />
update (function: [[dxUpdateScreenSource]])<br />
==DxRenderTarget==<br />
create (function: [[dxCreateRenderTarget]])<br />
setAsTarget (function: [[dxSetRenderTarget]])</div>Pawelo