https://wiki.multitheftauto.com/api.php?action=feedcontributions&user=Alex7202&feedformat=atomMulti Theft Auto: Wiki - User contributions [en]2024-03-28T10:14:21ZUser contributionsMediaWiki 1.39.3https://wiki.multitheftauto.com/index.php?title=IfElse&diff=75203IfElse2022-06-30T17:58:32Z<p>Alex7202: </p>
<hr />
<div>{{Useful Function}} __NOTOC__<br />
This function just adds a possibility to integrate a condition in e.g. some variable definition. It is as useful as simple. It's like the short “(c) ? t : f ;” statement that exists in e.g. PHP or JavaScript, or COALESCE in MySQL. It simulates a ternary operation.<br />
<br />
''Note: This function is basically on the wiki to enable using it in other useful functions.''<br />
<!--<br />
The same can be achieved by using this syntax: x = a and b or c<br />
Meaning: "If a is equal to true then x = b, else x = c"<br />
<br />
This operation can be chained too: x = a and (b and ba or bb) or (c and ca or cc)<br />
Meaning: "If a is equal to true then check if b is equal to true and if it is then x = ba, otherwise x = bb.<br />
Else check if c is equal to true and if it is then x = ca, otherwise x = cc."<br />
--><br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">var IfElse( bool condition, var trueReturn, var falseReturn )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''condition''': A condition like you could use it in an if-statement.<br />
* '''trueReturn''': The value that should be returned if the condition is true.<br />
* '''falseReturn''': The value that should be returned if the condition is false.<br />
<br />
===Returns===<br />
Returns the second argument if condition is true, the third otherwise.<br />
<br />
==Code==<br />
<section name="Server- and/or clientside Script" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function IfElse(condition, trueReturn, falseReturn)<br />
if (condition) then return trueReturn<br />
else return falseReturn end<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Server- and/or clientside Script" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function IfElse(condition, trueReturn, falseReturn)<br />
return condition and trueReturn or falseReturn<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
This example adds a command to retrieve the actual player count.<br />
<syntaxhighlight lang="lua"><br />
-- define the commandhandler function<br />
function CmdPlayerCount(source)<br />
-- get the actual player count<br />
local playerCount = getPlayerCount()<br />
-- send message to the player<br />
outputChatBox("There "..IfElse(playerCount == 1, "is", "are").." actually "..playerCount.." Player"..IfElse(playerCount == 1, "", "s").." online.", source)<br />
end<br />
-- add the command handler<br />
addCommandHandler("playerCount", CmdPlayerCount, false, false)<br />
</syntaxhighlight><br />
</section><br />
<br />
Author: NeonBlack<br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=SetVehicleHandlingFromText&diff=75174SetVehicleHandlingFromText2022-06-23T10:56:47Z<p>Alex7202: Created page with "{{Useful Function}} ==Syntax== <syntaxhighlight lang="lua">vehicle setVehicleHandlingFromText( element vehicle, string handling)</syntaxhighlight> ===Required Arguments=== * '''vehicle''': The vehicle that needs to be installed handling. * '''handling''': Text of handling. ==Code== <section name="Server side Script" class="server" show="true"> <syntaxhighlight lang="lua"> local countHandlingTable = { [1] = "mass", [2] = "turnMass", [3] = "dragCoeff", [4] = "centerOf..."</p>
<hr />
<div>{{Useful Function}}<br />
==Syntax==<br />
<syntaxhighlight lang="lua">vehicle setVehicleHandlingFromText( element vehicle, string handling)</syntaxhighlight><br />
===Required Arguments===<br />
* '''vehicle''': The vehicle that needs to be installed handling.<br />
* '''handling''': Text of handling.<br />
<br />
==Code==<br />
<section name="Server side Script" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
local countHandlingTable = {<br />
[1] = "mass",<br />
[2] = "turnMass",<br />
[3] = "dragCoeff",<br />
[4] = "centerOfMassX",<br />
[5] = "centerOfMassY",<br />
[6] = "centerOfMassZ",<br />
[7] = "percentSubmerged",<br />
[8] = "tractionMultiplier",<br />
[9] = "tractionLoss",<br />
[10] = "tractionBias",<br />
[11] = "numberOfGears",<br />
[12] = "maxVelocity",<br />
[13] = "engineAcceleration",<br />
[14] = "engineInertia",<br />
[15] = "driveType",<br />
[16] = "engineType",<br />
[17] = "brakeDeceleration",<br />
[18] = "brakeBias",<br />
[19] = "ABS",<br />
[20] = "steeringLock",<br />
[21] = "suspensionForceLevel",<br />
[22] = "suspensionDamping",<br />
[23] = "suspensionHighSpeedDamping",<br />
[24] = "suspensionUpperLimit",<br />
[25] = "suspensionLowerLimit",<br />
[26] = "suspensionFrontRearBias",<br />
[27] = "suspensionAntiDiveMultiplier",<br />
[28] = "seatOffsetDistance",<br />
[29] = "collisionDamageMultiplier",<br />
[30] = "monetary",<br />
[31] = "modelFlags",<br />
[32] = "handlingFlags",<br />
[33] = "headLight",<br />
[34] = "tailLight",<br />
[35] = "animGroup",<br />
}<br />
<br />
local driveTypes = {<br />
["4"] = "awd",<br />
["r"] = "rwd",<br />
["f"] = "fwd",<br />
}<br />
<br />
function setVehicleHandlingFromText (vehicle, text)<br />
local t = {}<br />
local carID = vehicle.model<br />
local tText = split(text, " ")<br />
table.remove (tText, 1)<br />
local countHandling = 1<br />
for i, v in ipairs (tText) do<br />
t[countHandlingTable[i]] = v<br />
end<br />
<br />
local acceptCenterMass = false<br />
local centerMass = {x = nil, y = nil, z = nil}<br />
for i, v in pairs (t) do<br />
if i == "centerOfMassX" then<br />
centerMass.x = tonumber(v)<br />
elseif i == "centerOfMassY" then<br />
centerMass.y = tonumber(v)<br />
elseif i == "centerOfMassZ" then<br />
centerMass.z = tonumber(v)<br />
else<br />
if centerMass.x and centerMass.y and centerMass.z and not acceptCenterMass then<br />
setVehicleHandling (vehicle, "centerOfMass", {centerMass.x, centerMass.y, centerMass.z})<br />
acceptCenterMass = true<br />
end<br />
<br />
if i == "modelFlags" or i == "handlingFlags" then<br />
setVehicleHandling (vehicle, i, "0x"..tostring(v))<br />
elseif i == "driveType" then<br />
setVehicleHandling (vehicle, i, driveTypes[v])<br />
else<br />
setVehicleHandling (vehicle, i, tonumber(v) or tostring(v))<br />
end<br />
end<br />
end<br />
end<br />
</syntaxhighlight></section><br />
<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=75173Template:Useful Functions2022-06-23T10:53:59Z<p>Alex7202: /* Vehicle functions */</p>
<hr />
<div>__NOTOC__<br />
=== Table functions ===<br />
*[[addTableChangeHandler]] <span style="color:gray; font-size:smaller;">» This function monitors the changes of a table.</span><br />
*[[getTableFromSql]] <span style="color:gray; font-size:smaller;">» This functionality is used to obtain saved tables using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql ]).</span><br />
*[[isValueInTable]] <span style="color:gray; font-size:smaller;">» This function returns true if the value exists in the table, false if the value does not exist in the table.</span><br />
*[[pairsByKeys]] <span style="color:gray; font-size:smaller;">» This function sort pairs table.</span><br />
*[[rangeToTable]] <span style="color:gray; font-size:smaller;">» This function converts a string range to a table containing number values.</span><br />
*[[setTableProtected]] <span style="color:gray; font-size:smaller;">» This function protects a table and makes it read-only.</span><br />
*[[setTableToSql]] <span style="color:gray; font-size:smaller;">» This function is used to save the table in the database (sql).</span><br />
*[[Sort_Functions]] <span style="color:gray; font-size:smaller;">» These functions are able to sort your tables by a key.</span><br />
*[[table.compare]] <span style="color:gray; font-size:smaller;">» This function checks whether two given tables are equal.</span><br />
*[[table.copy]] <span style="color:gray; font-size:smaller;">» This function copies a whole table and all the tables in that table.</span><br />
*[[table.deepmerge]] <span style="color:gray; font-size:smaller;">» This function deep merges two tables. Every nested table will be correspondingly merged.</span><br />
*[[table.element]] <span style="color:gray; font-size:smaller;">» This function returns a new table with only userdata content.</span><br />
*[[table.empty]] <span style="color:gray; font-size:smaller;">» This function checks whether a table is empty.</span><br />
*[[table.fromString]] <span style="color:gray; font-size:smaller;">» This function converts string to a table.</span><br />
*[[table.getRandomRows]] <span style="color:gray; font-size:smaller;">» This function returns random rows from table.</span><br />
*[[table.map]] <span style="color:gray; font-size:smaller;">» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.</span><br />
*[[table.merge]] <span style="color:gray; font-size:smaller;">» This function merges two or more tables together.</span><br />
*[[table.random]] <span style="color:gray; font-size:smaller;">» This function retrieves a random value from a table.</span><br />
*[[table.removeValue]] <span style="color:gray; font-size:smaller;">» This function removes a specified value from a table.</span><br />
*[[table.size]] <span style="color:gray; font-size:smaller;">» This function returns the absolute size of a table.</span><br />
*[[table.toString]] <span style="color:gray; font-size:smaller;">» This function converts table to a string.</span><br />
*[[table.toStringArray]] <span style="color:gray; font-size:smaller;">» This function converts '''array''' to a string.</span><br />
<br />
=== ACL functions ===<br />
*[[aclGroupClone]] <span style="color:gray; font-size:smaller;">» This function clone a group to another group with/without ACLs and/or objects.</span><br />
*[[getAccountsRanks]] <span style="color:gray; font-size:smaller;">» This function is used to detect the account name groups and put them in the chat.</span><br />
*[[getPlayerAcls]] <span style="color:gray; font-size:smaller;">» This function returns a table of all ACL groups on a player.</span><br />
*[[getPlayersInACLGroup]] <span style="color:gray; font-size:smaller;">» This function returns all players in an ACL group.</span><br />
*[[isPlayerInACL]] <span style="color:gray; font-size:smaller;">» This function checks if a player element is in an ACL group.</span><br />
*[[renameAclGroup]] <span style="color:gray; font-size:smaller;">» This function gives an existing ACL group a new name.</span><br />
<br />
=== Account functions ===<br />
*[[getPlayerFromAccountName]] <span style="color:gray; font-size:smaller;">» This function is used to obtain a player by the name of his account.</span><br />
<br />
=== Camera functions ===<br />
*[[smoothMoveCamera]] <span style="color:gray; font-size:smaller;">» This function allows you to create a cinematic camera flight.<br />
<br />
=== Cursor functions ===<br />
*[[getCursorMovedOn]] <span style="color:gray; font-size:smaller;">» This function checks in which way the cursor is currently moving.</span><br />
<br />
=== Drawing functions ===<br />
*[[dxDrawAnimWindow]] <span style="color:gray; font-size:smaller;">» This function draws an animated 2D window on the screen.</span><br />
*[[dxDrawBorderedRectangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a bordered rectangle.</span><br />
*[[dxDrawBorderedText]] <span style="color:gray; font-size:smaller;">» This is a function that will create a bordered text.</span><br />
*[[dxDrawDashedLine]] <span style="color:gray; font-size:smaller;">» This function draws a line with dashes.</span><br />
*[[dxDrawGifImage]] <span style="color:gray; font-size:smaller;">» This function simulates the effect of a GIF image by using image sprites in 2D.</span><br />
*[[dxDrawImage3D]] <span style="color:gray; font-size:smaller;">» This function draws a 3D image in GTA world.</span><br />
*[[dxDrawImageOnElement]] <span style="color:gray; font-size:smaller;">» This function draws an image on any element.</span><br />
*[[dxDrawLinedRectangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a rectangle outline with dx lines.</span><br />
*[[dxDrawLoading]] <span style="color:gray; font-size:smaller;">» This function draws a loading bar on the screen.</span><br />
*[[dxDrawOctagon3D]] <span style="color:gray; font-size:smaller;">» This function creates a 3D Octagon</span><br />
*[[dxDrawPolygon]] <span style="color:gray; font-size:smaller;">» This function draws a custom polygon on the screen.</span><br />
*[[dxDrawProgressBar]] <span style="color:gray; font-size:smaller;">» This function simulates a progress bar drawed using DirectDraw.</span><br />
*[[dxDrawRectangle3D]] <span style="color:gray; font-size:smaller;">» This function draws a 3D rectangle in GTA world.</span><br />
*[[dxDrawRectangleOnPlayer]] <span style="color:gray; font-size:smaller;">» This function draws a 3D rectangle above the player.</span><br />
*[[dxDrawRing]] <span style="color:gray; font-size:smaller;">» This function draws a ring with dx lines.</span><br />
*[[dxDrawRombo]] <span style="color:gray; font-size:smaller;">» This function creates a Rhombus.</span><br />
*[[dxDrawSprite]] <span style="color:gray; font-size:smaller;">» This function draw a sprite in the 3D world.</span><br />
*[[dxDrawTextOnElement]] <span style="color:gray; font-size:smaller;">» This function draws a text on any element.</span><br />
*[[dxDrawTextOnRectangle]] <span style="color:gray; font-size:smaller;">» Esta funcion crea un rectangle con un texto dentro.</span><br />
*[[dxDrawTriangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a triangle with dx lines.</span><br />
*[[dxGetFontSizeFromHeight]] <span style="color:gray; font-size:smaller;">» This function calculates the font size from given height.</span><br />
*[[dxGetRealFontHeight]] <span style="color:gray; font-size:smaller;">» This function calculates the height of a font.</span><br />
*[[getScreenStartPositionFromBox]] <span style="color:gray; font-size:smaller;">» This function helps with getting the correct position for your dx-effects.</span><br />
*[[wordWrap]] <span style="color:gray; font-size:smaller;">» This function breaks a long string into a table of separate lines limited to a specific length in pixels, for drawing separately.</span><br />
*[[CreateRectangle3D]] <span style="color:gray; font-size:smaller;">» This is a function that will create a 3d rectangle on the player screen.</span><br />
<br />
=== Effects functions ===<br />
*[[attachEffect]] <span style="color:gray; font-size:smaller;">» This function allows you attach an effect to an element.</span><br />
<br />
=== Element functions === <br />
*[[autoAttach]] <span style="color:gray; font-size:smaller;">» This function attaches one element into another at the same position and rotation they are.</span><br />
*[[isElementPlayer]] <span style="color:gray; font-size:smaller;">» This function checks whether the element is a player or not.</span><br />
*[[attachElementToBone]] <span style="color:gray; font-size:smaller;">» This function allows you to attach an element to ped bone accurately using new bone functions.</span><br />
*[[getElementsInDimension]] <span style="color:gray; font-size:smaller;">» This function returns a table of elements that are in the specified dimension.</span><br />
*[[getElementSpeed]] <span style="color:gray; font-size:smaller;">» This function returns the specified element's speed in m/s, km/h or mph.</span><br />
*[[getElementsWithinMarker]] <span style="color:gray; font-size:smaller;">» This function returns a table of elements that are within a marker's collision shape.</span><br />
*[[getElementUsingData]] <span style="color:gray; font-size:smaller;">» This function returns table elements that contains the elements data with the given key and value.</span><br />
*[[getNearestElement]] <span style="color:gray; font-size:smaller;">» This function returns the nearest element (of a specific type) to a player.</span><br />
*[[isElementInPhotograph]] <span style="color:gray; font-size:smaller;">» This function checks if an element is in the player's camera picture area.</span><br />
*[[isElementInRange]] <span style="color:gray; font-size:smaller;">» This function allows you to check if an element's range to a main point is within the maximum range.</span><br />
*[[isElementMoving]]<span style="color:gray; font-size:smaller;">» This function checks if an element is moving.</span><br />
*[[isElementWithinAColShape]]<span style="color:gray; font-size:smaller;">» This function checks if an element is within a collision shape element.</span><br />
*[[isElementInAir]]<span style="color:gray; font-size:smaller;">» This function checks if an element is in air or not.</span><br />
*[[multi_check]] <span style="color:gray; font-size:smaller;">» This function checks one element to many, handy and clean.</span><br />
*[[setElementSpeed]] <span style="color:gray; font-size:smaller;">» This function allows you to set the speed of an element in kph or mph units.</span><br />
<br />
=== Events ===<br />
*[[onVehicleWeaponFire]] <span style="color:gray; font-size:smaller;">» This code implements an event that is triggered when a player in a vehicle fires a vehicle's weapon.</span><br />
<br />
=== Input functions ===<br />
*[[bindControlKeys]] <span style="color:gray; font-size:smaller;">» This function allows you to bind each key bound to a control individually. Doing this bypasses a little MTA restriction.</span><br />
*[[getBoundControls]] <span style="color:gray; font-size:smaller;">» This function returns a table of control names that are bound to the specified key.</span><br />
*[[unbindControlKeys]] <span style="color:gray; font-size:smaller;">» This function allows you to unbind each key bound to a control individually. Use this function with [[bindControlKeys]].</span><br />
<br />
=== Data functions === <br />
*[[byte2human]] <span style="color:gray; font-size:smaller;">» This function converts an integer (number of bytes) into a human-readable unit.</span><br />
*[[capitalize]] <span style="color:gray; font-size:smaller;">» This function capitalizes a given string.</span><br />
*[[convertDate]] <span style="color:gray; font-size:smaller;">» This function converts date to another look.</span><br />
*[[convertServerTickToTimeStamp]] <span style="color:gray; font-size:smaller;">» This function converts server ticks to a unix timestamp.</span><br />
*[[convertTextToSpeech]] <span style="color:gray; font-size:smaller;">» This function converts the provided text to a speech in the provided language which players can hear.</span><br />
*[[findRotation3D]] <span style="color:gray; font-size:smaller;">» This function takes two sets of XYZ coordinates. It returns the 3D direction from point A to point B.</span><br />
*[[findRotation]] <span style="color:gray; font-size:smaller;">» This function takes two points and returns the direction from point A to point B.</span><br />
*[[formatDate]] <span style="color:gray; font-size:smaller;">» This function formats a date on the basis of a format string and returns it.</span><br />
*[[formatNumber]] <span style="color:gray; font-size:smaller;">» This function formats large numbers by adding commas.</span><br />
*[[generateRandomASCIIString]] <span style="color:gray; font-size:smaller;">» This function returns a random string which uses ASCII characters. </span><br />
*[[generateString]] <span style="color:gray; font-size:smaller;">» This function generates a random string with any characters.</span><br />
*[[getAge]] <span style="color:gray; font-size:smaller;">» This function calculates the age of a given birthday.</span><br />
*[[getDistance]] <span style="color:gray; font-size:smaller;">» Returns the distance between two elements.</span><br />
*[[getDistanceBetweenElements]] <span style="color:gray; font-size:smaller;">» Esta funcion sirve para obtener la distancia entre dos elementos.</span><br />
*[[getDistanceBetweenPointAndSegment2D]] <span style="color:gray; font-size:smaller;">» This function takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.</span><br />
*[[getEasterDate]] <span style="color:gray; font-size:smaller;">» This function returns easter date monthday and month for a given year.</span><br />
*[[getFreeDimension]] <span style="color:gray; font-size:smaller;">» This function get free dimension.</span><br />
*[[getKeyFromValueInTable]] <span style="color:gray; font-size:smaller;">» This function returns the key of the specified value in a table.</span><br />
*[[getOffsetFromXYZ]] <span style="color:gray; font-size:smaller;">» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.</span><br />
*[[getPointFromDistanceRotation]] <span style="color:gray; font-size:smaller;">» This function finds a point based on a starting point, direction and distance.</span><br />
*[[getRealMonth]] <span style="color:gray; font-size:smaller;">» This function returns the current month name</span><br />
*[[getRGColorFromPercentage]] <span style="color:gray; font-family:'Georgia', sans-serif; font-size:smaller;">»This function returns two integers representing red and green colors according to the specified percentage.</span><br />
*[[getScreenRotationFromWorldPosition]] <span style="color:gray; font-size:smaller;">» This function returns a screen relative rotation to a world position.</span><br />
*[[getTimestamp]] <span style="color:gray; font-size:smaller;">» This function returns the UNIX timestamp of a specified date and time.</span><br />
*[[gradientString]] <span style="color:gray; font-size:smaller;">» This function transforms a string in a new coloured gradient string.</span><br />
*[[hex2rgb]] <span style="color:gray; font-size:smaller;">» This function convert hex to rgb.</span><br />
*[[hexColorToRGB]] <span style="color:gray; font-size:smaller;">» This function convert hex string/number to RGBA values.</span><br />
*[[isLeapYear]] <span style="color:gray; font-size:smaller;">» This function returns a boolean representing if a given year is a leap year.</span><br />
*[[isValidMail]] <span style="color:gray; font-size:smaller;">» This function checks whether a provided e-mail string is valid.</span><br />
*[[removeHex]] <span style="color:gray; font-size:smaller;">» This function is used to remove hexadecimal numbers (colors, for example) from strings.<br />
*[[RGBToHex]] <span style="color:gray; font-size:smaller;">» This function returns a string representing the color in hexadecimal.</span><br />
*[[RGBToHSV]] <span style="color:gray; font-size:smaller;">» This function convert RGB to HSV color space.</span><br />
*[[RGBToDecimal]] <span style="color:gray; font-size:smaller;">» This function convert RGB to Decimal color.</span><br />
*[[secondsToTimeDesc]] <span style="color:gray; font-size:smaller;">» This function converts a plain seconds-integer into a user-friendly time description.</span><br />
*[[string.count]] <span style="color:gray; font-size:smaller;">» This function counts the amount of occurences of a string in a string.</span><br />
*[[string.explode]] <span style="color:gray; font-size:smaller;">» This function splits a string at a given separator pattern and returns a table with the pieces.</span><br />
*[[string.insert]] <span style="color:gray; font-size:smaller;">» This function inserts a string within another string at a given position.</span><br />
*[[switch]] <span style="color:gray; font-size:smaller;">» This function allows the value of a variable or expression to control the flow of program execution via a multiway branch.</span><br />
*[[tocolor2rgba]] <span style="color:gray; font-size:smaller;">» This function convert tocolor to rgba.</span><br />
*[[toHex]] <span style="color:gray; font-size:smaller;">» This function converts a decimal number to a hexadecimal number, as a fix to be used client-side.</span><br />
*[[var dump]] <span style="color:gray; font-size:smaller;">» This function outputs information about one or more variables using outputConsole.</span><br />
*[[wavelengthToRGBA]] <span style="color:gray; font-size:smaller;">» This function converts a physical wavelength of light to a RGBA color.</span><br />
<br />
=== GUI functions === <br />
*[[centerWindow]] <span style="color:gray; font-size:smaller;">» This function centers a CEGUI window element responsively in any resolution.</span><br />
*[[guiMoveElement]] <span style="color:gray; font-size:smaller;">» This function moves guiElement by/like using moveObject.</span><br />
*[[guiSetStaticImageMovable]] <span style="color:gray; font-size:smaller;">» This function allows you to move a static image like a gui window.</span><br />
*[[isMouseOnGUICloseButton]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether the mouse cursor/pointer is within a gui-window's native close button.</span><br />
*[[isMouseOnGuiElement]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether or not your mouse is over a specific gui element, this is especially useful if the gui element has a parent. </span><br />
=====Comboboxes=====<br />
*[[guiComboBoxAdjustHeight]] <span style="color:gray; font-size:smaller;">» This function adjusts a CEGUI combobox element to have the correct height.</span><br />
<br />
=====Gridlists=====<br />
*[[convertGridListToText]] <span style="color:gray; font-size:smaller;">» This function converts grid list contents to text.</span><br />
*[[getGridListRowIndexFromText]] <span style="color:gray; font-size:smaller;">» This function returns the GridList row index from the specified text.</span><br />
*[[guiGridListAddPlayers]] <span style="color:gray; font-size:smaller;">» This function add all online players to a grid list.</span><br />
*[[guiGridListGetColumnIDFromTitle]] <span style="color:gray; font-size:smaller;">» This function gets a gridlist's column ID from the column title.</span><br />
*[[guiGridListGetSelectedText]] <span style="color:gray; font-size:smaller;">» This function returns a string containing the inner text of a selected gridlist item.</span><br />
*[[guiGridListSetColumnNonSortable]] <span style="color:gray; font-size:smaller;">» This function makes a gridlist column become non-sortable.</span><br />
*[[guiGridListSetColumnsFixedWidth]] <span style="color:gray; font-size:smaller;">» This function makes a gridlist have all its columns fixed width.</span><br />
*[[isTextInGridList]] <span style="color:gray; font-size:smaller;">» This function checks if some text exist or not in the GridList.</span><br />
<br />
=====Labels=====<br />
*[[guiLabelAddEffect]] <span style="color:gray; font-size:smaller;">» This function add an effects to the gui-label like (shadow, outline).</span><br />
<br />
=== Marker functions ===<br />
*[[createMarkerAttachedTo]] <span style="color:gray; font-size:smaller;">» This function creates a marker that is attached to an element.</span><br />
<br />
=== Math functions ===<br />
*[[math.clamp]] <span style="color:gray; font-size:smaller;">» This function returns the number between range of numbers or it's minimum or maximum.</span><br />
*[[math.getBezierPoint]] <span style="color:gray; font-size:smaller;">» Get N-th order bezier point.</span><br />
*[[math.hypot]] <span style="color:gray; font-size:smaller;">» This function returns the Hypotenuse of the triangle given by sides x and y.</span><br />
*[[math.isPointInPolygon]] <span style="color:gray; font-size:smaller;">» Check if point is inside polygon or not.</span><br />
*[[math.lerp]] <span style="color:gray; font-size:smaller;">» Get val between two integer.</span><br />
*[[math.percent]] <span style="color:gray; font-size:smaller;">» This function returns a percentage from two number values.</span><br />
*[[math.polygonArea]] <span style="color:gray; font-size:smaller;">» Compute area of any polygon.</span><br />
*[[math.randomDiff]] <span style="color:gray; font-size:smaller;">» Generates a pseudo-random integer that's always different from the last random number generated.</span><br />
*[[math.rotVecToEulerAngle]] <span style="color:gray; font-size:smaller;">» Rotation Vector To Euler Angle</span><br />
*[[math.round]] <span style="color:gray; font-size:smaller;">» Rounds a number whereas the number of decimals to keep and the method may be set.</span><br />
*[[mathNumber]] <span style="color:gray; font-size:smaller;">» This function is a workaround for the client-side floating-point precision of 24-bits.</span><br />
*[[reMap]] <span style="color:gray; font-size:smaller;">» Re-maps a number from one range to another.</span><br />
*[[Math.percentProgress|math.percentProgress]] <span style="color:gray; font-size:smaller;">» Returns a percentage progress from two specific values.</span><br />
*[[math.average]] <span style="color:gray; font-size:smaller;">» This function returns the simple arithmetic mean of multiple numbers.</span><br />
<br />
=== Map functions ===<br />
*[[assignLod]] <span style="color:gray; font-size:smaller;">» This function lets you conveniently generate and apply a LOD model to a mapping object.</span><br />
*[[getWorldPositionFromMapPosition]] <span style="color:gray; font-size:smaller;">» This function converts an F11 map position to world position.</span><br />
<br />
=== Ped functions ===<br />
*[[getAlivePlayers (Client)|getAlivePlayers]] <span style="color:gray; font-size:smaller;">» This function returns a table of the alive players client-side.</span><br />
*[[getAlivePlayersInTeam]] <span style="color:gray; font-size:smaller;">» This function returns a table of the alive players in a team.</span><br />
*[[getGuestPlayers]] <span style="color:gray; font-size:smaller;">» This function gets a players not login or players Guest .</span><br />
*[[getOnlineAdmins]] <span style="color:gray; font-size:smaller;">» This function returns a table of all logged-in administrators.</span><br />
*[[getPedEyesPosition]] <span style="color:gray; font-size:smaller;">» This function allows you to get peds eyes position.</span><br />
*[[getPedGender]] <span style="color:gray; font-size:smaller;">» This function allows you to get peds their gender.</span><br />
*[[getPedMaxHealth]] <span style="color:gray; font-size:smaller;">» This function returns a pedestrians's maximum health by converting it from their maximum health stat.</span><br />
*[[getPedMaxOxygenLevel]] <span style="color:gray; font-size:smaller;">» This function returns a ped's maximum oxygen level by converting it from their maximum underwater stamina stat.</span><br />
*[[getPedWeaponSkill]] <span style="color:gray; font-size:smaller;">» This function returns a ped's corresponding weapon skill level name.</span><br />
*[[getPedHitBone]] <span style="color:gray; font-size:smaller;">» This function gets the approximate number of the bone where the ped is hit.</span><br />
*[[getPlayerFromNamePart]] <span style="color:gray; font-size:smaller;">» This function returns a player from partial name.</span><br />
*[[getPlayerFromSerial]] <span style="color:gray; font-size:smaller;">» This function returns a player from their serial.</span><br />
*[[getPlayersByData]] <span style="color:gray; font-size:smaller;">» This function returns a table of players that have the specified data name.</span><br />
*[[getPlayersInPhotograph]] <span style="color:gray; font-size:smaller;">» This function returns a table of all players in photograph.</span><br />
*[[getPlayersInVehicles]] <span style="color:gray; font-size:smaller;">» This function returns a table of the players insides vehicles from a specified dimension.</span><br />
*[[isPedAiming]]<span style="color:gray; font-size:smaller;">» This function checks if a pedestrian is aiming their weapon.</span><br />
*[[isPedAimingNearPed]] <span style="color:gray; font-size:smaller;">» This is similar to isPedAiming but uses a colshape to be more precise.</span><br />
*[[isPedDiving]] <span style="color:gray; font-size:smaller;">» This feature checks that pedestrian is diving in the water.</span><br />
*[[isPedDrivingVehicle]] <span style="color:gray; font-size:smaller;">» This function checks if a specified pedestrian is driving a vehicle.</span><br />
*[[isPlayerInTeam]] <span style="color:gray; font-size:smaller;">» This function checks if a player is in a specified team.</span><br />
*[[setPedAttack]] <span style="color:gray; font-size:smaller;">» This function will make a ped attack a specified target.</span><br />
*[[setPedFollow]] <span style="color:gray; font-size:smaller;">» This function will make a ped follow a specified target.</span><br />
*[[getPlayerNameFromID]] <span style="color:gray; font-size:smaller;">» This function will get the player name from the ID element data.</span><br />
<br />
=== Player functions ===<br />
*[[countPlayersInRange]] <span style="color:gray; font-size:smaller;">» This function returns the number of players that are within a certain range of the specified coordinates.</span><br />
*[[getPlayerPreviousAndNextWeapon]] <span style="color:gray; font-size:smaller;">» This function returns the player previous and next weapon.</span><br />
*[[getPlayersInRange]]<span style="color:gray; font-size:smaller;">» This function make a table of players within certain range.</span><br />
*[[isPlayerHitByVehicle]]<span style="color:gray; font-size:smaller;">» This function cancels event when a element is hit by a vehicle.</span><br />
*[[warpToPlayer]]<span style="color:gray; font-size:smaller;">» This function make player warp to another player.</span><br />
<br />
=== Resource functions ===<br />
*[[getFilesInResourceFolder]] <span style="color:gray; font-size:smaller;">» This function gets a list of files that are inside a folder of a resource.</span><br />
*[[getResourceScripts]] <span style="color:gray; font-size:smaller;">» This function returns a table of the resource scripts.</span><br />
*[[getResourceSettings]] <span style="color:gray; font-size:smaller;">» This function returns a table of the resource settings.</span><br />
*[[getResourceSize]] <span style="color:gray; font-size:smaller;">» This function returns the size of a specified resource in kB(kilobyte)</span><br />
*[[refreshResource]] <span style="color:gray; font-size:smaller;">» This function refreshes your resource if you changed any of the files<br />
*[[setResourcePriority]] <span style="color:gray; font-size:smaller;">» This function set resource download priority group.</span><br />
<br />
=== Sound functions ===<br />
*[[isSoundFinished]] <span style="color:gray; font-size:smaller;">» This function checks if a sound element has finished.</span><br />
*[[isSoundPlaying]] <span style="color:gray; font-size:smaller;">» This function checks if a sound element is playing or not.</span><br />
*[[stopSoundSlowly]] <span style="color:gray; font-size:smaller;">» This function stop your sound element slowly.</span><br />
<br />
=== Browser functions ===<br />
*[[playVideo]] <span style="color:gray; font-size:smaller;">» This function plays a video on the screen.</span><br />
<br />
=== Team functions ===<br />
*[[getTeamFromColor]] <span style="color:gray; font-size:smaller;">» This function returns a team element by the specified color.</span><br />
*[[getTeamWithFewestPlayers]] <span style="color:gray; font-size:smaller;">» This function returns a team element with least players of all the specified teams.</span><br />
<br />
=== Vehicle functions ===<br />
*[[findEmptyCarSeat]] <span style="color:gray; font-size:smaller;">» This function finds you the first empty seat in a vehicle.</span><br />
*[[getNearestVehicle]] <span style="color:gray; font-size:smaller;">» This function gets the nearest vehicle to the specified player in a specified distance.</span><br />
*[[getRandomVehicle]] <span style="color:gray; font-size:smaller;">» This function gets a random vehicle.</span><br />
*[[getValidVehicleModels]] <span style="color:gray; font-size:smaller;">» This function returns a table of all valid vehicle models.</span><br />
*[[getVehiclesCountByType]] <span style="color:gray; font-size:smaller;">» This function returns the amount of vehicles by the given type as an integer value.</span><br />
*[[getVehicleTurnVelocityCenterOfMass]]<span style="color:gray; font-size:smaller;">» This function gets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
*[[isVehicleDoubleExhaust]] <span style="color:gray; font-size:smaller;">» This function checks is exhaust vehicle double.</span><br />
*[[isVehicleEmpty]] <span style="color:gray; font-size:smaller;">» This function checks whether a vehicle is empty.</span><br />
*[[isVehicleOccupied]] <span style="color:gray; font-size:smaller;">» This function checks if a specified vehicle is occupied.</span><br />
*[[isVehicleOnRoof]] <span style="color:gray; font-size:smaller;">» This function checks whether vehicle is on roof.</span><br />
*[[isVehicleReversing]] <span style="color:gray; font-size:smaller;">» This function checks if a specified vehicle is moving backwards.</span><br />
*[[isVehicleUpgraded]] <span style="color:gray; font-size:smaller;">» This function checks is vehicle upgraded by upgrade ID.</span><br />
*[[setVehicleGravityPoint]] <span style="color:gray; font-size:smaller;">» This function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.</span><br />
*[[setVehicleTurnVelocityCenterOfMass]]<span style="color:gray; font-size:smaller;">» This function sets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
*[[setVehicleHandlingFromText]]<span style="color:gray; font-size:smaller;">» This function sets a vehicle's handling from text.</span><br />
<br />
=== Weapon functions === <br />
*[[getJetpackWeaponsEnabled]] <span style="color:gray; font-size:smaller;">» This function returns a table of enabled weapons usable on a jetpack.</span><br />
<br />
=== Object functions ===<br />
*[[getDynamicDoorObjectOpenRatio]] <span style="color:gray; font-size:smaller;">» This function tells you how open a dynamic door is in a range from 0 to 1.</span><br />
*[[isElementObject]] <span style="color:gray; font-size:smaller;">» This function tells you if an element is an object or no.</span><br />
<br />
=== XML functions ===<br />
*[[getXMLNodes]] <span style="color:gray; font-size:smaller;">» This function returns all children of a XML node.</span><br />
<br />
=== Engine functions ===<br />
*[[engineGetCOLsFromLibrary]] <span style="color:gray; font-size:smaller;">» This function gets the collision data from the col library.</span><br />
*[[engineLoadIMGContainer]] <span style="color:gray; font-size:smaller;">» This function loads the IMG container.</span><br />
<br />
=== Utility ===<br />
*[[animate]] <span style="color:gray; font-size:smaller;">» This function allows you to use interpolateBetween without render event and easily used.</span><br />
*[[callClientFunction]] <span style="color:gray; font-size:smaller;">» This function allows you to call any client-side function from the server's side.</span><br />
*[[callServerFunction]] <span style="color:gray; font-size:smaller;">» This function allows you to call any server-side function from the client's side.</span><br />
*[[check]] <span style="color:gray; font-size:smaller;">» This function checks if its arguments are of the right type and calls the error-function if one is not.</span><br />
*[[checkPassiveTimer]] <span style="color:gray; font-size:smaller;">» This function allows you to use passive timers in your conditions. For example you want to prevent players r<br />
epeatedly using a command.</span><br />
*[[coroutine.resume]] <span style="color:gray; font-size:smaller;">» This function applies a fix for hidden coroutine error messages.</span><br />
*[[compact]] <span style="color:gray; font-size:smaller;">» This function create table containing variables and their values.</span><br />
*[[getBanFromName]] <span style="color:gray; font-size:smaller;">» This functions returns the ban of the given playername.</span><br />
*[[getCurrentFPS]] <span style="color:gray; font-size:smaller;">» This function returns the frames per second at which GTA: SA is running.</span><br />
*[[getSkinNameFromID]] <span style="color:gray; font-size:smaller;">» This function returns the name of the skin from the given id.</span><br />
*[[IfElse]] <span style="color:gray; font-size:smaller;">» This function returns one of two values based on a boolean expression.</span><br />
*[[isCharInString]] <span style="color:gray; font-size:smaller;">» This shared function allows you to check if a char specified is in a string value.</span><br />
*[[isMouseInCircle]] <span style="color:gray; font-size:smaller;">» This function checks if a cursor position is in circular area or not.</span><br />
*[[isMouseInPosition]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether the mouse cursor/pointer is within a rectangular position.</span><br />
*[[iterElements]] <span style="color:gray; font-size:smaller;">» This function returns ''a time-saving'' iterator for your for-loops.</span><br />
*[[PlotTrajectoryAtTime]] <span style="color:gray; font-size:smaller;">» Calculate projectile/water trajectory.</span><br />
*[[preprocessor]] <span style="color:gray; font-size:smaller;">» This function allow you to use gcc macros.</span><br />
*[[vector3:compare]] <span style="color:gray; font-size:smaller;">» This method checks whether two vectors match, with optional precision.</span><br />
*[[svgCreateRoundedRectangle]] <span style="color:gray; font-size:smaller;">» This function creates a rectangle with rounded edges.</span><br />
<br />
<noinclude>[[Category:Useful Functions]]</noinclude></div>Alex7202https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=74075Template:Useful Functions2022-02-13T16:08:35Z<p>Alex7202: /* Resource functions */</p>
<hr />
<div>__NOTOC__<br />
=== Table functions ===<br />
*[[addTableChangeHandler]] <span style="color:gray; font-size:smaller;">» This function monitors the changes of a table.</span><br />
*[[getTableFromSql]] <span style="color:gray; font-size:smaller;">» This functionality is used to obtain saved tables using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql ]).</span><br />
*[[isValueInTable]] <span style="color:gray; font-size:smaller;">» This function returns true if the value exists in the table, false if the value does not exist in the table.</span><br />
*[[pairsByKeys]] <span style="color:gray; font-size:smaller;">» This function sort pairs table.</span><br />
*[[rangeToTable]] <span style="color:gray; font-size:smaller;">» This function converts a string range to a table containing number values.</span><br />
*[[setTableProtected]] <span style="color:gray; font-size:smaller;">» This function protects a table and makes it read-only.</span><br />
*[[setTableToSql]] <span style="color:gray; font-size:smaller;">» This function is used to save the table in the database (sql).</span><br />
*[[Sort_Functions]] <span style="color:gray; font-size:smaller;">» These functions are able to sort your tables by a key.</span><br />
*[[table.compare]] <span style="color:gray; font-size:smaller;">» This function checks whether two given tables are equal.</span><br />
*[[table.copy]] <span style="color:gray; font-size:smaller;">» This function copies a whole table and all the tables in that table.</span><br />
*[[table.deepmerge]] <span style="color:gray; font-size:smaller;">» This function deep merges two tables. Every nested table will be correspondingly merged.</span><br />
*[[table.element]] <span style="color:gray; font-size:smaller;">» This function returns a new table with only userdata content.</span><br />
*[[table.empty]] <span style="color:gray; font-size:smaller;">» This function checks whether a table is empty.</span><br />
*[[table.fromString]] <span style="color:gray; font-size:smaller;">» This function converts string to a table.</span><br />
*[[table.getRandomRows]] <span style="color:gray; font-size:smaller;">» This function returns random rows from table.</span><br />
*[[table.map]] <span style="color:gray; font-size:smaller;">» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.</span><br />
*[[table.merge]] <span style="color:gray; font-size:smaller;">» This function merges two or more tables together.</span><br />
*[[table.random]] <span style="color:gray; font-size:smaller;">» This function retrieves a random value from a table.</span><br />
*[[table.removeValue]] <span style="color:gray; font-size:smaller;">» This function removes a specified value from a table.</span><br />
*[[table.size]] <span style="color:gray; font-size:smaller;">» This function returns the absolute size of a table.</span><br />
*[[table.toString]] <span style="color:gray; font-size:smaller;">» This function converts table to a string.</span><br />
*[[table.toStringArray]] <span style="color:gray; font-size:smaller;">» This function converts '''array''' to a string.</span><br />
<br />
=== ACL functions ===<br />
*[[aclGroupClone]] <span style="color:gray; font-size:smaller;">» This function clone a group to another group with/without ACLs and/or objects.</span><br />
*[[getAccountsRanks]] <span style="color:gray; font-size:smaller;">» This function is used to detect the account name groups and put them in the chat.</span><br />
*[[getPlayerAcls]] <span style="color:gray; font-size:smaller;">» This function returns a table of all ACL groups on a player.</span><br />
*[[getPlayersInACLGroup]] <span style="color:gray; font-size:smaller;">» This function returns all players in an ACL group.</span><br />
*[[isPlayerInACL]] <span style="color:gray; font-size:smaller;">» This function checks if a player element is in an ACL group.</span><br />
*[[renameAclGroup]] <span style="color:gray; font-size:smaller;">» This function gives an existing ACL group a new name.</span><br />
<br />
=== Account functions ===<br />
*[[getPlayerFromAccountName]] <span style="color:gray; font-size:smaller;">» This function is used to obtain a player by the name of his account.</span><br />
<br />
=== Camera functions ===<br />
*[[smoothMoveCamera]] <span style="color:gray; font-size:smaller;">» This function allows you to create a cinematic camera flight.<br />
<br />
=== Cursor functions ===<br />
*[[getCursorMovedOn]] <span style="color:gray; font-size:smaller;">» This function checks in which way the cursor is currently moving.</span><br />
<br />
=== Drawing functions ===<br />
*[[dxDrawAnimWindow]] <span style="color:gray; font-size:smaller;">» This function draws an animated 2D window on the screen.</span><br />
*[[dxDrawBorderedRectangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a bordered rectangle.</span><br />
*[[dxDrawBorderedText]] <span style="color:gray; font-size:smaller;">» This is a function that will create a bordered text.</span><br />
*[[dxDrawDashedLine]] <span style="color:gray; font-size:smaller;">» This function draws a line with dashes.</span><br />
*[[dxDrawGifImage]] <span style="color:gray; font-size:smaller;">» This function simulates the effect of a GIF image by using image sprites in 2D.</span><br />
*[[dxDrawImage3D]] <span style="color:gray; font-size:smaller;">» This function draws a 3D image in GTA world.</span><br />
*[[dxDrawImageOnElement]] <span style="color:gray; font-size:smaller;">» This function draws an image on any element.</span><br />
*[[dxDrawLinedRectangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a rectangle outline with dx lines.</span><br />
*[[dxDrawLoading]] <span style="color:gray; font-size:smaller;">» This function draws a loading bar on the screen.</span><br />
*[[dxDrawOctagon3D]] <span style="color:gray; font-size:smaller;">» This function creates a 3D Octagon</span><br />
*[[dxDrawPolygon]] <span style="color:gray; font-size:smaller;">» This function draws a custom polygon on the screen.</span><br />
*[[dxDrawProgressBar]] <span style="color:gray; font-size:smaller;">» This function simulates a progress bar drawed using DirectDraw.</span><br />
*[[dxDrawRectangle3D]] <span style="color:gray; font-size:smaller;">» This function draws a 3D rectangle in GTA world.</span><br />
*[[dxDrawRectangleOnPlayer]] <span style="color:gray; font-size:smaller;">» This function draws a 3D rectangle above the player.</span><br />
*[[dxDrawRing]] <span style="color:gray; font-size:smaller;">» This function draws a ring with dx lines.</span><br />
*[[dxDrawRombo]] <span style="color:gray; font-size:smaller;">» This function creates a Rhombus.</span><br />
*[[dxDrawSprite]] <span style="color:gray; font-size:smaller;">» This function draw a sprite in the 3D world.</span><br />
*[[dxDrawTextOnElement]] <span style="color:gray; font-size:smaller;">» This function draws a text on any element.</span><br />
*[[dxDrawTextOnRectangle]] <span style="color:gray; font-size:smaller;">» Esta funcion crea un rectangle con un texto dentro.</span><br />
*[[dxDrawTriangle]] <span style="color:gray; font-size:smaller;">» This is a function that will create a triangle with dx lines.</span><br />
*[[dxGetFontSizeFromHeight]] <span style="color:gray; font-size:smaller;">» This function calculates the font size from given height.</span><br />
*[[dxGetRealFontHeight]] <span style="color:gray; font-size:smaller;">» This function calculates the height of a font.</span><br />
*[[getScreenStartPositionFromBox]] <span style="color:gray; font-size:smaller;">» This function helps with getting the correct position for your dx-effects.</span><br />
*[[wordWrap]] <span style="color:gray; font-size:smaller;">» This function breaks a long string into a table of separate lines limited to a specific length in pixels, for drawing separately.</span><br />
<br />
=== Effects functions ===<br />
*[[attachEffect]] <span style="color:gray; font-size:smaller;">» This function allows you attach an effect to an element.</span><br />
<br />
=== Element functions === <br />
*[[autoAttach]] <span style="color:gray; font-size:smaller;">» This function attaches one element into another at the same position and rotation they are.</span><br />
*[[isElementPlayer]] <span style="color:gray; font-size:smaller;">» This function checks whether the element is a player or not.</span><br />
*[[attachElementToBone]] <span style="color:gray; font-size:smaller;">» This function allows you to attach an element to ped bone accurately using new bone functions.</span><br />
*[[getElementsInDimension]] <span style="color:gray; font-size:smaller;">» This function returns a table of elements that are in the specified dimension.</span><br />
*[[getElementSpeed]] <span style="color:gray; font-size:smaller;">» This function returns the specified element's speed in m/s, km/h or mph.</span><br />
*[[getElementsWithinMarker]] <span style="color:gray; font-size:smaller;">» This function returns a table of elements that are within a marker's collision shape.</span><br />
*[[getElementUsingData]] <span style="color:gray; font-size:smaller;">» This function returns table elements that contains the elements data with the given key and value.</span><br />
*[[getNearestElement]] <span style="color:gray; font-size:smaller;">» This function returns the nearest element (of a specific type) to a player.</span><br />
*[[isElementInPhotograph]] <span style="color:gray; font-size:smaller;">» This function checks if an element is in the player's camera picture area.</span><br />
*[[isElementInRange]] <span style="color:gray; font-size:smaller;">» This function allows you to check if an element's range to a main point is within the maximum range.</span><br />
*[[isElementMoving]]<span style="color:gray; font-size:smaller;">» This function checks if an element is moving.</span><br />
*[[isElementWithinAColShape]]<span style="color:gray; font-size:smaller;">» This function checks if an element is within a collision shape element.</span><br />
*[[isElementInAir]]<span style="color:gray; font-size:smaller;">» This function checks if an element is in air or not.</span><br />
*[[multi_check]] <span style="color:gray; font-size:smaller;">» This function checks one element to many, handy and clean.</span><br />
*[[setElementSpeed]] <span style="color:gray; font-size:smaller;">» This function allows you to set the speed of an element in kph or mph units.</span><br />
<br />
=== Events ===<br />
*[[onVehicleWeaponFire]] <span style="color:gray; font-size:smaller;">» This code implements an event that is triggered when a player in a vehicle fires a vehicle's weapon.</span><br />
<br />
=== Input functions ===<br />
*[[bindControlKeys]] <span style="color:gray; font-size:smaller;">» This function allows you to bind each key bound to a control individually. Doing this bypasses a little MTA restriction.</span><br />
*[[getBoundControls]] <span style="color:gray; font-size:smaller;">» This function returns a table of control names that are bound to the specified key.</span><br />
*[[getClipboard]] <span style="color:gray; 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 />
*[[unbindControlKeys]] <span style="color:gray; font-size:smaller;">» This function allows you to unbind each key bound to a control individually. Use this function with [[bindControlKeys]].</span><br />
<br />
=== Data functions === <br />
*[[byte2human]] <span style="color:gray; font-size:smaller;">» This function converts an integer (number of bytes) into a human-readable unit.</span><br />
*[[capitalize]] <span style="color:gray; font-size:smaller;">» This function capitalizes a given string.</span><br />
*[[convertDate]] <span style="color:gray; font-size:smaller;">» This function converts date to another look.</span><br />
*[[convertServerTickToTimeStamp]] <span style="color:gray; font-size:smaller;">» This function converts server ticks to a unix timestamp.</span><br />
*[[convertTextToSpeech]] <span style="color:gray; font-size:smaller;">» This function converts the provided text to a speech in the provided language which players can hear.</span><br />
*[[findRotation3D]] <span style="color:gray; font-size:smaller;">» This function takes two sets of XYZ coordinates. It returns the 3D direction from point A to point B.</span><br />
*[[findRotation]] <span style="color:gray; font-size:smaller;">» This function takes two points and returns the direction from point A to point B.</span><br />
*[[formatDate]] <span style="color:gray; font-size:smaller;">» This function formats a date on the basis of a format string and returns it.</span><br />
*[[formatNumber]] <span style="color:gray; font-size:smaller;">» This function formats large numbers by adding commas.</span><br />
*[[generateRandomASCIIString]] <span style="color:gray; font-size:smaller;">» This function returns a random string which uses ASCII characters. </span><br />
*[[generateString]] <span style="color:gray; font-size:smaller;">» This function generates a random string with any characters.</span><br />
*[[getAge]] <span style="color:gray; font-size:smaller;">» This function calculates the age of a given birthday.</span><br />
*[[getDistance]] <span style="color:gray; font-size:smaller;">» Returns the distance between two elements.</span><br />
*[[getDistanceBetweenElements]] <span style="color:gray; font-size:smaller;">» Esta funcion sirve para obtener la distancia entre dos elementos.</span><br />
*[[getDistanceBetweenPointAndSegment2D]] <span style="color:gray; font-size:smaller;">» This function takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.</span><br />
*[[getEasterDate]] <span style="color:gray; font-size:smaller;">» This function returns easter date monthday and month for a given year.</span><br />
*[[getFreeDimension]] <span style="color:gray; font-size:smaller;">» This function get free dimension.</span><br />
*[[getKeyFromValueInTable]] <span style="color:gray; font-size:smaller;">» This function returns the key of the specified value in a table.</span><br />
*[[getOffsetFromXYZ]] <span style="color:gray; font-size:smaller;">» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.</span><br />
*[[getPointFromDistanceRotation]] <span style="color:gray; font-size:smaller;">» This function finds a point based on a starting point, direction and distance.</span><br />
*[[getRealMonth]] <span style="color:gray; font-size:smaller;">» This function returns the current month name</span><br />
*[[getRGColorFromPercentage]] <span style="color:gray; font-family:'Georgia', sans-serif; font-size:smaller;">»This function returns two integers representing red and green colors according to the specified percentage.</span><br />
*[[getScreenRotationFromWorldPosition]] <span style="color:gray; font-size:smaller;">» This function returns a screen relative rotation to a world position.</span><br />
*[[getTimestamp]] <span style="color:gray; font-size:smaller;">» This function returns the UNIX timestamp of a specified date and time.</span><br />
*[[gradientString]] <span style="color:gray; font-size:smaller;">» This function transforms a string in a new coloured gradient string.</span><br />
*[[hex2rgb]] <span style="color:gray; font-size:smaller;">» This function convert hex to rgb.</span><br />
*[[hexColorToRGB]] <span style="color:gray; font-size:smaller;">» This function convert hex string/number to RGBA values.</span><br />
*[[isLeapYear]] <span style="color:gray; font-size:smaller;">» This function returns a boolean representing if a given year is a leap year.</span><br />
*[[isValidMail]] <span style="color:gray; font-size:smaller;">» This function checks whether a provided e-mail string is valid.</span><br />
*[[removeHex]] <span style="color:gray; font-size:smaller;">» This function is used to remove hexadecimal numbers (colors, for example) from strings.<br />
*[[RGBToHex]] <span style="color:gray; font-size:smaller;">» This function returns a string representing the color in hexadecimal.</span><br />
*[[RGBToHSV]] <span style="color:gray; font-size:smaller;">» This function convert RGB to HSV color space.</span><br />
*[[secondsToTimeDesc]] <span style="color:gray; font-size:smaller;">» This function converts a plain seconds-integer into a user-friendly time description.</span><br />
*[[string.count]] <span style="color:gray; font-size:smaller;">» This function counts the amount of occurences of a string in a string.</span><br />
*[[string.explode]] <span style="color:gray; font-size:smaller;">» This function splits a string at a given separator pattern and returns a table with the pieces.</span><br />
*[[string.insert]] <span style="color:gray; font-size:smaller;">» This function inserts a string within another string at a given position.</span><br />
*[[switch]] <span style="color:gray; font-size:smaller;">» This function allows the value of a variable or expression to control the flow of program execution via a multiway branch.</span><br />
*[[tocolor2rgba]] <span style="color:gray; font-size:smaller;">» This function convert tocolor to rgba.</span><br />
*[[toHex]] <span style="color:gray; font-size:smaller;">» This function converts a decimal number to a hexadecimal number, as a fix to be used client-side.</span><br />
*[[var dump]] <span style="color:gray; font-size:smaller;">» This function outputs information about one or more variables using outputConsole.</span><br />
*[[wavelengthToRGBA]] <span style="color:gray; font-size:smaller;">» This function converts a physical wavelength of light to a RGBA color.</span><br />
<br />
=== GUI functions === <br />
*[[centerWindow]] <span style="color:gray; font-size:smaller;">» This function centers a CEGUI window element responsively in any resolution.</span><br />
*[[guiMoveElement]] <span style="color:gray; font-size:smaller;">» This function moves guiElement by/like using moveObject.</span><br />
*[[guiSetStaticImageMovable]] <span style="color:gray; font-size:smaller;">» This function allows you to move a static image like a gui window.</span><br />
*[[isMouseOnGUICloseButton]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether the mouse cursor/pointer is within a gui-window's native close button.</span><br />
*[[isMouseOnGuiElement]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether or not your mouse is over a specific gui element, this is especially useful if the gui element has a parent. </span><br />
=====Comboboxes=====<br />
*[[guiComboBoxAdjustHeight]] <span style="color:gray; font-size:smaller;">» This function adjusts a CEGUI combobox element to have the correct height.</span><br />
<br />
=====Gridlists=====<br />
*[[convertGridListToText]] <span style="color:gray; font-size:smaller;">» This function converts grid list contents to text.</span><br />
*[[getGridListRowIndexFromText]] <span style="color:gray; font-size:smaller;">» This function returns the GridList row index from the specified text.</span><br />
*[[guiGridListAddPlayers]] <span style="color:gray; font-size:smaller;">» This function add all online players to a grid list.</span><br />
*[[guiGridListGetColumnIDFromTitle]] <span style="color:gray; font-size:smaller;">» This function gets a gridlist's column ID from the column title.</span><br />
*[[guiGridListGetSelectedText]] <span style="color:gray; font-size:smaller;">» This function returns a string containing the inner text of a selected gridlist item.</span><br />
*[[guiGridListSetColumnNonSortable]] <span style="color:gray; font-size:smaller;">» This function makes a gridlist column become non-sortable.</span><br />
*[[guiGridListSetColumnsFixedWidth]] <span style="color:gray; font-size:smaller;">» This function makes a gridlist have all its columns fixed width.</span><br />
*[[isTextInGridList]] <span style="color:gray; font-size:smaller;">» This function checks if some text exist or not in the GridList.</span><br />
<br />
=====Labels=====<br />
*[[guiLabelAddEffect]] <span style="color:gray; font-size:smaller;">» This function add an effects to the gui-label like (shadow, outline).</span><br />
<br />
=== Marker functions ===<br />
*[[createMarkerAttachedTo]] <span style="color:gray; font-size:smaller;">» This function creates a marker that is attached to an element.</span><br />
<br />
=== Math functions ===<br />
*[[math.clamp]] <span style="color:gray; font-size:smaller;">» This function returns the number between range of numbers or it's minimum or maximum.</span><br />
*[[math.getBezierPoint]] <span style="color:gray; font-size:smaller;">» Get N-th order bezier point.</span><br />
*[[math.hypot]] <span style="color:gray; font-size:smaller;">» This function returns the Hypotenuse of the triangle given by sides x and y.</span><br />
*[[math.isPointInPolygon]] <span style="color:gray; font-size:smaller;">» Check if point is inside polygon or not.</span><br />
*[[math.lerp]] <span style="color:gray; font-size:smaller;">» Get val between two integer.</span><br />
*[[math.percent]] <span style="color:gray; font-size:smaller;">» This function returns a percentage from two number values.</span><br />
*[[math.polygonArea]] <span style="color:gray; font-size:smaller;">» Compute area of any polygon.</span><br />
*[[math.randomDiff]] <span style="color:gray; font-size:smaller;">» Generates a pseudo-random integer that's always different from the last random number generated.</span><br />
*[[math.rotVecToEulerAngle]] <span style="color:gray; font-size:smaller;">» Rotation Vector To Euler Angle</span><br />
*[[math.round]] <span style="color:gray; font-size:smaller;">» Rounds a number whereas the number of decimals to keep and the method may be set.</span><br />
*[[mathNumber]] <span style="color:gray; font-size:smaller;">» This function is a workaround for the client-side floating-point precision of 24-bits.</span><br />
*[[reMap]] <span style="color:gray; font-size:smaller;">» Re-maps a number from one range to another.</span><br />
*[[Math.percentProgress|math.percentProgress]] <span style="color:gray; font-size:smaller;">» Returns a percentage progress from two specific values.</span><br />
*[[math.average]] <span style="color:gray; font-size:smaller;">» This function returns the simple arithmetic mean of multiple numbers.</span><br />
<br />
=== Map functions ===<br />
*[[assignLod]] <span style="color:gray; font-size:smaller;">» This function lets you conveniently generate and apply a LOD model to a mapping object.</span><br />
*[[getWorldPositionFromMapPosition]] <span style="color:gray; font-size:smaller;">» This function converts an F11 map position to world position.</span><br />
<br />
=== Ped functions ===<br />
*[[getAlivePlayers (Client)|getAlivePlayers]] <span style="color:gray; font-size:smaller;">» This function returns a table of the alive players client-side.</span><br />
*[[getAlivePlayersInTeam]] <span style="color:gray; font-size:smaller;">» This function returns a table of the alive players in a team.</span><br />
*[[getGuestPlayers]] <span style="color:gray; font-size:smaller;">» This function gets a players not login or players Guest .</span><br />
*[[getOnlineAdmins]] <span style="color:gray; font-size:smaller;">» This function returns a table of all logged-in administrators.</span><br />
*[[getPedEyesPosition]] <span style="color:gray; font-size:smaller;">» This function allows you to get peds eyes position.</span><br />
*[[getPedGender]] <span style="color:gray; font-size:smaller;">» This function allows you to get peds their gender.</span><br />
*[[getPedMaxHealth]] <span style="color:gray; font-size:smaller;">» This function returns a pedestrians's maximum health by converting it from their maximum health stat.</span><br />
*[[getPedMaxOxygenLevel]] <span style="color:gray; font-size:smaller;">» This function returns a ped's maximum oxygen level by converting it from their maximum underwater stamina stat.</span><br />
*[[getPedWeaponSkill]] <span style="color:gray; font-size:smaller;">» This function returns a ped's corresponding weapon skill level name.</span><br />
*[[getPlayerFromNamePart]] <span style="color:gray; font-size:smaller;">» This function returns a player from partial name.</span><br />
*[[getPlayerFromSerial]] <span style="color:gray; font-size:smaller;">» This function returns a player from their serial.</span><br />
*[[getPlayersByData]] <span style="color:gray; font-size:smaller;">» This function returns a table of players that have the specified data name.</span><br />
*[[getPlayersInPhotograph]] <span style="color:gray; font-size:smaller;">» This function returns a table of all players in photograph.</span><br />
*[[getPlayersInVehicles]] <span style="color:gray; font-size:smaller;">» This function returns a table of the players insides vehicles from a specified dimension.</span><br />
*[[isPedAiming]]<span style="color:gray; font-size:smaller;">» This function checks if a pedestrian is aiming their weapon.</span><br />
*[[isPedAimingNearPed]] <span style="color:gray; font-size:smaller;">» This is similar to isPedAiming but uses a colshape to be more precise.</span><br />
*[[isPedDiving]] <span style="color:gray; font-size:smaller;">» This feature checks that pedestrian is diving in the water.</span><br />
*[[isPedDrivingVehicle]] <span style="color:gray; font-size:smaller;">» This function checks if a specified pedestrian is driving a vehicle.</span><br />
*[[isPlayerInTeam]] <span style="color:gray; font-size:smaller;">» This function checks if a player is in a specified team.</span><br />
<br />
=== Player functions ===<br />
*[[countPlayersInRange]] <span style="color:gray; font-size:smaller;">» This function returns the number of players that are within a certain range of the specified coordinates.</span><br />
*[[getPlayerPreviousAndNextWeapon]] <span style="color:gray; font-size:smaller;">» This function returns the player previous and next weapon.</span><br />
*[[getPlayersInRange]]<span style="color:gray; font-size:smaller;">» This function make a table of players within certain range.</span><br />
*[[isPlayerHitByVehicle]]<span style="color:gray; font-size:smaller;">» This function cancels event when a element is hit by a vehicle.</span><br />
*[[warpToPlayer]]<span style="color:gray; font-size:smaller;">» This function make player warp to another player.</span><br />
<br />
=== Resource functions ===<br />
*[[getFilesInResourceFolder]] <span style="color:gray; font-size:smaller;">» This function gets a list of files that are inside a folder of a resource.</span><br />
*[[getResourceScripts]] <span style="color:gray; font-size:smaller;">» This function returns a table of the resource scripts.</span><br />
*[[getResourceSettings]] <span style="color:gray; font-size:smaller;">» This function returns a table of the resource settings.</span><br />
*[[getResourceSize]] <span style="color:gray; font-size:smaller;">» This function returns the size of a specified resource in kB(kilobyte)</span><br />
*[[refreshResource]] <span style="color:gray; font-size:smaller;">» This function refreshes your resource if you changed any of the files<br />
*[[setResourcePriority]] <span style="color:gray; font-size:smaller;">» This function set resource download priority group.</span><br />
*[[isResourceRunning]] <span style="color:gray; font-size:smaller;">» This function return resource state running or not.</span><br />
<br />
=== Sound functions ===<br />
*[[isSoundFinished]] <span style="color:gray; font-size:smaller;">» This function checks if a sound element has finished.</span><br />
*[[isSoundPlaying]] <span style="color:gray; font-size:smaller;">» This function checks if a sound element is playing or not.</span><br />
*[[stopSoundSlowly]] <span style="color:gray; font-size:smaller;">» This function stop your sound element slowly.</span><br />
<br />
=== Browser functions ===<br />
*[[playVideo]] <span style="color:gray; font-size:smaller;">» This function plays a video on the screen.</span><br />
<br />
=== Team functions ===<br />
*[[getTeamFromColor]] <span style="color:gray; font-size:smaller;">» This function returns a team element by the specified color.</span><br />
*[[getTeamWithFewestPlayers]] <span style="color:gray; font-size:smaller;">» This function returns a team element with least players of all the specified teams.</span><br />
<br />
=== Vehicle functions ===<br />
*[[findEmptyCarSeat]] <span style="color:gray; font-size:smaller;">» This function finds you the first empty seat in a vehicle.</span><br />
*[[getNearestVehicle]] <span style="color:gray; font-size:smaller;">» This function gets the nearest vehicle to the specified player in a specified distance.</span><br />
*[[getRandomVehicle]] <span style="color:gray; font-size:smaller;">» This function gets a random vehicle.</span><br />
*[[getValidVehicleModels]] <span style="color:gray; font-size:smaller;">» This function returns a table of all valid vehicle models.</span><br />
*[[getVehiclesCountByType]] <span style="color:gray; font-size:smaller;">» This function returns the amount of vehicles by the given type as an integer value.</span><br />
*[[getVehicleTurnVelocityCenterOfMass]]<span style="color:gray; font-size:smaller;">» This function gets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
*[[isVehicleDoubleExhaust]] <span style="color:gray; font-size:smaller;">» This function checks is exhaust vehicle double.</span><br />
*[[isVehicleEmpty]] <span style="color:gray; font-size:smaller;">» This function checks whether a vehicle is empty.</span><br />
*[[isVehicleOccupied]] <span style="color:gray; font-size:smaller;">» This function checks if a specified vehicle is occupied.</span><br />
*[[isVehicleOnRoof]] <span style="color:gray; font-size:smaller;">» This function checks whether vehicle is on roof.</span><br />
*[[isVehicleReversing]] <span style="color:gray; font-size:smaller;">» This function checks if a specified vehicle is moving backwards.</span><br />
*[[isVehicleUpgraded]] <span style="color:gray; font-size:smaller;">» This function checks is vehicle upgraded by upgrade ID.</span><br />
*[[setVehicleGravityPoint]] <span style="color:gray; font-size:smaller;">» This function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.</span><br />
*[[setVehicleTurnVelocityCenterOfMass]]<span style="color:gray; font-size:smaller;">» This function sets a vehicle's turn velocity relative to the vehicle's center or mass.</span><br />
<br />
=== Weapon functions === <br />
*[[getJetpackWeaponsEnabled]] <span style="color:gray; font-size:smaller;">» This function returns a table of enabled weapons usable on a jetpack.</span><br />
<br />
=== Object functions ===<br />
*[[getDynamicDoorObjectOpenRatio]] <span style="color:gray; font-size:smaller;">» This function tells you how open a dynamic door is in a range from 0 to 1.</span><br />
*[[isElementObject]] <span style="color:gray; font-size:smaller;">» This function tells you if an element is an object or no.</span><br />
<br />
=== XML functions ===<br />
*[[getXMLNodes]] <span style="color:gray; font-size:smaller;">» This function returns all children of a XML node.</span><br />
<br />
=== Engine functions ===<br />
*[[engineGetCOLsFromLibrary]] <span style="color:gray; font-size:smaller;">» This function gets the collision data from the col library.</span><br />
*[[engineLoadIMGContainer]] <span style="color:gray; font-size:smaller;">» This function loads the IMG container.</span><br />
<br />
=== Utility ===<br />
*[[animate]] <span style="color:gray; font-size:smaller;">» This function allows you to use interpolateBetween without render event and easily used.</span><br />
*[[callClientFunction]] <span style="color:gray; font-size:smaller;">» This function allows you to call any client-side function from the server's side.</span><br />
*[[callServerFunction]] <span style="color:gray; font-size:smaller;">» This function allows you to call any server-side function from the client's side.</span><br />
*[[check]] <span style="color:gray; font-size:smaller;">» This function checks if its arguments are of the right type and calls the error-function if one is not.</span><br />
*[[checkPassiveTimer]] <span style="color:gray; font-size:smaller;">» This function allows you to use passive timers in your conditions. For example you want to prevent players repeatedly using a command.</span><br />
*[[coroutine.resume]] <span style="color:gray; font-size:smaller;">» This function applies a fix for hidden coroutine error messages.</span><br />
*[[getBanFromName]] <span style="color:gray; font-size:smaller;">» This functions returns the ban of the given playername.</span><br />
*[[getCurrentFPS]] <span style="color:gray; font-size:smaller;">» This function returns the frames per second at which GTA: SA is running.</span><br />
*[[getSkinNameFromID]] <span style="color:gray; font-size:smaller;">» This function returns the name of the skin from the given id.</span><br />
*[[IfElse]] <span style="color:gray; font-size:smaller;">» This function returns one of two values based on a boolean expression.</span><br />
*[[isCharInString]] <span style="color:gray; font-size:smaller;">» This shared function allows you to check if a char specified is in a string value.</span><br />
*[[isMouseInCircle]] <span style="color:gray; font-size:smaller;">» This function checks if a cursor position is in circular area or not.</span><br />
*[[isMouseInPosition]] <span style="color:gray; font-size:smaller;">» This function allows you to check whether the mouse cursor/pointer is within a rectangular position.</span><br />
*[[iterElements]] <span style="color:gray; font-size:smaller;">» This function returns ''a time-saving'' iterator for your for-loops.</span><br />
*[[PlotTrajectoryAtTime]] <span style="color:gray; font-size:smaller;">» Calculate projectile/water trajectory.</span><br />
*[[preprocessor]] <span style="color:gray; font-size:smaller;">» This function allow you to use gcc macros.</span><br />
*[[vector3:compare]] <span style="color:gray; font-size:smaller;">» This method checks whether two vectors match, with optional precision.</span><br />
<br />
<noinclude>[[Category:Useful Functions]]</noinclude></div>Alex7202https://wiki.multitheftauto.com/index.php?title=HasObjectPermissionTo&diff=73015HasObjectPermissionTo2021-11-07T13:18:51Z<p>Alex7202: add russian language</p>
<hr />
<div>__NOTOC__ <br />
{{Server function}}<br />
This function returns whether or not the given object has access to perform the given action. <br />
{{Note|Only certain action names work. This function seems to return ''nil'' and output a bad argument error when checking if an object has rights for an action which doesn't start with ''function.'', ''command.'' or ''resource.'' keywords.}}<br />
<br />
Scripts frequently wish to limit access to features to particular users. The naïve way to do this would be to check if the player who is attempting to perform an action is in a particular group (usually the Admin group). The main issue with doing this is that the Admin group is not guaranteed to exist. It also doesn't give the server admin any flexibility. He might want to allow his 'moderators' access to the function you're limiting access to, or he may want it disabled entirely. <br />
<br />
This is where using the ACL properly comes in, and luckily this is very easy. It all comes down to using this function. This, somewhat confusingly named function lets you check if an ACL object (a player or a resource) has a particular ACL right. In this case, we just care about players.<br />
<br />
So, first of all, think of a name for your 'right'. Let's say we want a private area only certain people can go in, we'll call our right accessPrivateArea. Then, all you need to do is add one 'if' statement to your code:<br />
<syntaxhighlight lang="lua">if hasObjectPermissionTo ( player, "resource.YourResourceName.accessPrivateArea", false ) then<br />
-- Whatever you want to happen if they're allowed in<br />
else<br />
-- Whatever you want to happen if they aren't<br />
end<br />
</syntaxhighlight><br />
<br />
Notice that we've named the ''right'' using ''resource.YourResourceName.accessPrivateArea'' - this is just for neatness, so that the admin knows what resource the right belongs to. It's strongly advised you follow this convention. The ''false'' argument specifies the 'defaultPermission', false indicating that if the user hasn't had the right allowed or dissallowed (i.e. the admin hasn't added it to the config), that it should default to being not allowed.<br />
<br />
The only downside of using this method is that the admin has to modify his config. The upsides are that the admin has much more control and your script will work for any server, however the admin has configured it.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool hasObjectPermissionTo ( string / element theObject, string theAction [, bool defaultPermission = true ] )<br />
</syntaxhighlight> <br />
<!-- Yes! This is actually correct this time ^^ notice theObject can be a string! --><br />
{{OOP|This function is also a static function underneath the ACL class.|[[ACL]].hasObjectPermissionTo||}}<br />
===Required Arguments=== <br />
*'''theObject:''' The object to test if has permission to. This can be a client element (ie. a player), a resource or a string in the form "user.<name>" or "resource.<name>".<br />
*'''theAction:''' The action to test if the given object has access to. Ie. "function.kickPlayer".<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''defaultPermission:''' The default permission if none is specified in either of the groups the given object is a member of. If this is left to true, the given object will have permissions to perform the action unless the opposite is explicitly specified in the [[ACL]]. If false, the action will be denied by default unless explicitly approved by the [[Access Control List]].<br />
<br />
===Returns===<br />
Returns ''true'' if the given object has permission to perform the given action, ''false'' otherwise. Returns ''nil'' if the function failed because of bad arguments.<br />
<br />
==Example== <br />
This example kicks a player if the user using it has access to the kickPlayer function.<br />
<syntaxhighlight lang="lua"><br />
-- Kick command<br />
function onKickCommandHandler ( playerSource, commandName, playerToKick, stringReason )<br />
-- Does the calling user have permission to kick the player? Default<br />
-- to false for safety reasons. We do this so any user can't use us to<br />
-- kick players.<br />
if ( hasObjectPermissionTo ( playerSource, "function.kickPlayer", false ) ) then<br />
<br />
-- Do we have permission to kick the player? We do this so we can fail<br />
-- nicely if this resource doesn't have access to call that function.<br />
if ( hasObjectPermissionTo ( getThisResource (), "function.kickPlayer", true ) ) then<br />
-- Kick him<br />
kickPlayer ( playerToKick, playerSource, stringReason )<br />
else<br />
-- Resource doesn't have any permissions, sorry<br />
outputChatBox ( "kick: The admin resource is not able to kick players. Please give this resource access to 'function.kickPlayer' in the ACL to use this function.", playerSource )<br />
end<br />
else<br />
-- User doesn't have any permissions<br />
outputChatBox ( "kick: You don't have permissions to use this command.", playerSource )<br />
end<br />
end<br />
addCommandHandler ( "kick", onKickCommandHandler )<br />
</syntaxhighlight><br />
<br />
==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 />
{{ACL_functions}}<br />
[[zh-cn:hasObjectPermissionTo]]<br />
[[pt-br:hasObjectPermissionTo]]<br />
[[ru:hasObjectPermissionTo]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=RU/hasObjectPermissionTo&diff=73014RU/hasObjectPermissionTo2021-11-07T13:18:01Z<p>Alex7202: Created page with "__NOTOC__ {{RU/Server function}} Эта функция возвращает, имеет ли данный объект доступ для выполнения данного..."</p>
<hr />
<div>__NOTOC__ <br />
{{RU/Server function}}<br />
Эта функция возвращает, имеет ли данный объект доступ для выполнения данного действия.<br />
{{Note|Работают только определенные названия действий. Эта функция, возвращает ноль и выводит ошибку неверного аргумента при проверке, если команда начинается не с ''function.'', ''command.'' или ''resource.'' слово.}}<br />
<br />
<syntaxhighlight lang="lua"><br />
if hasObjectPermissionTo ( player, "resource.YourResourceName.accessPrivateArea", false ) then<br />
-- Если доступ разрешен, выполняется действие<br />
else<br />
-- Если доступ запрещен<br />
end<br />
</syntaxhighlight><br />
<br />
Обратите внимание, что мы назвали "право" использование "resource.YourResourceName.accessPrivateArea" - это просто для аккуратности, чтобы администратор знал, какому ресурсу принадлежит право. Настоятельно рекомендуется следовать этой конвенции. Аргумент "false" указывает "defaultpermission", значение false указывает, что если у пользователя не было права разрешать или запрещать (т.е. Администратор не добавил его в конфигурацию), то по умолчанию он должен быть запрещен.<br />
<br />
Единственным недостатком использования этого метода является то, что администратор должен изменить свою конфигурацию. Плюсы в том, что у администратора гораздо больше контроля, и ваш скрипт будет работать на любом сервере, как бы администратор его ни настроил.<br />
<br />
==Синтаксис== <br />
<syntaxhighlight lang="lua"><br />
bool hasObjectPermissionTo ( string / element theObject, string theAction [, bool defaultPermission = true ] )<br />
</syntaxhighlight> <br />
{{RU/OOP|Эта функция также является статической функцией под классом ACL.|[[ACL]].hasObjectPermissionTo||}}<br />
===Обязательные аргумента=== <br />
*'''theObject:''' Объект для проверки, если у него есть разрешение. Это может быть клиентский элемент (т.е. игрока), ресурс или строку в виде "user.<name>" or "resource.<name>".<br />
*'''theAction:''' Действие для проверки, имеет ли данный объект доступ. То есть. "function.kickPlayer".<br />
<br />
===Дополнительные аргументы=== <br />
{{RU/OptionalArg}} <br />
*'''defaultPermission:''' Разрешение по умолчанию, если оно не указано ни в одной из групп, членом которых является данный объект. Если оставить это значение равным true, у данного объекта будут разрешения на выполнение действия, если только в [[ACL]] явно не указано обратное. Если значение равно false, действие будет отклонено по умолчанию, если явно не одобрено [[Access Control List]].<br />
<br />
===Возвращаемые значения===<br />
Вернет ''true'' если у данного объекта есть разрешение на выполнение данного действия, в противном случае ''false''. Возвращает ''nil'', если функция не удалась из-за неверных аргументов.<br />
<br />
==Пример== <br />
В этом примере игрок получает удар ногой, если пользователь, использующий его, имеет доступ к функции "Кик игрока".<br />
<syntaxhighlight lang="lua"><br />
<br />
function onKickCommandHandler ( playerSource, commandName, playerToKick, stringReason )<br />
if ( hasObjectPermissionTo ( playerSource, "function.kickPlayer", false ) ) then<br />
if ( hasObjectPermissionTo ( getThisResource (), "function.kickPlayer", true ) ) then<br />
kickPlayer ( playerToKick, playerSource, stringReason )<br />
else<br />
outputChatBox ( "kick: The admin resource is not able to kick players. Please give this resource access to 'function.kickPlayer' in the ACL to use this function.", playerSource )<br />
end<br />
else<br />
outputChatBox ( "kick: You don't have permissions to use this command.", playerSource )<br />
end<br />
end<br />
addCommandHandler ( "kick", onKickCommandHandler )<br />
</syntaxhighlight><br />
<br />
==Смотрите также==<br />
{{ACL_functions}}<br />
[[zh-cn:hasObjectPermissionTo]]<br />
[[pt-br:hasObjectPermissionTo]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=User:Alex7202&diff=71947User:Alex72022021-08-22T07:37:03Z<p>Alex7202: </p>
<hr />
<div><pageclass class="#8000FF" subcaption="Alex7202"></pageclass><br />
<br><br />
* ВК: [https://www.vk.com/unbeautiful Никита Беспанский]<br><br />
* Мой [[Special:Contributions/Alex7202|вклад]]<br />
<br />
<br></div>Alex7202https://wiki.multitheftauto.com/index.php?title=User:Alex7202&diff=71946User:Alex72022021-08-22T07:36:30Z<p>Alex7202: Created page with "<pageclass class="#8000FF" subcaption="Alex7202"></pageclass> <br> * ВК: [https://www.vk.com/unbeautiful Никита Беспанский]<br> * Мой Special:Contributi..."</p>
<hr />
<div><pageclass class="#8000FF" subcaption="Alex7202"></pageclass><br />
<br><br />
* ВК: [https://www.vk.com/unbeautiful Никита Беспанский]<br><br />
* Мой [[Special:Contributions/Alex7202|вклад]]<br />
<br />
<br><br />
[[User:Alex7202|Alex7202]] ([[User talk:Alex7202|написать]])</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Tocolor2rgba&diff=71578Tocolor2rgba2021-08-06T15:07:02Z<p>Alex7202: </p>
<hr />
<div>{{Useful Function}}<br />
__NOTOC__<br />
This function convert tocolor number to rgba color.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
int, int, int, int tocolor2rgba(int tocolor)<br />
</syntaxhighlight><br />
<br />
===Returns===<br />
Returns a r, g, b, a colors.<br />
<br />
==Code==<br />
<section name="Function source" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function tocolor2rgba(color)<br />
local b = bitExtract ( color, 0, 8 ) <br />
local g = bitExtract ( color, 8, 8 ) <br />
local r = bitExtract ( color, 16, 8 ) <br />
local a = bitExtract ( color, 24, 8 )<br />
return r, g, b, a<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
Author: Alex7202<br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Tocolor2rgba&diff=71577Tocolor2rgba2021-08-06T14:56:46Z<p>Alex7202: Created page with "{{Useful Function}} __NOTOC__ This function convert tocolor number to rgba color. ==Syntax== <syntaxhighlight lang="lua"> int, int, int, int tocolor2rgba(int tocolor) </synta..."</p>
<hr />
<div>{{Useful Function}}<br />
__NOTOC__<br />
This function convert tocolor number to rgba color.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
int, int, int, int tocolor2rgba(int tocolor)<br />
</syntaxhighlight><br />
<br />
===Returns===<br />
Returns a r, g, b, a colors.<br />
<br />
==Code==<br />
<section name="Function source" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function tocolor2rgba(color)<br />
local r = bitExtract ( color, 0, 8 ) <br />
local g = bitExtract ( color, 8, 8 ) <br />
local b = bitExtract ( color, 16, 8 ) <br />
local a = bitExtract ( color, 24, 8 )<br />
return r, g, b, a<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
Author: Alex7202<br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=71576Template:Useful Functions2021-08-06T14:54:55Z<p>Alex7202: /* Data 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.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 />
*[[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>Alex7202https://wiki.multitheftauto.com/index.php?title=Hex2rgb&diff=71570Hex2rgb2021-08-06T12:58:42Z<p>Alex7202: </p>
<hr />
<div>{{Useful Function}}<br />
__NOTOC__<br />
This function retrieves the hex string of a specified color.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
int, int, int hex2rgb(string hex)<br />
</syntaxhighlight><br />
<br />
===Returns===<br />
Returns a r, g, b colors.<br />
<br />
==Code==<br />
<section name="Function source" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function hex2rgb(hex)<br />
local hex = hex:gsub("#","")<br />
return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6))<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
Author: Alex7202<br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Hex2rgb&diff=71569Hex2rgb2021-08-06T12:58:05Z<p>Alex7202: Created page with "{{Useful Function}} __NOTOC__ This function retrieves the hex string of a specified color. ==Syntax== <syntaxhighlight lang="lua"> int r, int g, int b, hex2rgb(string hex) </..."</p>
<hr />
<div>{{Useful Function}}<br />
__NOTOC__<br />
This function retrieves the hex string of a specified color.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
int r, int g, int b, hex2rgb(string hex)<br />
</syntaxhighlight><br />
<br />
===Returns===<br />
Returns a r, g, b colors.<br />
<br />
==Code==<br />
<section name="Function source" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function hex2rgb(hex)<br />
local hex = hex:gsub("#","")<br />
return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6))<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
Author: Alex7202<br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=71568Template:Useful Functions2021-08-06T12:54:25Z<p>Alex7202: /* Data 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.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 />
<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 />
*[[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>Alex7202https://wiki.multitheftauto.com/index.php?title=RU/Famous_crash_offsets_and_their_meaning&diff=71420RU/Famous crash offsets and their meaning2021-06-28T23:56:30Z<p>Alex7202: </p>
<hr />
<div><big>Эта вики-страница содержит причины многих известных крашей MTA, с которыми вы можете столкнуться. Используйте CTRL + F чтобы найти соответствующую ошибку</big><br />
<br />
<br />
Пример краша МТА:<br />
<syntaxhighlight lang="xml"><br />
Version = 1.5.6-release-14664.0.000<br />
Time = Mon Oct 8 12:20:00 2018<br />
Module = C:\Program Files (x86)\Rockstar Games\GTA San Andreas\gta_sa.exe<br />
Code = 0xC0000005<br />
Offset = 0x003C91CC<br />
<br />
EAX=0F77A3C8 EBX=0F77A3B8 ECX=0177FAA0 EDX=00139700 ESI=00000000<br />
EDI=00000001 EBP=0177FC50 ESP=0177FA80 EIP=007C91CC FLG=00210202<br />
CS=0023 DS=002B SS=002B ES=002B FS=0053 GS=002B<br />
</syntaxhighlight><br />
<br />
(Памятка: всегда используйте значение "Offset" чтобы найти код вылета.)<br />
<br />
'''Большинство сбоев MTA вызваны чем-то, что пользователь может решить, потому что это зависит от его системы, выбора сервера или игровых модов.'''<br />
Эта страница стремится быть полезной по вышеупомянутой причине; вы будете знать, где искать, когда вы получите определенный тип сбоя.<br />
<br />
<br />
Для получения дополнительных советов по решению проблем прокрутите страницу вниз до нижней части этой страницы.<br />
<br />
<br/><br />
==Module = gta_sa.exe или proxy_sa.exe==<br />
{| class="wikitable"<br />
|-<br />
!Код ошибки<br />
!Причины<br />
|-<br />
|<syntaxhighlight lang="lua">0x00134134</syntaxhighlight><br />
|Плохая модель или поврежденный GTA3.img. Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Примечание для владельцев серверов и разработчиков моделей: если вы откроете аварийный дамп (.dmp) в виде текста с помощью блокнота и выполните поиск по ключевому слову "CEntity_GetBoundRect - Нет коллизии для модели", вы часто можете идентифицировать идентификатор плохой модели.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00348CF4</syntaxhighlight><br />
|Вызвано s0beit d3d9.dll<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003F0C37<br />
0x003F0BF7<br />
</syntaxhighlight><br />
|Плохая модель автомобиля. Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003C91CC<br />
0x003C920C<br />
</syntaxhighlight><br />
|Закончилась видеопамять. Это может произойти на серверах с неоптимизированными модами и (неисправными) сценариями, которые злоупотребляют видеопамятью, или даже когда у вас есть мощная видеокарта, если материал на сервере крайне неоптимизирован, так что он начинает выходить за пределы GTA. Если у вас мощная видеокарта и больше игроков страдают от этого типа сбоя, сообщите владельцу сервера об этой проблеме, так как это, вероятно, означает, что их сценаристы и дизайнеры не знают, что они делают. Более подробная информация доступна по этим ссылкам на форуме: [https://forum.mtasa.com/topic/85094-mta-crashing/ здесь] и [https://forum.mtasa.com/topic/127677-c-r-a-s-h-i-n-g/ здесь (примерный случай)]<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00357DEC</syntaxhighlight><br />
|Не хватает видеопамяти (вероятно).<br />
|-<br />
|<syntaxhighlight lang="lua">0x003F5A3A</syntaxhighlight><br />
|Сбой памяти, как правило, происходит на сильно неоптимизированных серверах. Это может быть результатом либо нехватки видеопамяти, либо достижения технических пределов использования оперативной памяти, но чаще всего это сочетание того и другого.. поэтому он обозначен как "сильно неоптимизированные серверы". Свяжитесь с владельцем сервера и попросите об оптимизации или найдите другие серверы для игры.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x004A1ED4</syntaxhighlight><br />
|Не хватает памяти (ОЗУ).<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x011630F8<br />
0x011630FE<br />
</syntaxhighlight><br />
|Этот сбой является результатом проблем с моделями столкновений. Это может быть связано с неоптимизированными столкновениями, которые ваш компьютер (или технические ограничения MTA, из-за плохих модов сервера) не может обработать, или из-за поврежденных моделей столкновений. Мы все еще многого не знаем обо всех обстоятельствах, связанных с этой катастрофой. Наш первый совет состоял бы в том, чтобы убедиться, что ваша GTA не модифицирована, и в противном случае попросить владельца сервера определить и устранить проблемы с плохими моделями столкновений.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00137D6E</syntaxhighlight><br />
|Отсутствует системная память (ОЗУ). Это совпадает с конфликтами при загрузке; риск получить этот сбой высок при подключении к серверу с большим количеством модулей со слабым ПК и небольшим объемом памяти.<br />
Чтобы устранить эту ошибку, обратите внимание на серверы, на которых вы играете (оптимизация), или приобретите более быстрый компьютер. Подтип "Нехватка памяти": чаще всего это прямой результат нехватки адресного пространства, поэтому обновление до 64-разрядной установки Windows может решить эту проблему.<br />
|-<br />
|<syntaxhighlight lang="lua">0x0014F406</syntaxhighlight><br />
|Возможно "Running out of memory": прямой результат нехватки адресного пространства, поэтому обновление до 64-разрядной установки Windows может решить эту проблему.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00171A10</syntaxhighlight><br />
|Иногда при подключении к серверу, возможно, это связано с плохими модами сервера.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x000C9F98</syntaxhighlight><br />
|Возможно, плохая модель или текстура (моды на одежду для нескольких скинов, таких как CJ).<br />
Используйте немодифицированную установку GTA для проверки или добавления серверных модов, попросите владельца сервера идентифицировать и отключить моды на таких скинах или любой ресурс, манипулирующий одеждой или доступом к педиатрии.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00349B7B</syntaxhighlight><br />
|Плохая модель скина. Используйте немодифицированную установку GTA, чтобы проверить или удалить серверные моды, попросите владельца сервера идентифицировать и заменить поврежденный скин-мод.<br />
Информация для моделистов и владельцев серверов: повреждение в иерархии аниме в конфигурации DDF кожи или костей peds<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00165096</syntaxhighlight><br />
|Плохая модель (содержащая поврежденную модель столкновения). Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Информация для разработчиков моделей и владельцев серверов: повреждение в одной или нескольких сферах col (или их радиусе) в модели DFF.<br />
|-<br />
|<syntaxhighlight lang="lua">0x001D6E6A</syntaxhighlight><br />
|Либо не хватает видеопамяти, либо плохая модель/текстура.<br />
Информация для моделистов и владельцев серверов: в случае, если виновником является модель, то повреждение находится в структуре модели "предварительно освещенной" (ночные цвета). Попросите своего моделиста воссоздать предварительные данные.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x000DFE92<br />
0x000DFF90<br />
</syntaxhighlight><br />
|Плохие звуковые моды или неисправный аудиодрайвер/устройство. Используйте немодифицированную установку GTA для проверки или обновления ваших аудиодрайверов.<br />
Часто известно, что проблема заключается в полном отсутствии или опустошении/повреждении аудиофайлов (например, в \Rockstar Games\GTA San Andreas\audio > SFX или другой подпапке), поэтому вы можете в качестве альтернативы восстановить целевую резервную копию.<br />
<br />
Не используйте "сжатые" репаки GTA по этой причине вырезанных аудиофайлов.<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x000CFCD6</syntaxhighlight><br />
|Сбой выделения ресурсов в результате (повторного)подключения к серверам после длительной игровой сессии на сервере с плохой практикой в их сценариях (злоупотребление оперативной памятью и функциями anim).<br />
Эта авария может быть "исправлена" (предотвращена) MTA в будущем, мы работаем над этим! Это связано с животными в памяти и их очисткой.|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x00771848<br />
</syntaxhighlight><br />
|Сбой из-за проблемы с файлами данных GTA (MTA не удается их открыть, что может означать, что они повреждены/изменены и несовместимы или отсутствуют)<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x001B6B2F<br />
</syntaxhighlight><br />
|Сбой из-за проблемы с DATA\DEFAULT.DAT или DATA\CARCOLS.DAT в папке установки GTA (может отсутствовать или быть изменен/поврежден).<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003EC9DA<br />
</syntaxhighlight><br />
|Сбой, возможно, из-за проблемы с ANIM\PED.IFP в папке установки GTA (может отсутствовать или изменен/поврежден).<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003F18CF<br />
0x003F190F<br />
</syntaxhighlight><br />
|Плохая модель. Используйте немодифицированную установку GTA для проверки или, в случае модов сервера, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Этот сбой был предотвращен (исправлен MTA), но из-за технических ограничений все равно произойдет для пользователей Windows XP.<br/><br />
Информация для разработчиков моделей и владельцев серверов: из-за характера повреждения модель представляет риск сбоя, это может произойти в любой момент, находясь поблизости.<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x0019BD39<br />
</syntaxhighlight><br />
|Плохая модель. Используйте немодифицированную установку GTA для проверки или, в случае модов сервера, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Этот сбой обычно происходит, когда вы стреляете из оружия, в то время как поврежденная модель передается в потоковом режиме (физически поблизости).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x000C9691<br />
</syntaxhighlight><br />
|Плохая или отсутствующая модель автомобиля. Обычно это происходит, когда вы удалили модель со своего GTA3.img, не восстановив оригинал или не заменив его другой моделью. Или когда DFF вообще не является допустимым файлом модели. Восстановите GTA3.img или используйте немодифицированную установку GTA для проверки, и если это не сработает, попросите владельца сервера идентифицировать и заменить поврежденный мод, поскольку он также может быть плохой моделью (или хитрым сценарием, который, скажите им это: имеет дело с типами транспортных средств, вариантами, обновлениями и т. Д., Неправильным способом).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x0000F67C<br />
0x0000F663<br />
</syntaxhighlight><br />
|Пользовательские модели, которые не работают с объемными тенями. Исправьте модели или отключите объемные тени в Настройках->Видео.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00423FD0</syntaxhighlight><br />
|Плохие моды для GTA или поврежденный GTA3.img. Переустановите GTA (с чистой и оригинальной версией), чтобы решить эту проблему. Примечание: известен сбой для распространенных пиратских копий и торрентов GTA из-за отсутствия, плохих или поврежденных файлов .data,. col и .ipl (предустановленные моды). MTA поддерживает только оригинальную, законно приобретенную версию GTA.<br />
|-<br />
|<syntaxhighlight lang="lua">0x000A2CF3</syntaxhighlight><br />
|Поврежден, отсутствует или изменен файл GTA San Andreas\models > "'effects.fxp". Если восстановление этого файла в исходное состояние не исправит сбой, используйте немодифицированную GTA, так как это также может быть связано с соответствующими файлами данных GTA (теми, которые связаны с эффектами).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x001A49D4<br />
</syntaxhighlight><br />
|Плохой мод (пользовательский player.img в GTA San Andreas\модели). Восстановите файл player.img в исходное состояние или используйте немодифицированную GTA.<br />
Примечание.этот сбой также может быть вызван, когда на вашем экране на сервере, на котором вы играете, появляется игрок с моделью CJ (или одеждой CJ). Ваш пользовательский плеер.img не справится с этим и приведет к сбою.<br />
|}<br />
<br />
<br />
==Устранение сбоев из-за нехватки памяти==<br />
Если вы испытываете сбои, которые, согласно таблице распространенных сбоев, связаны с каким-либо недостатком памяти, мы советуем вам;<br />
<br />
- Обратите внимание на тип серверов, на которых вы играете, особенно в сочетании с мощностью вашего компьютера. В MTA есть много раздутых серверов с большим количеством модов, которые требуют лучшего от вашего компьютера, а также могут злоупотреблять памятью с помощью неэффективных сценариев, помимо пользовательских модов (или даже при их отсутствии).<br />
<br />
Мы могли бы написать книгу о реальной причине (которая заключается в том, что на таких серверах есть плохие скриптеры или те, которые не знают, что такое оптимизация, и что они добавляют все, включая раздутые модели и текстуры, не просматривая их), но мы не будем делать этого здесь.<br />
<br />
Если у вас медленный компьютер или компьютер более старшего поколения, мы советуем вам избегать определенных "модных" серверов с огромными загрузками ресурсов и тому подобным.<br />
<br />
- Установите 64-разрядную версию Windows, а не x86 (32-разрядную)<br />
<br />
<br />
"Если вы все еще хотите играть на серверах, которые могут легко взять верх над вашей системой, тогда;"'<br />
<br />
- Обновите аппаратное обеспечение вашего ПК для повышения производительности; рассмотрите возможность замены видеокарты на видеокарту, подходящую для игр, или добавления дополнительной системной памяти (ОЗУ). Переустановка Windows иногда также может помочь, если ваша ОС в целом работает медленно и не в хорошем состоянии. В качестве альтернативы выполните некоторые действия по обслуживанию (проконсультируйтесь с кем-нибудь с техническим опытом или начните с обновления драйверов и запуска различных очистителей мусора и известных инструментов оптимизации производительности ПК).<br />
<br />
- Следуйте инструкциям, перечисленным на [https://forum.mtasa.com/topic/78081-32-bit-windows-crashing/ https://forum.mtasa.com/topic/78081-32-bit-windows-crashing/]<br />
<br />
- Удалите все моды из вашей установки GTA (предпочтительно переустановите), потому что моды могут занимать видеопамять и оперативную память, достаточную для того, чтобы вызвать высокое использование памяти и последующие сбои.<br />
Кроме того, вам определенно следует попробовать уменьшить потоковую память, перейдя в Настройки->Дополнительно->Потоковая память-> и установив ее на минимальное значение.<br />
<br />
Помните, что GTA-старая игра, и MTA отдает много власти в руки сценаристов (чтобы испортить отсутствие оптимизации). Даже если у вас большой объем оперативной памяти (например, 8 ГБ, 16 ГБ), вы не можете ожидать, что все это будет использоваться.. старые игры имеют технические ограничения и ограниченное адресное пространство. Серверные сценаристы могут делать действительно классные и безумно реалистичные вещи, используя гораздо меньше 3,6 ГБ оперативной памяти (абсолютный технический предел в SA), но только до тех пор, пока у них есть сценаристы и модельеры/дизайнеры, которые знают об оптимизации. Строго взято, никакого сервера, каким бы модным или красивым он ни был.. должно потребоваться использовать более 2 ГБ оперативной памяти. Большинство приличных серверов в любом случае используют от 800 МБ до 1,6 ГБ. Если вы хотите узнать больше об этой теме или являетесь владельцем сервера, который хочет осознать свои ошибки, пожалуйста, присоединяйтесь к MTA discord по адресу https://discord.gg/mtasa и перейдите на канал #general, затем откройте прикрепленный пост этого канала о проблемах экосистемы оптимизации (автор Dutchman101).<br />
<br />
Пожалуйста, обратите внимание, что в общем случае ""любой сбой"" с кодом исключения ""0xE06D7363 "" (в модуле MTA, а не gta_sa.exe как и на этой вики-странице) также является проблемой, связанной с памятью, и возвращается к злоупотреблению памятью серверами и модами, описанными выше.<br />
<br />
==Устранение сбоев, связанных с пользовательскими моделями==<br />
Если у вас возникают сбои, которые, согласно таблице распространенных сбоев, связаны с поврежденными пользовательскими моделями, мы советуем вам переустановить GTA из исходного источника игры (DVD или Steam, поэтому никаких предварительно модифицированных репаков) или восстановить резервные копии целевых файлов, если вы понимаете, какая (тип) модель может вызвать сбой.<br />
<br />
В случае, если вы испытываете сбои только во время игры на определенном сервере, высока вероятность того, что сервер загружает пользовательские модели серверов, и тогда мы рекомендуем вам связаться с владельцем сервера, чтобы он мог изучить и потенциально идентифицировать и заменить поврежденную модель, чтобы остановить сбои. Пока они не предпримут успешных действий, на этом сервере вы можете попытаться избежать физического столкновения с модом, который, по вашему мнению, приведет к сбою (например, не создавать указанное транспортное средство или использовать указанный скин).<br />
Позвольте нам напомнить вам о возможности того, что плохая модель находится в вашем GTA3.img, но по совпадению вы никогда физически не приближаетесь к этой модели на других серверах, и сервер, на котором вы больше всего зависаете, вынуждает вас использовать этот идентификатор модели (например, как регулярно используемый автомобиль или скин); поэтому нельзя исключать, что это, возможно, все еще ваш клиентский мод, несмотря на то, что вы зависаете только на одном сервере, и стоит, по крайней мере, переустановить GTA, чтобы попробовать его.<br />
<br />
Если вы являетесь владельцем сервера и не хотели бы отказываться от своей любимой (поврежденной) модели, то вы можете попросить опытного моделиста попытаться исправить повреждение, изменив/изменив его.<br />
Альтернатива сбою многих игроков, потенциально приводящая к потере игроков на вашем сервере, в любом случае не подходит. По этой причине, внимательно следить за тенденциями игроков, сообщающих (или кричащих) о том, что они потерпели крушение, и следить за ними, чтобы получить подробную информацию о крушении (чтобы попытаться сопоставить их с моделями крушений из таблицы на этой вики-странице), может быть хорошей идеей.<br />
<br />
Добавление обновляемых компонентов (с именем "ug_upgradename") за пределами chassis_dummy приведет к сбоям, как только в транспортном средстве появится соответствующий компонент обновления.<br />
<br />
[[en:Famous crash offsets and their meaning]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=RU/Famous_crash_offsets_and_their_meaning&diff=71419RU/Famous crash offsets and their meaning2021-06-28T23:55:26Z<p>Alex7202: </p>
<hr />
<div><big>Эта вики-страница содержит причины многих известных крашей MTA, с которыми вы можете столкнуться. Используйте CTRL + F чтобы найти соответствующую ошибку</big><br />
<br />
<br />
Пример краша МТА:<br />
<syntaxhighlight lang="xml"><br />
Version = 1.5.6-release-14664.0.000<br />
Time = Mon Oct 8 12:20:00 2018<br />
Module = C:\Program Files (x86)\Rockstar Games\GTA San Andreas\gta_sa.exe<br />
Code = 0xC0000005<br />
Offset = 0x003C91CC<br />
<br />
EAX=0F77A3C8 EBX=0F77A3B8 ECX=0177FAA0 EDX=00139700 ESI=00000000<br />
EDI=00000001 EBP=0177FC50 ESP=0177FA80 EIP=007C91CC FLG=00210202<br />
CS=0023 DS=002B SS=002B ES=002B FS=0053 GS=002B<br />
</syntaxhighlight><br />
<br />
(Памятка: всегда используйте значение "Offset" чтобы найти код вылета.)<br />
<br />
'''Большинство сбоев MTA вызваны чем-то, что пользователь может решить, потому что это зависит от его системы, выбора сервера или игровых модов.'''<br />
Эта страница стремится быть полезной по вышеупомянутой причине; вы будете знать, где искать, когда вы получите определенный тип сбоя.<br />
<br />
<br />
Для получения дополнительных советов по решению проблем прокрутите страницу вниз до нижней части этой страницы.<br />
<br />
<br/><br />
==Module = gta_sa.exe или proxy_sa.exe==<br />
{| class="wikitable"<br />
|-<br />
!Код ошибки<br />
!Причины<br />
|-<br />
|<syntaxhighlight lang="lua">0x00134134</syntaxhighlight><br />
|Плохая модель или поврежденный GTA3.img. Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Примечание для владельцев серверов и разработчиков моделей: если вы откроете аварийный дамп (.dmp) в виде текста с помощью блокнота и выполните поиск по ключевому слову "CEntity_GetBoundRect - Нет коллизии для модели", вы часто можете идентифицировать идентификатор плохой модели.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00348CF4</syntaxhighlight><br />
|Вызвано s0beit d3d9.dll<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003F0C37<br />
0x003F0BF7<br />
</syntaxhighlight><br />
|Плохая модель автомобиля. Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003C91CC<br />
0x003C920C<br />
</syntaxhighlight><br />
|Закончилась видеопамять. Это может произойти на серверах с неоптимизированными модами и (неисправными) сценариями, которые злоупотребляют видеопамятью, или даже когда у вас есть мощная видеокарта, если материал на сервере крайне неоптимизирован, так что он начинает выходить за пределы GTA. Если у вас мощная видеокарта и больше игроков страдают от этого типа сбоя, сообщите владельцу сервера об этой проблеме, так как это, вероятно, означает, что их сценаристы и дизайнеры не знают, что они делают. Более подробная информация доступна по этим ссылкам на форуме: [https://forum.mtasa.com/topic/85094-mta-crashing/ здесь] и [https://forum.mtasa.com/topic/127677-c-r-a-s-h-i-n-g/ здесь (примерный случай)]<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00357DEC</syntaxhighlight><br />
|Не хватает видеопамяти (вероятно).<br />
|-<br />
|<syntaxhighlight lang="lua">0x003F5A3A</syntaxhighlight><br />
|Сбой памяти, как правило, происходит на сильно неоптимизированных серверах. Это может быть результатом либо нехватки видеопамяти, либо достижения технических пределов использования оперативной памяти, но чаще всего это сочетание того и другого.. поэтому он обозначен как "сильно неоптимизированные серверы". Свяжитесь с владельцем сервера и попросите об оптимизации или найдите другие серверы для игры.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x004A1ED4</syntaxhighlight><br />
|Не хватает памяти (ОЗУ).<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x011630F8<br />
0x011630FE<br />
</syntaxhighlight><br />
|Этот сбой является результатом проблем с моделями столкновений. Это может быть связано с неоптимизированными столкновениями, которые ваш компьютер (или технические ограничения MTA, из-за плохих модов сервера) не может обработать, или из-за поврежденных моделей столкновений. Мы все еще многого не знаем обо всех обстоятельствах, связанных с этой катастрофой. Наш первый совет состоял бы в том, чтобы убедиться, что ваша GTA не модифицирована, и в противном случае попросить владельца сервера определить и устранить проблемы с плохими моделями столкновений.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00137D6E</syntaxhighlight><br />
|Отсутствует системная память (ОЗУ). Это совпадает с конфликтами при загрузке; риск получить этот сбой высок при подключении к серверу с большим количеством модулей со слабым ПК и небольшим объемом памяти.<br />
Чтобы устранить эту ошибку, обратите внимание на серверы, на которых вы играете (оптимизация), или приобретите более быстрый компьютер. Подтип "Нехватка памяти": чаще всего это прямой результат нехватки адресного пространства, поэтому обновление до 64-разрядной установки Windows может решить эту проблему.<br />
|-<br />
|<syntaxhighlight lang="lua">0x0014F406</syntaxhighlight><br />
|Возможно "Running out of memory": прямой результат нехватки адресного пространства, поэтому обновление до 64-разрядной установки Windows может решить эту проблему.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00171A10</syntaxhighlight><br />
|Иногда при подключении к серверу, возможно, это связано с плохими модами сервера.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x000C9F98</syntaxhighlight><br />
|Возможно, плохая модель или текстура (моды на одежду для нескольких скинов, таких как CJ).<br />
Используйте немодифицированную установку GTA для проверки или добавления серверных модов, попросите владельца сервера идентифицировать и отключить моды на таких скинах или любой ресурс, манипулирующий одеждой или доступом к педиатрии.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00349B7B</syntaxhighlight><br />
|Плохая модель скина. Используйте немодифицированную установку GTA, чтобы проверить или удалить серверные моды, попросите владельца сервера идентифицировать и заменить поврежденный скин-мод.<br />
Информация для моделистов и владельцев серверов: повреждение в иерархии аниме в конфигурации DDF кожи или костей peds<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00165096</syntaxhighlight><br />
|Плохая модель (содержащая поврежденную модель столкновения). Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Информация для разработчиков моделей и владельцев серверов: повреждение в одной или нескольких сферах col (или их радиусе) в модели DFF.<br />
|-<br />
|<syntaxhighlight lang="lua">0x001D6E6A</syntaxhighlight><br />
|Либо не хватает видеопамяти, либо плохая модель/текстура.<br />
Информация для моделистов и владельцев серверов: в случае, если виновником является модель, то повреждение находится в структуре модели "предварительно освещенной" (ночные цвета). Попросите своего моделиста воссоздать предварительные данные.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x000DFE92<br />
0x000DFF90<br />
</syntaxhighlight><br />
|Плохие звуковые моды или неисправный аудиодрайвер/устройство. Используйте немодифицированную установку GTA для проверки или обновления ваших аудиодрайверов.<br />
Часто известно, что проблема заключается в полном отсутствии или опустошении/повреждении аудиофайлов (например, в \Rockstar Games\GTA San Andreas\audio > SFX или другой подпапке), поэтому вы можете в качестве альтернативы восстановить целевую резервную копию.<br />
<br />
Не используйте "сжатые" репаки GTA по этой причине вырезанных аудиофайлов.<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x000CFCD6</syntaxhighlight><br />
|Сбой выделения ресурсов в результате (повторного)подключения к серверам после длительной игровой сессии на сервере с плохой практикой в их сценариях (злоупотребление оперативной памятью и функциями anim).<br />
Эта авария может быть "исправлена" (предотвращена) MTA в будущем, мы работаем над этим! Это связано с животными в памяти и их очисткой.|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x00771848<br />
</syntaxhighlight><br />
|Сбой из-за проблемы с файлами данных GTA (MTA не удается их открыть, что может означать, что они повреждены/изменены и несовместимы или отсутствуют)<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x001B6B2F<br />
</syntaxhighlight><br />
|Сбой из-за проблемы с DATA\DEFAULT.DAT или DATA\CARCOLS.DAT в папке установки GTA (может отсутствовать или быть изменен/поврежден).<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003EC9DA<br />
</syntaxhighlight><br />
|Сбой, возможно, из-за проблемы с ANIM\PED.IFP в папке установки GTA (может отсутствовать или изменен/поврежден).<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003F18CF<br />
0x003F190F<br />
</syntaxhighlight><br />
|Плохая модель. Используйте немодифицированную установку GTA для проверки или, в случае модов сервера, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Этот сбой был предотвращен (исправлен MTA), но из-за технических ограничений все равно произойдет для пользователей Windows XP.<br/><br />
Информация для разработчиков моделей и владельцев серверов: из-за характера повреждения модель представляет риск сбоя, это может произойти в любой момент, находясь поблизости.<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x0019BD39<br />
</syntaxhighlight><br />
|Плохая модель. Используйте немодифицированную установку GTA для проверки или, в случае модов сервера, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Этот сбой обычно происходит, когда вы стреляете из оружия, в то время как поврежденная модель передается в потоковом режиме (физически поблизости).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x000C9691<br />
</syntaxhighlight><br />
|Плохая или отсутствующая модель автомобиля. Обычно это происходит, когда вы удалили модель со своего GTA3.img, не восстановив оригинал или не заменив его другой моделью. Или когда DFF вообще не является допустимым файлом модели. Восстановите GTA3.img или используйте немодифицированную установку GTA для проверки, и если это не сработает, попросите владельца сервера идентифицировать и заменить поврежденный мод, поскольку он также может быть плохой моделью (или хитрым сценарием, который, скажите им это: имеет дело с типами транспортных средств, вариантами, обновлениями и т. Д., Неправильным способом).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x0000F67C<br />
0x0000F663<br />
</syntaxhighlight><br />
|Пользовательские модели, которые не работают с объемными тенями. Исправьте модели или отключите объемные тени в Настройках->Видео.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00423FD0</syntaxhighlight><br />
|Плохие моды для GTA или поврежденный GTA3.img. Переустановите GTA (с чистой и оригинальной версией), чтобы решить эту проблему. Примечание: известен сбой для распространенных пиратских копий и торрентов GTA из-за отсутствия, плохих или поврежденных файлов .data,. col и .ipl (предустановленные моды). MTA поддерживает только оригинальную, законно приобретенную версию GTA.<br />
|-<br />
|<syntaxhighlight lang="lua">0x000A2CF3</syntaxhighlight><br />
|Поврежден, отсутствует или изменен файл GTA San Andreas\models > "'effects.fxp". Если восстановление этого файла в исходное состояние не исправит сбой, используйте немодифицированную GTA, так как это также может быть связано с соответствующими файлами данных GTA (теми, которые связаны с эффектами).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x001A49D4<br />
</syntaxhighlight><br />
|Плохой мод (пользовательский player.img в GTA San Andreas\модели). Восстановите файл player.img в исходное состояние или используйте немодифицированную GTA.<br />
Примечание.этот сбой также может быть вызван, когда на вашем экране на сервере, на котором вы играете, появляется игрок с моделью CJ (или одеждой CJ). Ваш пользовательский плеер.img не справится с этим и приведет к сбою.<br />
|}<br />
<br />
<br />
==Устранение сбоев из-за нехватки памяти==<br />
Если вы испытываете сбои, которые, согласно таблице распространенных сбоев, связаны с каким-либо недостатком памяти, мы советуем вам;<br />
<br />
- Обратите внимание на тип серверов, на которых вы играете, особенно в сочетании с мощностью вашего компьютера. В MTA есть много раздутых серверов с большим количеством модов, которые требуют лучшего от вашего компьютера, а также могут злоупотреблять памятью с помощью неэффективных сценариев, помимо пользовательских модов (или даже при их отсутствии).<br />
<br />
Мы могли бы написать книгу о реальной причине (которая заключается в том, что на таких серверах есть плохие скриптеры или те, которые не знают, что такое оптимизация, и что они добавляют все, включая раздутые модели и текстуры, не просматривая их), но мы не будем делать этого здесь.<br />
<br />
Если у вас медленный компьютер или компьютер более старшего поколения, мы советуем вам избегать определенных "модных" серверов с огромными загрузками ресурсов и тому подобным.<br />
<br />
- Установите 64-разрядную версию Windows, а не x86 (32-разрядную)<br />
<br />
<br />
"Если вы все еще хотите играть на серверах, которые могут легко взять верх над вашей системой, тогда;"'<br />
<br />
- Обновите аппаратное обеспечение вашего ПК для повышения производительности; рассмотрите возможность замены видеокарты на видеокарту, подходящую для игр, или добавления дополнительной системной памяти (ОЗУ). Переустановка Windows иногда также может помочь, если ваша ОС в целом работает медленно и не в хорошем состоянии. В качестве альтернативы выполните некоторые действия по обслуживанию (проконсультируйтесь с кем-нибудь с техническим опытом или начните с обновления драйверов и запуска различных очистителей мусора и известных инструментов оптимизации производительности ПК).<br />
<br />
- Следуйте инструкциям, перечисленным на [https://forum.mtasa.com/topic/78081-32-bit-windows-crashing/ https://forum.mtasa.com/topic/78081-32-bit-windows-crashing/]<br />
<br />
- Удалите все моды из вашей установки GTA (предпочтительно переустановите), потому что моды могут занимать видеопамять и оперативную память, достаточную для того, чтобы вызвать высокое использование памяти и последующие сбои.<br />
Кроме того, вам определенно следует попробовать уменьшить потоковую память, перейдя в Настройки->Дополнительно->Потоковая память-> и установив ее на минимальное значение.<br />
<br />
Помните, что GTA-старая игра, и MTA отдает много власти в руки сценаристов (чтобы испортить отсутствие оптимизации). Даже если у вас большой объем оперативной памяти (например, 8 ГБ, 16 ГБ), вы не можете ожидать, что все это будет использоваться.. старые игры имеют технические ограничения и ограниченное адресное пространство. Серверные сценаристы могут делать действительно классные и безумно реалистичные вещи, используя гораздо меньше 3,6 ГБ оперативной памяти (абсолютный технический предел в SA), но только до тех пор, пока у них есть сценаристы и модельеры/дизайнеры, которые знают об оптимизации. Строго взято, никакого сервера, каким бы модным или красивым он ни был.. должно потребоваться использовать более 2 ГБ оперативной памяти. Большинство приличных серверов в любом случае используют от 800 МБ до 1,6 ГБ. Если вы хотите узнать больше об этой теме или являетесь владельцем сервера, который хочет осознать свои ошибки, пожалуйста, присоединяйтесь к MTA discord по адресу https://discord.gg/mtasa и перейдите на канал #general, затем откройте прикрепленный пост этого канала о проблемах экосистемы оптимизации (автор Dutchman101).<br />
<br />
Пожалуйста, обратите внимание, что в общем случае ""любой сбой"" с кодом исключения ""0xE06D7363 "" (в модуле MTA, а не gta_sa.exe как и на этой вики-странице) также является проблемой, связанной с памятью, и возвращается к злоупотреблению памятью серверами и модами, описанными выше.<br />
<br />
==Устранение сбоев, связанных с пользовательскими моделями==<br />
Если у вас возникают сбои, которые, согласно таблице распространенных сбоев, связаны с поврежденными пользовательскими моделями, мы советуем вам переустановить GTA из исходного источника игры (DVD или Steam, поэтому никаких предварительно модифицированных репаков) или восстановить резервные копии целевых файлов, если вы понимаете, какая (тип) модель может вызвать сбой.<br />
<br />
В случае, если вы испытываете сбои только во время игры на определенном сервере, высока вероятность того, что сервер загружает пользовательские модели серверов, и тогда мы рекомендуем вам связаться с владельцем сервера, чтобы он мог изучить и потенциально идентифицировать и заменить поврежденную модель, чтобы остановить сбои. Пока они не предпримут успешных действий, на этом сервере вы можете попытаться избежать физического столкновения с модом, который, по вашему мнению, приведет к сбою (например, не создавать указанное транспортное средство или использовать указанный скин).<br />
Позвольте нам напомнить вам о возможности того, что плохая модель находится в вашем GTA3.img, но по совпадению вы никогда физически не приближаетесь к этой модели на других серверах, и сервер, на котором вы больше всего зависаете, вынуждает вас использовать этот идентификатор модели (например, как регулярно используемый автомобиль или скин); поэтому нельзя исключать, что это, возможно, все еще ваш клиентский мод, несмотря на то, что вы зависаете только на одном сервере, и стоит, по крайней мере, переустановить GTA, чтобы попробовать его.<br />
<br />
Если вы являетесь владельцем сервера и не хотели бы отказываться от своей любимой (поврежденной) модели, то вы можете попросить опытного моделиста попытаться исправить повреждение, изменив/изменив его.<br />
Альтернатива сбою многих игроков, потенциально приводящая к потере игроков на вашем сервере, в любом случае не подходит. По этой причине, внимательно следить за тенденциями игроков, сообщающих (или кричащих) о том, что они потерпели крушение, и следить за ними, чтобы получить подробную информацию о крушении (чтобы попытаться сопоставить их с моделями крушений из таблицы на этой вики-странице), может быть хорошей идеей.<br />
<br />
Добавление обновляемых компонентов (с именем "ug_upgradename") за пределами chassis_dummy приведет к сбоям, как только в транспортном средстве появится соответствующий компонент обновления.<br />
<br />
[[Famous crash offsets and their meaning]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=RU/Famous_crash_offsets_and_their_meaning&diff=71418RU/Famous crash offsets and their meaning2021-06-28T23:55:08Z<p>Alex7202: </p>
<hr />
<div><big>"Эта вики-страница содержит причины многих известных крашей MTA, с которыми вы можете столкнуться. Используйте CTRL + F чтобы найти соответствующую ошибку</big><br />
<br />
<br />
Пример краша МТА:<br />
<syntaxhighlight lang="xml"><br />
Version = 1.5.6-release-14664.0.000<br />
Time = Mon Oct 8 12:20:00 2018<br />
Module = C:\Program Files (x86)\Rockstar Games\GTA San Andreas\gta_sa.exe<br />
Code = 0xC0000005<br />
Offset = 0x003C91CC<br />
<br />
EAX=0F77A3C8 EBX=0F77A3B8 ECX=0177FAA0 EDX=00139700 ESI=00000000<br />
EDI=00000001 EBP=0177FC50 ESP=0177FA80 EIP=007C91CC FLG=00210202<br />
CS=0023 DS=002B SS=002B ES=002B FS=0053 GS=002B<br />
</syntaxhighlight><br />
<br />
(Памятка: всегда используйте значение "Offset" чтобы найти код вылета.)<br />
<br />
'''Большинство сбоев MTA вызваны чем-то, что пользователь может решить, потому что это зависит от его системы, выбора сервера или игровых модов.'''<br />
Эта страница стремится быть полезной по вышеупомянутой причине; вы будете знать, где искать, когда вы получите определенный тип сбоя.<br />
<br />
<br />
Для получения дополнительных советов по решению проблем прокрутите страницу вниз до нижней части этой страницы.<br />
<br />
<br/><br />
==Module = gta_sa.exe или proxy_sa.exe==<br />
{| class="wikitable"<br />
|-<br />
!Код ошибки<br />
!Причины<br />
|-<br />
|<syntaxhighlight lang="lua">0x00134134</syntaxhighlight><br />
|Плохая модель или поврежденный GTA3.img. Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Примечание для владельцев серверов и разработчиков моделей: если вы откроете аварийный дамп (.dmp) в виде текста с помощью блокнота и выполните поиск по ключевому слову "CEntity_GetBoundRect - Нет коллизии для модели", вы часто можете идентифицировать идентификатор плохой модели.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00348CF4</syntaxhighlight><br />
|Вызвано s0beit d3d9.dll<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003F0C37<br />
0x003F0BF7<br />
</syntaxhighlight><br />
|Плохая модель автомобиля. Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003C91CC<br />
0x003C920C<br />
</syntaxhighlight><br />
|Закончилась видеопамять. Это может произойти на серверах с неоптимизированными модами и (неисправными) сценариями, которые злоупотребляют видеопамятью, или даже когда у вас есть мощная видеокарта, если материал на сервере крайне неоптимизирован, так что он начинает выходить за пределы GTA. Если у вас мощная видеокарта и больше игроков страдают от этого типа сбоя, сообщите владельцу сервера об этой проблеме, так как это, вероятно, означает, что их сценаристы и дизайнеры не знают, что они делают. Более подробная информация доступна по этим ссылкам на форуме: [https://forum.mtasa.com/topic/85094-mta-crashing/ здесь] и [https://forum.mtasa.com/topic/127677-c-r-a-s-h-i-n-g/ здесь (примерный случай)]<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00357DEC</syntaxhighlight><br />
|Не хватает видеопамяти (вероятно).<br />
|-<br />
|<syntaxhighlight lang="lua">0x003F5A3A</syntaxhighlight><br />
|Сбой памяти, как правило, происходит на сильно неоптимизированных серверах. Это может быть результатом либо нехватки видеопамяти, либо достижения технических пределов использования оперативной памяти, но чаще всего это сочетание того и другого.. поэтому он обозначен как "сильно неоптимизированные серверы". Свяжитесь с владельцем сервера и попросите об оптимизации или найдите другие серверы для игры.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x004A1ED4</syntaxhighlight><br />
|Не хватает памяти (ОЗУ).<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x011630F8<br />
0x011630FE<br />
</syntaxhighlight><br />
|Этот сбой является результатом проблем с моделями столкновений. Это может быть связано с неоптимизированными столкновениями, которые ваш компьютер (или технические ограничения MTA, из-за плохих модов сервера) не может обработать, или из-за поврежденных моделей столкновений. Мы все еще многого не знаем обо всех обстоятельствах, связанных с этой катастрофой. Наш первый совет состоял бы в том, чтобы убедиться, что ваша GTA не модифицирована, и в противном случае попросить владельца сервера определить и устранить проблемы с плохими моделями столкновений.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00137D6E</syntaxhighlight><br />
|Отсутствует системная память (ОЗУ). Это совпадает с конфликтами при загрузке; риск получить этот сбой высок при подключении к серверу с большим количеством модулей со слабым ПК и небольшим объемом памяти.<br />
Чтобы устранить эту ошибку, обратите внимание на серверы, на которых вы играете (оптимизация), или приобретите более быстрый компьютер. Подтип "Нехватка памяти": чаще всего это прямой результат нехватки адресного пространства, поэтому обновление до 64-разрядной установки Windows может решить эту проблему.<br />
|-<br />
|<syntaxhighlight lang="lua">0x0014F406</syntaxhighlight><br />
|Возможно "Running out of memory": прямой результат нехватки адресного пространства, поэтому обновление до 64-разрядной установки Windows может решить эту проблему.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00171A10</syntaxhighlight><br />
|Иногда при подключении к серверу, возможно, это связано с плохими модами сервера.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x000C9F98</syntaxhighlight><br />
|Возможно, плохая модель или текстура (моды на одежду для нескольких скинов, таких как CJ).<br />
Используйте немодифицированную установку GTA для проверки или добавления серверных модов, попросите владельца сервера идентифицировать и отключить моды на таких скинах или любой ресурс, манипулирующий одеждой или доступом к педиатрии.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00349B7B</syntaxhighlight><br />
|Плохая модель скина. Используйте немодифицированную установку GTA, чтобы проверить или удалить серверные моды, попросите владельца сервера идентифицировать и заменить поврежденный скин-мод.<br />
Информация для моделистов и владельцев серверов: повреждение в иерархии аниме в конфигурации DDF кожи или костей peds<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00165096</syntaxhighlight><br />
|Плохая модель (содержащая поврежденную модель столкновения). Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Информация для разработчиков моделей и владельцев серверов: повреждение в одной или нескольких сферах col (или их радиусе) в модели DFF.<br />
|-<br />
|<syntaxhighlight lang="lua">0x001D6E6A</syntaxhighlight><br />
|Либо не хватает видеопамяти, либо плохая модель/текстура.<br />
Информация для моделистов и владельцев серверов: в случае, если виновником является модель, то повреждение находится в структуре модели "предварительно освещенной" (ночные цвета). Попросите своего моделиста воссоздать предварительные данные.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x000DFE92<br />
0x000DFF90<br />
</syntaxhighlight><br />
|Плохие звуковые моды или неисправный аудиодрайвер/устройство. Используйте немодифицированную установку GTA для проверки или обновления ваших аудиодрайверов.<br />
Часто известно, что проблема заключается в полном отсутствии или опустошении/повреждении аудиофайлов (например, в \Rockstar Games\GTA San Andreas\audio > SFX или другой подпапке), поэтому вы можете в качестве альтернативы восстановить целевую резервную копию.<br />
<br />
Не используйте "сжатые" репаки GTA по этой причине вырезанных аудиофайлов.<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x000CFCD6</syntaxhighlight><br />
|Сбой выделения ресурсов в результате (повторного)подключения к серверам после длительной игровой сессии на сервере с плохой практикой в их сценариях (злоупотребление оперативной памятью и функциями anim).<br />
Эта авария может быть "исправлена" (предотвращена) MTA в будущем, мы работаем над этим! Это связано с животными в памяти и их очисткой.|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x00771848<br />
</syntaxhighlight><br />
|Сбой из-за проблемы с файлами данных GTA (MTA не удается их открыть, что может означать, что они повреждены/изменены и несовместимы или отсутствуют)<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x001B6B2F<br />
</syntaxhighlight><br />
|Сбой из-за проблемы с DATA\DEFAULT.DAT или DATA\CARCOLS.DAT в папке установки GTA (может отсутствовать или быть изменен/поврежден).<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003EC9DA<br />
</syntaxhighlight><br />
|Сбой, возможно, из-за проблемы с ANIM\PED.IFP в папке установки GTA (может отсутствовать или изменен/поврежден).<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003F18CF<br />
0x003F190F<br />
</syntaxhighlight><br />
|Плохая модель. Используйте немодифицированную установку GTA для проверки или, в случае модов сервера, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Этот сбой был предотвращен (исправлен MTA), но из-за технических ограничений все равно произойдет для пользователей Windows XP.<br/><br />
Информация для разработчиков моделей и владельцев серверов: из-за характера повреждения модель представляет риск сбоя, это может произойти в любой момент, находясь поблизости.<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x0019BD39<br />
</syntaxhighlight><br />
|Плохая модель. Используйте немодифицированную установку GTA для проверки или, в случае модов сервера, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Этот сбой обычно происходит, когда вы стреляете из оружия, в то время как поврежденная модель передается в потоковом режиме (физически поблизости).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x000C9691<br />
</syntaxhighlight><br />
|Плохая или отсутствующая модель автомобиля. Обычно это происходит, когда вы удалили модель со своего GTA3.img, не восстановив оригинал или не заменив его другой моделью. Или когда DFF вообще не является допустимым файлом модели. Восстановите GTA3.img или используйте немодифицированную установку GTA для проверки, и если это не сработает, попросите владельца сервера идентифицировать и заменить поврежденный мод, поскольку он также может быть плохой моделью (или хитрым сценарием, который, скажите им это: имеет дело с типами транспортных средств, вариантами, обновлениями и т. Д., Неправильным способом).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x0000F67C<br />
0x0000F663<br />
</syntaxhighlight><br />
|Пользовательские модели, которые не работают с объемными тенями. Исправьте модели или отключите объемные тени в Настройках->Видео.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00423FD0</syntaxhighlight><br />
|Плохие моды для GTA или поврежденный GTA3.img. Переустановите GTA (с чистой и оригинальной версией), чтобы решить эту проблему. Примечание: известен сбой для распространенных пиратских копий и торрентов GTA из-за отсутствия, плохих или поврежденных файлов .data,. col и .ipl (предустановленные моды). MTA поддерживает только оригинальную, законно приобретенную версию GTA.<br />
|-<br />
|<syntaxhighlight lang="lua">0x000A2CF3</syntaxhighlight><br />
|Поврежден, отсутствует или изменен файл GTA San Andreas\models > "'effects.fxp". Если восстановление этого файла в исходное состояние не исправит сбой, используйте немодифицированную GTA, так как это также может быть связано с соответствующими файлами данных GTA (теми, которые связаны с эффектами).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x001A49D4<br />
</syntaxhighlight><br />
|Плохой мод (пользовательский player.img в GTA San Andreas\модели). Восстановите файл player.img в исходное состояние или используйте немодифицированную GTA.<br />
Примечание.этот сбой также может быть вызван, когда на вашем экране на сервере, на котором вы играете, появляется игрок с моделью CJ (или одеждой CJ). Ваш пользовательский плеер.img не справится с этим и приведет к сбою.<br />
|}<br />
<br />
<br />
==Устранение сбоев из-за нехватки памяти==<br />
Если вы испытываете сбои, которые, согласно таблице распространенных сбоев, связаны с каким-либо недостатком памяти, мы советуем вам;<br />
<br />
- Обратите внимание на тип серверов, на которых вы играете, особенно в сочетании с мощностью вашего компьютера. В MTA есть много раздутых серверов с большим количеством модов, которые требуют лучшего от вашего компьютера, а также могут злоупотреблять памятью с помощью неэффективных сценариев, помимо пользовательских модов (или даже при их отсутствии).<br />
<br />
Мы могли бы написать книгу о реальной причине (которая заключается в том, что на таких серверах есть плохие скриптеры или те, которые не знают, что такое оптимизация, и что они добавляют все, включая раздутые модели и текстуры, не просматривая их), но мы не будем делать этого здесь.<br />
<br />
Если у вас медленный компьютер или компьютер более старшего поколения, мы советуем вам избегать определенных "модных" серверов с огромными загрузками ресурсов и тому подобным.<br />
<br />
- Установите 64-разрядную версию Windows, а не x86 (32-разрядную)<br />
<br />
<br />
"Если вы все еще хотите играть на серверах, которые могут легко взять верх над вашей системой, тогда;"'<br />
<br />
- Обновите аппаратное обеспечение вашего ПК для повышения производительности; рассмотрите возможность замены видеокарты на видеокарту, подходящую для игр, или добавления дополнительной системной памяти (ОЗУ). Переустановка Windows иногда также может помочь, если ваша ОС в целом работает медленно и не в хорошем состоянии. В качестве альтернативы выполните некоторые действия по обслуживанию (проконсультируйтесь с кем-нибудь с техническим опытом или начните с обновления драйверов и запуска различных очистителей мусора и известных инструментов оптимизации производительности ПК).<br />
<br />
- Следуйте инструкциям, перечисленным на [https://forum.mtasa.com/topic/78081-32-bit-windows-crashing/ https://forum.mtasa.com/topic/78081-32-bit-windows-crashing/]<br />
<br />
- Удалите все моды из вашей установки GTA (предпочтительно переустановите), потому что моды могут занимать видеопамять и оперативную память, достаточную для того, чтобы вызвать высокое использование памяти и последующие сбои.<br />
Кроме того, вам определенно следует попробовать уменьшить потоковую память, перейдя в Настройки->Дополнительно->Потоковая память-> и установив ее на минимальное значение.<br />
<br />
Помните, что GTA-старая игра, и MTA отдает много власти в руки сценаристов (чтобы испортить отсутствие оптимизации). Даже если у вас большой объем оперативной памяти (например, 8 ГБ, 16 ГБ), вы не можете ожидать, что все это будет использоваться.. старые игры имеют технические ограничения и ограниченное адресное пространство. Серверные сценаристы могут делать действительно классные и безумно реалистичные вещи, используя гораздо меньше 3,6 ГБ оперативной памяти (абсолютный технический предел в SA), но только до тех пор, пока у них есть сценаристы и модельеры/дизайнеры, которые знают об оптимизации. Строго взято, никакого сервера, каким бы модным или красивым он ни был.. должно потребоваться использовать более 2 ГБ оперативной памяти. Большинство приличных серверов в любом случае используют от 800 МБ до 1,6 ГБ. Если вы хотите узнать больше об этой теме или являетесь владельцем сервера, который хочет осознать свои ошибки, пожалуйста, присоединяйтесь к MTA discord по адресу https://discord.gg/mtasa и перейдите на канал #general, затем откройте прикрепленный пост этого канала о проблемах экосистемы оптимизации (автор Dutchman101).<br />
<br />
Пожалуйста, обратите внимание, что в общем случае ""любой сбой"" с кодом исключения ""0xE06D7363 "" (в модуле MTA, а не gta_sa.exe как и на этой вики-странице) также является проблемой, связанной с памятью, и возвращается к злоупотреблению памятью серверами и модами, описанными выше.<br />
<br />
==Устранение сбоев, связанных с пользовательскими моделями==<br />
Если у вас возникают сбои, которые, согласно таблице распространенных сбоев, связаны с поврежденными пользовательскими моделями, мы советуем вам переустановить GTA из исходного источника игры (DVD или Steam, поэтому никаких предварительно модифицированных репаков) или восстановить резервные копии целевых файлов, если вы понимаете, какая (тип) модель может вызвать сбой.<br />
<br />
В случае, если вы испытываете сбои только во время игры на определенном сервере, высока вероятность того, что сервер загружает пользовательские модели серверов, и тогда мы рекомендуем вам связаться с владельцем сервера, чтобы он мог изучить и потенциально идентифицировать и заменить поврежденную модель, чтобы остановить сбои. Пока они не предпримут успешных действий, на этом сервере вы можете попытаться избежать физического столкновения с модом, который, по вашему мнению, приведет к сбою (например, не создавать указанное транспортное средство или использовать указанный скин).<br />
Позвольте нам напомнить вам о возможности того, что плохая модель находится в вашем GTA3.img, но по совпадению вы никогда физически не приближаетесь к этой модели на других серверах, и сервер, на котором вы больше всего зависаете, вынуждает вас использовать этот идентификатор модели (например, как регулярно используемый автомобиль или скин); поэтому нельзя исключать, что это, возможно, все еще ваш клиентский мод, несмотря на то, что вы зависаете только на одном сервере, и стоит, по крайней мере, переустановить GTA, чтобы попробовать его.<br />
<br />
Если вы являетесь владельцем сервера и не хотели бы отказываться от своей любимой (поврежденной) модели, то вы можете попросить опытного моделиста попытаться исправить повреждение, изменив/изменив его.<br />
Альтернатива сбою многих игроков, потенциально приводящая к потере игроков на вашем сервере, в любом случае не подходит. По этой причине, внимательно следить за тенденциями игроков, сообщающих (или кричащих) о том, что они потерпели крушение, и следить за ними, чтобы получить подробную информацию о крушении (чтобы попытаться сопоставить их с моделями крушений из таблицы на этой вики-странице), может быть хорошей идеей.<br />
<br />
Добавление обновляемых компонентов (с именем "ug_upgradename") за пределами chassis_dummy приведет к сбоям, как только в транспортном средстве появится соответствующий компонент обновления.<br />
<br />
[[Famous crash offsets and their meaning]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=RU/Famous_crash_offsets_and_their_meaning&diff=71417RU/Famous crash offsets and their meaning2021-06-28T23:54:53Z<p>Alex7202: Created page with "<big>"та вики-страница содержит причины многих известных крашей MTA, с которыми вы можете столкнуть..."</p>
<hr />
<div><big>"та вики-страница содержит причины многих известных крашей MTA, с которыми вы можете столкнуться. Используйте CTRL + F чтобы найти соответствующую ошибку</big><br />
<br />
<br />
Пример краша МТА:<br />
<syntaxhighlight lang="xml"><br />
Version = 1.5.6-release-14664.0.000<br />
Time = Mon Oct 8 12:20:00 2018<br />
Module = C:\Program Files (x86)\Rockstar Games\GTA San Andreas\gta_sa.exe<br />
Code = 0xC0000005<br />
Offset = 0x003C91CC<br />
<br />
EAX=0F77A3C8 EBX=0F77A3B8 ECX=0177FAA0 EDX=00139700 ESI=00000000<br />
EDI=00000001 EBP=0177FC50 ESP=0177FA80 EIP=007C91CC FLG=00210202<br />
CS=0023 DS=002B SS=002B ES=002B FS=0053 GS=002B<br />
</syntaxhighlight><br />
<br />
(Памятка: всегда используйте значение "Offset" чтобы найти код вылета.)<br />
<br />
'''Большинство сбоев MTA вызваны чем-то, что пользователь может решить, потому что это зависит от его системы, выбора сервера или игровых модов.'''<br />
Эта страница стремится быть полезной по вышеупомянутой причине; вы будете знать, где искать, когда вы получите определенный тип сбоя.<br />
<br />
<br />
Для получения дополнительных советов по решению проблем прокрутите страницу вниз до нижней части этой страницы.<br />
<br />
<br/><br />
==Module = gta_sa.exe или proxy_sa.exe==<br />
{| class="wikitable"<br />
|-<br />
!Код ошибки<br />
!Причины<br />
|-<br />
|<syntaxhighlight lang="lua">0x00134134</syntaxhighlight><br />
|Плохая модель или поврежденный GTA3.img. Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Примечание для владельцев серверов и разработчиков моделей: если вы откроете аварийный дамп (.dmp) в виде текста с помощью блокнота и выполните поиск по ключевому слову "CEntity_GetBoundRect - Нет коллизии для модели", вы часто можете идентифицировать идентификатор плохой модели.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00348CF4</syntaxhighlight><br />
|Вызвано s0beit d3d9.dll<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003F0C37<br />
0x003F0BF7<br />
</syntaxhighlight><br />
|Плохая модель автомобиля. Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003C91CC<br />
0x003C920C<br />
</syntaxhighlight><br />
|Закончилась видеопамять. Это может произойти на серверах с неоптимизированными модами и (неисправными) сценариями, которые злоупотребляют видеопамятью, или даже когда у вас есть мощная видеокарта, если материал на сервере крайне неоптимизирован, так что он начинает выходить за пределы GTA. Если у вас мощная видеокарта и больше игроков страдают от этого типа сбоя, сообщите владельцу сервера об этой проблеме, так как это, вероятно, означает, что их сценаристы и дизайнеры не знают, что они делают. Более подробная информация доступна по этим ссылкам на форуме: [https://forum.mtasa.com/topic/85094-mta-crashing/ здесь] и [https://forum.mtasa.com/topic/127677-c-r-a-s-h-i-n-g/ здесь (примерный случай)]<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00357DEC</syntaxhighlight><br />
|Не хватает видеопамяти (вероятно).<br />
|-<br />
|<syntaxhighlight lang="lua">0x003F5A3A</syntaxhighlight><br />
|Сбой памяти, как правило, происходит на сильно неоптимизированных серверах. Это может быть результатом либо нехватки видеопамяти, либо достижения технических пределов использования оперативной памяти, но чаще всего это сочетание того и другого.. поэтому он обозначен как "сильно неоптимизированные серверы". Свяжитесь с владельцем сервера и попросите об оптимизации или найдите другие серверы для игры.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x004A1ED4</syntaxhighlight><br />
|Не хватает памяти (ОЗУ).<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x011630F8<br />
0x011630FE<br />
</syntaxhighlight><br />
|Этот сбой является результатом проблем с моделями столкновений. Это может быть связано с неоптимизированными столкновениями, которые ваш компьютер (или технические ограничения MTA, из-за плохих модов сервера) не может обработать, или из-за поврежденных моделей столкновений. Мы все еще многого не знаем обо всех обстоятельствах, связанных с этой катастрофой. Наш первый совет состоял бы в том, чтобы убедиться, что ваша GTA не модифицирована, и в противном случае попросить владельца сервера определить и устранить проблемы с плохими моделями столкновений.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00137D6E</syntaxhighlight><br />
|Отсутствует системная память (ОЗУ). Это совпадает с конфликтами при загрузке; риск получить этот сбой высок при подключении к серверу с большим количеством модулей со слабым ПК и небольшим объемом памяти.<br />
Чтобы устранить эту ошибку, обратите внимание на серверы, на которых вы играете (оптимизация), или приобретите более быстрый компьютер. Подтип "Нехватка памяти": чаще всего это прямой результат нехватки адресного пространства, поэтому обновление до 64-разрядной установки Windows может решить эту проблему.<br />
|-<br />
|<syntaxhighlight lang="lua">0x0014F406</syntaxhighlight><br />
|Возможно "Running out of memory": прямой результат нехватки адресного пространства, поэтому обновление до 64-разрядной установки Windows может решить эту проблему.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00171A10</syntaxhighlight><br />
|Иногда при подключении к серверу, возможно, это связано с плохими модами сервера.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x000C9F98</syntaxhighlight><br />
|Возможно, плохая модель или текстура (моды на одежду для нескольких скинов, таких как CJ).<br />
Используйте немодифицированную установку GTA для проверки или добавления серверных модов, попросите владельца сервера идентифицировать и отключить моды на таких скинах или любой ресурс, манипулирующий одеждой или доступом к педиатрии.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00349B7B</syntaxhighlight><br />
|Плохая модель скина. Используйте немодифицированную установку GTA, чтобы проверить или удалить серверные моды, попросите владельца сервера идентифицировать и заменить поврежденный скин-мод.<br />
Информация для моделистов и владельцев серверов: повреждение в иерархии аниме в конфигурации DDF кожи или костей peds<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00165096</syntaxhighlight><br />
|Плохая модель (содержащая поврежденную модель столкновения). Используйте немодифицированную установку GTA для проверки или удаления серверных модов, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Информация для разработчиков моделей и владельцев серверов: повреждение в одной или нескольких сферах col (или их радиусе) в модели DFF.<br />
|-<br />
|<syntaxhighlight lang="lua">0x001D6E6A</syntaxhighlight><br />
|Либо не хватает видеопамяти, либо плохая модель/текстура.<br />
Информация для моделистов и владельцев серверов: в случае, если виновником является модель, то повреждение находится в структуре модели "предварительно освещенной" (ночные цвета). Попросите своего моделиста воссоздать предварительные данные.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x000DFE92<br />
0x000DFF90<br />
</syntaxhighlight><br />
|Плохие звуковые моды или неисправный аудиодрайвер/устройство. Используйте немодифицированную установку GTA для проверки или обновления ваших аудиодрайверов.<br />
Часто известно, что проблема заключается в полном отсутствии или опустошении/повреждении аудиофайлов (например, в \Rockstar Games\GTA San Andreas\audio > SFX или другой подпапке), поэтому вы можете в качестве альтернативы восстановить целевую резервную копию.<br />
<br />
Не используйте "сжатые" репаки GTA по этой причине вырезанных аудиофайлов.<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x000CFCD6</syntaxhighlight><br />
|Сбой выделения ресурсов в результате (повторного)подключения к серверам после длительной игровой сессии на сервере с плохой практикой в их сценариях (злоупотребление оперативной памятью и функциями anim).<br />
Эта авария может быть "исправлена" (предотвращена) MTA в будущем, мы работаем над этим! Это связано с животными в памяти и их очисткой.|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x00771848<br />
</syntaxhighlight><br />
|Сбой из-за проблемы с файлами данных GTA (MTA не удается их открыть, что может означать, что они повреждены/изменены и несовместимы или отсутствуют)<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x001B6B2F<br />
</syntaxhighlight><br />
|Сбой из-за проблемы с DATA\DEFAULT.DAT или DATA\CARCOLS.DAT в папке установки GTA (может отсутствовать или быть изменен/поврежден).<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003EC9DA<br />
</syntaxhighlight><br />
|Сбой, возможно, из-за проблемы с ANIM\PED.IFP в папке установки GTA (может отсутствовать или изменен/поврежден).<br />
Используйте немодифицированную установку GTA для проверки<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003F18CF<br />
0x003F190F<br />
</syntaxhighlight><br />
|Плохая модель. Используйте немодифицированную установку GTA для проверки или, в случае модов сервера, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Этот сбой был предотвращен (исправлен MTA), но из-за технических ограничений все равно произойдет для пользователей Windows XP.<br/><br />
Информация для разработчиков моделей и владельцев серверов: из-за характера повреждения модель представляет риск сбоя, это может произойти в любой момент, находясь поблизости.<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x0019BD39<br />
</syntaxhighlight><br />
|Плохая модель. Используйте немодифицированную установку GTA для проверки или, в случае модов сервера, попросите владельца сервера идентифицировать и заменить поврежденный мод.<br />
Этот сбой обычно происходит, когда вы стреляете из оружия, в то время как поврежденная модель передается в потоковом режиме (физически поблизости).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x000C9691<br />
</syntaxhighlight><br />
|Плохая или отсутствующая модель автомобиля. Обычно это происходит, когда вы удалили модель со своего GTA3.img, не восстановив оригинал или не заменив его другой моделью. Или когда DFF вообще не является допустимым файлом модели. Восстановите GTA3.img или используйте немодифицированную установку GTA для проверки, и если это не сработает, попросите владельца сервера идентифицировать и заменить поврежденный мод, поскольку он также может быть плохой моделью (или хитрым сценарием, который, скажите им это: имеет дело с типами транспортных средств, вариантами, обновлениями и т. Д., Неправильным способом).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x0000F67C<br />
0x0000F663<br />
</syntaxhighlight><br />
|Пользовательские модели, которые не работают с объемными тенями. Исправьте модели или отключите объемные тени в Настройках->Видео.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00423FD0</syntaxhighlight><br />
|Плохие моды для GTA или поврежденный GTA3.img. Переустановите GTA (с чистой и оригинальной версией), чтобы решить эту проблему. Примечание: известен сбой для распространенных пиратских копий и торрентов GTA из-за отсутствия, плохих или поврежденных файлов .data,. col и .ipl (предустановленные моды). MTA поддерживает только оригинальную, законно приобретенную версию GTA.<br />
|-<br />
|<syntaxhighlight lang="lua">0x000A2CF3</syntaxhighlight><br />
|Поврежден, отсутствует или изменен файл GTA San Andreas\models > "'effects.fxp". Если восстановление этого файла в исходное состояние не исправит сбой, используйте немодифицированную GTA, так как это также может быть связано с соответствующими файлами данных GTA (теми, которые связаны с эффектами).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x001A49D4<br />
</syntaxhighlight><br />
|Плохой мод (пользовательский player.img в GTA San Andreas\модели). Восстановите файл player.img в исходное состояние или используйте немодифицированную GTA.<br />
Примечание.этот сбой также может быть вызван, когда на вашем экране на сервере, на котором вы играете, появляется игрок с моделью CJ (или одеждой CJ). Ваш пользовательский плеер.img не справится с этим и приведет к сбою.<br />
|}<br />
<br />
<br />
==Устранение сбоев из-за нехватки памяти==<br />
Если вы испытываете сбои, которые, согласно таблице распространенных сбоев, связаны с каким-либо недостатком памяти, мы советуем вам;<br />
<br />
- Обратите внимание на тип серверов, на которых вы играете, особенно в сочетании с мощностью вашего компьютера. В MTA есть много раздутых серверов с большим количеством модов, которые требуют лучшего от вашего компьютера, а также могут злоупотреблять памятью с помощью неэффективных сценариев, помимо пользовательских модов (или даже при их отсутствии).<br />
<br />
Мы могли бы написать книгу о реальной причине (которая заключается в том, что на таких серверах есть плохие скриптеры или те, которые не знают, что такое оптимизация, и что они добавляют все, включая раздутые модели и текстуры, не просматривая их), но мы не будем делать этого здесь.<br />
<br />
Если у вас медленный компьютер или компьютер более старшего поколения, мы советуем вам избегать определенных "модных" серверов с огромными загрузками ресурсов и тому подобным.<br />
<br />
- Установите 64-разрядную версию Windows, а не x86 (32-разрядную)<br />
<br />
<br />
"Если вы все еще хотите играть на серверах, которые могут легко взять верх над вашей системой, тогда;"'<br />
<br />
- Обновите аппаратное обеспечение вашего ПК для повышения производительности; рассмотрите возможность замены видеокарты на видеокарту, подходящую для игр, или добавления дополнительной системной памяти (ОЗУ). Переустановка Windows иногда также может помочь, если ваша ОС в целом работает медленно и не в хорошем состоянии. В качестве альтернативы выполните некоторые действия по обслуживанию (проконсультируйтесь с кем-нибудь с техническим опытом или начните с обновления драйверов и запуска различных очистителей мусора и известных инструментов оптимизации производительности ПК).<br />
<br />
- Следуйте инструкциям, перечисленным на [https://forum.mtasa.com/topic/78081-32-bit-windows-crashing/ https://forum.mtasa.com/topic/78081-32-bit-windows-crashing/]<br />
<br />
- Удалите все моды из вашей установки GTA (предпочтительно переустановите), потому что моды могут занимать видеопамять и оперативную память, достаточную для того, чтобы вызвать высокое использование памяти и последующие сбои.<br />
Кроме того, вам определенно следует попробовать уменьшить потоковую память, перейдя в Настройки->Дополнительно->Потоковая память-> и установив ее на минимальное значение.<br />
<br />
Помните, что GTA-старая игра, и MTA отдает много власти в руки сценаристов (чтобы испортить отсутствие оптимизации). Даже если у вас большой объем оперативной памяти (например, 8 ГБ, 16 ГБ), вы не можете ожидать, что все это будет использоваться.. старые игры имеют технические ограничения и ограниченное адресное пространство. Серверные сценаристы могут делать действительно классные и безумно реалистичные вещи, используя гораздо меньше 3,6 ГБ оперативной памяти (абсолютный технический предел в SA), но только до тех пор, пока у них есть сценаристы и модельеры/дизайнеры, которые знают об оптимизации. Строго взято, никакого сервера, каким бы модным или красивым он ни был.. должно потребоваться использовать более 2 ГБ оперативной памяти. Большинство приличных серверов в любом случае используют от 800 МБ до 1,6 ГБ. Если вы хотите узнать больше об этой теме или являетесь владельцем сервера, который хочет осознать свои ошибки, пожалуйста, присоединяйтесь к MTA discord по адресу https://discord.gg/mtasa и перейдите на канал #general, затем откройте прикрепленный пост этого канала о проблемах экосистемы оптимизации (автор Dutchman101).<br />
<br />
Пожалуйста, обратите внимание, что в общем случае ""любой сбой"" с кодом исключения ""0xE06D7363 "" (в модуле MTA, а не gta_sa.exe как и на этой вики-странице) также является проблемой, связанной с памятью, и возвращается к злоупотреблению памятью серверами и модами, описанными выше.<br />
<br />
==Устранение сбоев, связанных с пользовательскими моделями==<br />
Если у вас возникают сбои, которые, согласно таблице распространенных сбоев, связаны с поврежденными пользовательскими моделями, мы советуем вам переустановить GTA из исходного источника игры (DVD или Steam, поэтому никаких предварительно модифицированных репаков) или восстановить резервные копии целевых файлов, если вы понимаете, какая (тип) модель может вызвать сбой.<br />
<br />
В случае, если вы испытываете сбои только во время игры на определенном сервере, высока вероятность того, что сервер загружает пользовательские модели серверов, и тогда мы рекомендуем вам связаться с владельцем сервера, чтобы он мог изучить и потенциально идентифицировать и заменить поврежденную модель, чтобы остановить сбои. Пока они не предпримут успешных действий, на этом сервере вы можете попытаться избежать физического столкновения с модом, который, по вашему мнению, приведет к сбою (например, не создавать указанное транспортное средство или использовать указанный скин).<br />
Позвольте нам напомнить вам о возможности того, что плохая модель находится в вашем GTA3.img, но по совпадению вы никогда физически не приближаетесь к этой модели на других серверах, и сервер, на котором вы больше всего зависаете, вынуждает вас использовать этот идентификатор модели (например, как регулярно используемый автомобиль или скин); поэтому нельзя исключать, что это, возможно, все еще ваш клиентский мод, несмотря на то, что вы зависаете только на одном сервере, и стоит, по крайней мере, переустановить GTA, чтобы попробовать его.<br />
<br />
Если вы являетесь владельцем сервера и не хотели бы отказываться от своей любимой (поврежденной) модели, то вы можете попросить опытного моделиста попытаться исправить повреждение, изменив/изменив его.<br />
Альтернатива сбою многих игроков, потенциально приводящая к потере игроков на вашем сервере, в любом случае не подходит. По этой причине, внимательно следить за тенденциями игроков, сообщающих (или кричащих) о том, что они потерпели крушение, и следить за ними, чтобы получить подробную информацию о крушении (чтобы попытаться сопоставить их с моделями крушений из таблицы на этой вики-странице), может быть хорошей идеей.<br />
<br />
Добавление обновляемых компонентов (с именем "ug_upgradename") за пределами chassis_dummy приведет к сбоям, как только в транспортном средстве появится соответствующий компонент обновления.<br />
<br />
[[Famous crash offsets and their meaning]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Famous_crash_offsets_and_their_meaning&diff=71416Famous crash offsets and their meaning2021-06-28T23:53:54Z<p>Alex7202: add russian language</p>
<hr />
<div><big>This wiki page contains the reason for many well-known MTA crashes that you may experience. Use CTRL + F and search for your Crash Offset to find the relevant entry.</big><br />
<br />
<br />
Example crash dialog info:<br />
<syntaxhighlight lang="xml"><br />
Version = 1.5.6-release-14664.0.000<br />
Time = Mon Oct 8 12:20:00 2018<br />
Module = C:\Program Files (x86)\Rockstar Games\GTA San Andreas\gta_sa.exe<br />
Code = 0xC0000005<br />
Offset = 0x003C91CC<br />
<br />
EAX=0F77A3C8 EBX=0F77A3B8 ECX=0177FAA0 EDX=00139700 ESI=00000000<br />
EDI=00000001 EBP=0177FC50 ESP=0177FA80 EIP=007C91CC FLG=00210202<br />
CS=0023 DS=002B SS=002B ES=002B FS=0053 GS=002B<br />
</syntaxhighlight><br />
<br />
(Note: always use the "Offset" value from the crash dialog to identify your crash and match it up with those listed on this wiki page)<br />
<br />
'''Most MTA crashes are caused by something that the user is able to resolve because it depends on their system, choice of server or game mods.'''<br />
This page seeks to be helpful for the aforementioned reason; you'll know where to look for when you get a certain type of crash.<br />
<br />
<br />
For further advice on resolving issues, scroll down to the bottom of this page.<br />
<br />
<br/><br />
==Module = gta_sa.exe or proxy_sa.exe==<br />
{| class="wikitable"<br />
|-<br />
!Offset(s)<br />
!Meaning<br />
|-<br />
|<syntaxhighlight lang="lua">0x00134134</syntaxhighlight><br />
|Bad model or corrupted GTA3.img. Use unmodded GTA install to check, or incase of server mods, ask server owner to identify and replace the corrupt mod.<br />
Note for server owners and modellers: if you open the crash dump (.dmp) as text with notepad and search for keyword `CEntity_GetBoundRect - No collision for model` you can often identify the bad model ID.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00348CF4</syntaxhighlight><br />
|Caused by s0beit d3d9.dll<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003F0C37<br />
0x003F0BF7<br />
</syntaxhighlight><br />
|Bad vehicle model. Use unmodded GTA install to check, or incase of server mods, ask server owner to identify and replace the corrupt mod.<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003C91CC<br />
0x003C920C<br />
</syntaxhighlight><br />
|Out of video memory. This can happen on servers with unoptimized mods and (faulty) scripts that abuse video memory, or even when you have a powerful graphics card in case the stuff on a server is extremely unoptimized so that it starts hitting GTA limits. If you have a powerful graphics card and more players suffer from this crash type, inform the server owner of this problem as it probably means their scripters & designers don't know what they are doing. More information is available at these forum links: [https://forum.mtasa.com/topic/85094-mta-crashing/ here] and [https://forum.mtasa.com/topic/127677-c-r-a-s-h-i-n-g/ here (example case)]<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00357DEC</syntaxhighlight><br />
|Out of video memory (probably).<br />
|-<br />
|<syntaxhighlight lang="lua">0x003F5A3A</syntaxhighlight><br />
|Memory crash, usually happens on heavily unoptimized servers. It can be a result of either out of video memory or reaching technical limits of RAM usage, but more often a combination of both.. hence it's put as "heavily unoptimized servers". Contact the server owner and ask for optimization, or find other servers to play on.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x004A1ED4</syntaxhighlight><br />
|Out of system memory (RAM)<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x011630F8<br />
0x011630FE<br />
</syntaxhighlight><br />
|This crash is a result of problems with collision models. It might be due to unoptimized collisions that your PC (or MTA's technical limits, due to bad server mods) cannot handle, or due to corrupt collision models. We still don't know a lot about all of the circumstances related to this crash. Our first advise would be to ensure that your GTA is unmodded, and otherwise to ask server owner to identify and resolve issues with bad collision models.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00137D6E</syntaxhighlight><br />
|Out of system memory (RAM). This co-incides with loading collisions; the risk to get this crash is high when joining a mod-heavy server with a weak PC and small amount of memory.<br />
To resolve this crash, mind the servers you're playing on (optimization) or get a faster PC. Sub-type of "Running out of memory": most often a direct result of running out of address space, so upgrading to 64-bit Windows installation might solve it<br />
|-<br />
|<syntaxhighlight lang="lua">0x0014F406</syntaxhighlight><br />
|Possibly "Running out of memory": a direct result of running out of address space, so upgrading to 64-bit Windows installation might solve it.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00171A10</syntaxhighlight><br />
|Sometimes when joining a server, maybe related to bad server mods.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x000C9F98</syntaxhighlight><br />
|Possibly bad skin model or texture (clothes mods for multi-clump skins such as CJ). <br />
Use unmodded GTA install to check or incase of server mods, ask server owner to identify and disable mods on such skins, or any resource manipulating clothes or ped accesoires.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00349B7B</syntaxhighlight><br />
|Bad skin model. Use unmodded GTA install to check or incase of server mods, ask server owner to identify and replace the corrupt skin mod.<br />
Information for modellers & server owners: corruption in the anim hierarchy in ped's skin DFF or bones configuration<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x00165096</syntaxhighlight><br />
|Bad model (containing a corrupt collision model). Use unmodded GTA install to check or incase of server mods, ask server owner to identify and replace the corrupt mod.<br />
Information for modellers & server owners: corruption in one or multiple col spheres (or their radius) within the DFF model.<br />
|-<br />
|<syntaxhighlight lang="lua">0x001D6E6A</syntaxhighlight><br />
|Either out of video memory, or bad model/texture.<br />
Information for modellers & server owners: in case the culprit is a model, then corruption is in "prelit" (Night colors) structure of the model. Ask your modeller to recreate prelit data.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x000DFE92<br />
0x000DFF90<br />
</syntaxhighlight><br />
|Bad sound mods or faulty audio driver/device. Use unmodded GTA install to check, or update your audio drivers.<br />
The problem is often known to be entirely missing or emptied/corrupted audio files (such as in \Rockstar Games\GTA San Andreas\audio > SFX or other subfolder), so you may alternatively be able to restore a targetted backup.<br />
<br />
Do not use 'compressed' GTA re-packs for this reason of cut-out audio files.<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua">0x000CFCD6</syntaxhighlight><br />
|Allocation failure as a result of (re-)connecting to servers after a lengthy playing session on a server with bad practise in their scripts (abusing RAM and anim functions).<br />
This crash may be 'fixed' (averted) by MTA in future, we're working on it! It's related to anims in memory and clearing them.<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x00771848<br />
</syntaxhighlight><br />
|Crash because of issue with GTA data files (MTA fails to open them which could mean they are corrupted/modded & incompatible or missing)<br />
Use unmodded GTA install to check<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x001B6B2F<br />
</syntaxhighlight><br />
|Crash because of issue with DATA\DEFAULT.DAT or DATA\CARCOLS.DAT file in your GTA installation folder (may be missing or modded/corrupted).<br />
Use unmodded GTA install to check<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003EC9DA<br />
</syntaxhighlight><br />
|Crash possibly because of issue with ANIM\PED.IFP file in your GTA installation folder (may be missing or modded/corrupted).<br />
Use unmodded GTA install to check<br />
|-<br />
|-<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x003F18CF<br />
0x003F190F<br />
</syntaxhighlight><br />
|Bad model. Use unmodded GTA install to check or in case of server mods, ask server owner to identify and replace the corrupt mod.<br />
This crash has been averted (fixed by MTA), but due to technical limitations will still occur for Windows XP users.<br/><br />
Information for modellers & server owners: due to the nature of corruption, the model introduces a risk to crash, it could happen at any given moment while nearby.<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x0019BD39<br />
</syntaxhighlight><br />
|Bad model. Use unmodded GTA install to check or in case of server mods, ask server owner to identify and replace the corrupt mod.<br />
This crash usually occurs when you fire a weapon while the corrupt model is streamed in (physically nearby).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x000C9691<br />
</syntaxhighlight><br />
|Bad or missing vehicle model. This usually happens when you deleted a model from your GTA3.img without restoring the original or putting another model in its place. Or when the DFF isn't a valid model file at all.<br />
Restore GTA3.img or use unmodded GTA install to check, and if that doesn't work then ask server owner to identify and replace the corrupt mod, since it can also still be a bad model (or a dodgy script, that, tell them this: deals with vehicle types, variants, upgrades etc, in an improper way)<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x0000F67C<br />
0x0000F663<br />
</syntaxhighlight><br />
|Custom models which are not working with volumetric shadows. Fix models or disable volumetric shadows in Settings->Video.<br />
|-<br />
|<syntaxhighlight lang="lua">0x00423FD0</syntaxhighlight><br />
|Bad GTA mods or corrupted GTA3.img. Re-install GTA (with a clean and original version) to solve this crash. Note: known crash for common pirated copies & torrents of GTA, due to missing, bad or corrupted .dat, .col and .ipl files (pre-installed mods). MTA only supports the original, legally purchased version of GTA.<br />
|-<br />
|<syntaxhighlight lang="lua">0x000A2CF3</syntaxhighlight><br />
|Corrupted, missing or modded GTA San Andreas\models > '''effects.fxp''' file. If restoring that file to original doesn't fix the crash, use unmodded GTA as it can also be due to related GTA data files (ones that have to do with effects).<br />
|-<br />
|<syntaxhighlight lang="lua"><br />
0x001A49D4<br />
</syntaxhighlight><br />
|Bad mod (custom player.img in GTA San Andreas\models). Restore player.img to original or use unmodded GTA.<br />
Note: this crash can also be triggered when a player with CJ model (or CJ clothes) appears on your screen, on a server you're playing on. Your custom player.img cannot handle that and will cause a crash.<br />
|}<br />
<br />
<br />
==Resolving out-of-memory crashes==<br />
If you're experiencing crashes that, according to the table of common crashes, are related to any sort of running out of memory, then we advise you to;<br />
<br />
- Mind the type of servers you're playing on, especially in combination with how powerful your PC is. There's lots of bloated, mod-heavy servers out there in MTA that demand the better of your PC and may also abuse memory through inefficient scripts besides custom mods (or even with the lack thereof).<br />
<br />
We could write a book about the real cause (which is that such servers have bad scripters, or those that don't know what optimization is, and that they add everything, including bloated models and textures, without reviewing it) but we won't do that here.<br />
<br />
If you have a slow or older generation PC, then we advise you to avoid certain "fancy" servers with huge resource downloads and such.<br />
<br />
- Install 64-bits version of Windows rather than x86 (32-bit)<br />
<br />
<br />
'''If you still want to play on servers that may easily get upper hand on your system, then;'''<br />
<br />
- Upgrade your PC's hardware for enhanced performance; consider replacing the videocard with one suitable for gaming, or adding additional system memory (RAM). Re-installing Windows can sometimes also help a bunch if your OS in general is slow and not well-maintained. Alternatively, perform some mainentance (consult someone with tech experience, or make a start by updating drivers and running various junk cleaners & renowned PC performance optimization tools)<br />
<br />
- Follow the instructions listed at [https://forum.mtasa.com/topic/78081-32-bit-windows-crashing/ https://forum.mtasa.com/topic/78081-32-bit-windows-crashing/]<br />
<br />
- Remove any mods to your GTA installation (preferably re-install) because mods may take up video memory and RAM, enough to cause your high memory usage and subsequent crashes.<br />
Also you should definately try lowering streaming memory, by going into Settings->Advanced->Streaming memory-> and setting it to Min.<br />
<br />
Remember that GTA is an old game, and MTA places a lot of power in the hands of scripters (to mess up with a lack of optimization). Even if you have a high amount of RAM (for example 8gb, 16gb) you can't expect it to all be usable.. old games have technical limits and limited address space. Server scripters can do really cool and insanely realistic stuff while using far below 3.6GB RAM (the absolute technical limit in SA), but only as long they have scripters and modellers/designers that know about optimization. Strictly taken, no server, no matter how modded or beautiful.. should need to use above 2GB of RAM. Most decent servers use between 800MB - 1.6GB anyways. If you wish to learn more about this subject or are a server owner that wants to realize their mistakes, please join the MTA discord at https://discord.gg/mtasa and go to the #general channel, then open that channel's pinned post about optimization ecosystem problems (written by Dutchman101).<br />
<br />
Please note that in general, '''any crash''' with exception code '''0xE06D7363''' (on an MTA module, and not gta_sa.exe like this wiki page is focussed on) is also a memory-related issue, and comes back to the memory abuse by servers and mods described above.<br />
<br />
==Resolving crashes related to custom models==<br />
If you're experiencing crashes that, according to the table of common crashes, are related to corrupt custom models, then we advise you to re-install GTA from the original game source (DVD or Steam, so no pre-modded repacks) or restore targetted file back-ups in case you understand which (type of) model may cause the crash. <br />
<br />
In case you're only experiencing the crashes while playing on a certain server, there's a high chance that server is loading custom server models, and then we recommend you to contact the server owner so they can investigate and potentially identify & replace the corrupted model to stop the crashes. Until they take successful action, on that server you can try to avoid physically facing the mod you believe results in a crash (like not spawning said vehicle or using said skin). <br />
Let us remind you of the chance that the bad model is in your GTA3.img, but by coincidence you never physically come near that model on other servers, and the server you're crashing the most on happens to force usage of that model ID upon you (like as regularly used vehicle or skin); therefore it cannot be ruled out that it's possibly still your client mod, despite you only crashing on a single server, and it's worth at least re-installing your GTA to try it out.<br />
<br />
If you are a server owner and wouldn't prefer letting go of your beloved (corrupt) model, then you can ask an experienced modeller to try fix the corruption by modifying/revising it.<br />
The alternative of crashing many players, potentially resulting in player loss for your server, isn't fine either way. For this reason, keeping a sharp eye on trends of players reporting (or shouting) that they crashed, and following up with them to get the crash details (to try match them up to model crashes from the table on this wiki page), may be a good idea.<br />
<br />
Adding upgradable components (named "ug_upgradename") outside of chassis_dummy, will cause crashes once the vehicle has the respective upgrade component spawned.<br />
<br />
[[ru:Famous crash offsets and their meaning]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=IsVehicleDoubleExhaust&diff=71128IsVehicleDoubleExhaust2021-05-29T06:05:51Z<p>Alex7202: Created page with "{{Useful Function}} <lowercasetitle></lowercasetitle> __NOTOC__ This function checks if a exhaust vehicle is double. ==Syntax== <syntaxhighlight lang="lua">bool isVehicle..."</p>
<hr />
<div>{{Useful Function}}<br />
<lowercasetitle></lowercasetitle><br />
__NOTOC__<br />
This function checks if a exhaust [[vehicle]] is double.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">bool isVehicleDoubleExhaust( element vehicle )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''vehicle''': The [[vehicle]] you want to check.<br />
<br />
===Returns===<br />
Returns ''true'' if the vehicle has double exhaust, ''false'' if not double exhaust.<br />
<br />
==Code==<br />
<section name="Function source" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
local bytes = {["2"] = true, ["6"] = true, ["A"] = true, ["E"] = true}<br />
function isDoubleExhauts (veh)<br />
local handling = getVehicleHandling (veh)["modelFlags"]<br />
local newHandling = string.format ("%X", handling)<br />
local reversedHex = string.reverse ( newHandling )..string.rep ( "0", 8 - string.len ( newHandling ) )<br />
<br />
local byte4 = string.sub(reversedHex, 4, 4)<br />
if bytes[byte4] then<br />
return true<br />
else<br />
return false<br />
end<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=71127Template:Useful Functions2021-05-29T06:00:53Z<p>Alex7202: /* Vehicle 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.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 />
*[[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 />
<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 />
*[[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 />
=== 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>Alex7202https://wiki.multitheftauto.com/index.php?title=FormatNumber&diff=69768FormatNumber2021-04-09T19:32:03Z<p>Alex7202: </p>
<hr />
<div>{{Useful Function}} __NOTOC__<br />
This function formats large numbers by adding commas to it. For example, 100000 becomes 100.000<br><br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">string formatNumber( int/string number, [ string sep = "." ] )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''number''': The number to be converted.<br />
<br />
===Optional Arguments===<br />
* '''sep''': A string of the character you want to split<br />
<br />
===Returns===<br />
Returns a string containing the converted number.<br />
<br />
==Code==<br />
<section name="Example 1: Shared" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function formatNumber(number, sep)<br />
assert(type(tonumber(number))=="number", "Bad argument @'formatNumber' [Expected number at argument 1 got "..type(number).."]")<br />
assert(not sep or type(sep)=="string", "Bad argument @'formatNumber' [Expected string at argument 2 got "..type(sep).."]")<br />
local money = number<br />
for i = 1, tostring(money):len()/3 do<br />
money = string.gsub(money, "^(-?%d+)(%d%d%d)", "%1"..sep.."%2")<br />
end<br />
return money<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Example 2: Shared" class="both" show="true"><br />
This example uses double string reverse & patterns to paste separator<br />
<syntaxhighlight lang="lua"><br />
function formatNumber(number, sep)<br />
assert(type(tonumber(number))=="number", "Bad argument @'formatNumber' [Expected number at argument 1 got "..type(number).."]")<br />
assert(not sep or type(sep)=="string", "Bad argument @'formatNumber' [Expected string at argument 2 got "..type(sep).."]")<br />
return tostring(number):reverse():gsub("%d%d%d","%1%"..(sep and #sep>0 and sep or ".")):reverse()<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
==Example==<br />
<br />
<section name="Client" class="client" show="true"><br />
This example converts a player's money, and outputs it to the chatbox when they type 'money' into the console:<br />
<syntaxhighlight lang="lua"><br />
function convertPlayerMoney()<br />
local pMoney = getPlayerMoney()<br />
local convertedMoney = formatNumber(pMoney)<br />
outputChatBox(convertedMoney)<br />
end<br />
addCommandHandler("money", convertPlayerMoney)<br />
</syntaxhighlight><br />
<br />
</section><br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=67971Template:Useful Functions2020-12-10T14:31:35Z<p>Alex7202: /* Math 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.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 />
<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 />
<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 />
*[[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 />
*[[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 />
*[[getRealMonthH]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function convert english months to arabic months</span><br />
*[[getRealMonthM]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function gives you the real months 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 />
*[[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 />
<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 />
*[[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 />
<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 />
<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 />
*[[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 />
<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 />
*[[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 />
*[[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 />
*[[getPreviousAndNextWeapon]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the next weapon and previous.</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 />
=== 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>Alex7202https://wiki.multitheftauto.com/index.php?title=Math.lerp&diff=67970Math.lerp2020-12-10T14:30:29Z<p>Alex7202: </p>
<hr />
<div>{{Useful Function}}<br />
==Syntax==<br />
<syntaxhighlight lang="lua">int math.lerp(int from, int to, int val)</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''val''': The number from 0 to 1<br />
<br />
===Returns===<br />
Returns a number if everything went good, ''to'' otherwise.<br />
<br />
==Code==<br />
<syntaxhighlight lang="lua"><br />
function math.lerp(a, b, k)<br />
local result = a * (1-k) + b * k<br />
if result >= b then<br />
result = b<br />
elseif result <= a then<br />
result = a<br />
end<br />
return result<br />
end<br />
</syntaxhighlight><br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
math.lerp(100, 250, 0.5)<br />
-- Returns: 175<br />
</syntaxhighlight><br />
<br />
<br />
Author: Alex7202<br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Math.lerp&diff=67969Math.lerp2020-12-10T14:30:04Z<p>Alex7202: Created page with "{{Useful Function}} __NOTOC__ ==Syntax== <syntaxhighlight lang="lua">int math.lerp(int from, int to, int val)</syntaxhighlight> ===Required Arguments=== * '''val''': The num..."</p>
<hr />
<div>{{Useful Function}}<br />
__NOTOC__<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">int math.lerp(int from, int to, int val)</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''val''': The number from 0 to 1<br />
<br />
===Returns===<br />
Returns a number if everything went good, ''to'' otherwise.<br />
<br />
==Code==<br />
<syntaxhighlight lang="lua"><br />
function math.lerp(a, b, k)<br />
local result = a * (1-k) + b * k<br />
if result >= b then<br />
result = b<br />
elseif result <= a then<br />
result = a<br />
end<br />
return result<br />
end<br />
</syntaxhighlight><br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
math.lerp(100, 250, 0.5)<br />
-- Returns: 175<br />
</syntaxhighlight><br />
<br />
<br />
Author: Alex7202<br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=FormatNumber&diff=67749FormatNumber2020-11-17T15:06:14Z<p>Alex7202: /* Code by Alex7202 */</p>
<hr />
<div>{{Useful Function}} __NOTOC__<br />
This function formats large numbers by adding commas to it. For example, 100000 becomes 100.000<br><br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">string formatNumber( int/string number, [ string sep = "." ] )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''number''': The number to be converted.<br />
<br />
===Optional Arguments===<br />
* '''sep''': A string of the character you want to split<br />
<br />
===Returns===<br />
Returns a string containing the converted number.<br />
<br />
==Code by Alex7202==<br />
Made by Alex7202. <br />
<syntaxhighlight lang="lua"><br />
function formatNumber(number, sep)<br />
assert(type(tonumber(number))=="number", "Bad argument @'formatNumber' [Expected number at argument 1 got "..type(number).."]")<br />
assert(not sep or type(sep)=="string", "Bad argument @'formatNumber' [Expected string at argument 2 got "..type(sep).."]")<br />
local money = number<br />
for i = 1, tostring(money):len()/3 do<br />
money = string.gsub(money, "^(-?%d+)(%d%d%d)", "%1"..sep.."%2")<br />
end<br />
return money<br />
end<br />
</syntaxhighlight><br />
<br />
==Code==<br />
Made by JeViCo. Uses double string reverse & patterns to paste separator<br />
<syntaxhighlight lang="lua"><br />
function formatNumber(number, sep)<br />
assert(type(tonumber(number))=="number", "Bad argument @'formatNumber' [Expected number at argument 1 got "..type(number).."]")<br />
assert(not sep or type(sep)=="string", "Bad argument @'formatNumber' [Expected string at argument 2 got "..type(sep).."]")<br />
return tostring(number):reverse():gsub("%d%d%d","%1%"..(sep and #sep>0 and sep or ".")):reverse()<br />
end<br />
</syntaxhighlight><br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This example converts a player's money, and outputs it to the chatbox when they type 'money' into the console:<br />
<syntaxhighlight lang="lua"><br />
function convertPlayerMoney()<br />
local pMoney = getPlayerMoney()<br />
local convertedMoney = formatNumber(pMoney)<br />
outputChatBox(convertedMoney)<br />
end<br />
addCommandHandler("money", convertPlayerMoney)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=FormatNumber&diff=67257FormatNumber2020-08-18T12:39:55Z<p>Alex7202: /* Code by Alex7202 */</p>
<hr />
<div>{{Useful Function}} __NOTOC__<br />
This function formats large numbers by adding commas to it. For example, 100000 becomes 100.000<br><br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">string formatNumber( int/string number, [ string sep = "." ] )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''number''': The number to be converted.<br />
<br />
===Optional Arguments===<br />
* '''sep''': A string of the character you want to split<br />
<br />
===Returns===<br />
Returns a string containing the converted number.<br />
<br />
==Code by Alex7202==<br />
Made by Alex7202. Uses double string reverse & patterns to paste separator<br />
<syntaxhighlight lang="lua"><br />
function formatNumber(number, sep)<br />
assert(type(tonumber(number))=="number", "Bad argument @'formatNumber' [Expected number at argument 1 got "..type(number).."]")<br />
assert(not sep or type(sep)=="string", "Bad argument @'formatNumber' [Expected string at argument 2 got "..type(sep).."]")<br />
local money = number<br />
for i = 1, tostring(money):len()/3 do<br />
money = string.gsub(money, "^(-?%d+)(%d%d%d)", "%1"..sep.."%2")<br />
end<br />
return money<br />
end<br />
</syntaxhighlight><br />
<br />
==Code==<br />
Made by JeViCo. Uses double string reverse & patterns to paste separator<br />
<syntaxhighlight lang="lua"><br />
function formatNumber(number, sep)<br />
assert(type(tonumber(number))=="number", "Bad argument @'formatNumber' [Expected number at argument 1 got "..type(number).."]")<br />
assert(not sep or type(sep)=="string", "Bad argument @'formatNumber' [Expected string at argument 2 got "..type(sep).."]")<br />
return tostring(number):reverse():gsub("%d%d%d","%1%"..(sep and #sep>0 and sep or ".")):reverse()<br />
end<br />
</syntaxhighlight><br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This example converts a player's money, and outputs it to the chatbox when they type 'money' into the console:<br />
<syntaxhighlight lang="lua"><br />
function convertPlayerMoney()<br />
local pMoney = getPlayerMoney()<br />
local convertedMoney = formatNumber(pMoney)<br />
outputChatBox(convertedMoney)<br />
end<br />
addCommandHandler("money", convertPlayerMoney)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=FormatNumber&diff=67256FormatNumber2020-08-18T12:39:00Z<p>Alex7202: </p>
<hr />
<div>{{Useful Function}} __NOTOC__<br />
This function formats large numbers by adding commas to it. For example, 100000 becomes 100.000<br><br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">string formatNumber( int/string number, [ string sep = "." ] )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''number''': The number to be converted.<br />
<br />
===Optional Arguments===<br />
* '''sep''': A string of the character you want to split<br />
<br />
===Returns===<br />
Returns a string containing the converted number.<br />
<br />
==Code by Alex7202==<br />
Made by Alex7202. Uses double string reverse & patterns to paste separator<br />
<syntaxhighlight lang="lua"><br />
function formatNumber(number, sep)<br />
assert(type(tonumber(number))=="number", "Bad argument @'formatNumber' [Expected number at argument 1 got "..type(number).."]")<br />
assert(not sep or type(sep)=="string", "Bad argument @'formatNumber' [Expected string at argument 2 got "..type(sep).."]")<br />
local money = number<br />
for i = 1, tostring(money):len()/3 do<br />
money = string.gsub(money, "^(-?%d+)(%d%d%d)", "%1.%2")<br />
end<br />
return money<br />
end<br />
</syntaxhighlight><br />
<br />
==Code==<br />
Made by JeViCo. Uses double string reverse & patterns to paste separator<br />
<syntaxhighlight lang="lua"><br />
function formatNumber(number, sep)<br />
assert(type(tonumber(number))=="number", "Bad argument @'formatNumber' [Expected number at argument 1 got "..type(number).."]")<br />
assert(not sep or type(sep)=="string", "Bad argument @'formatNumber' [Expected string at argument 2 got "..type(sep).."]")<br />
return tostring(number):reverse():gsub("%d%d%d","%1%"..(sep and #sep>0 and sep or ".")):reverse()<br />
end<br />
</syntaxhighlight><br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This example converts a player's money, and outputs it to the chatbox when they type 'money' into the console:<br />
<syntaxhighlight lang="lua"><br />
function convertPlayerMoney()<br />
local pMoney = getPlayerMoney()<br />
local convertedMoney = formatNumber(pMoney)<br />
outputChatBox(convertedMoney)<br />
end<br />
addCommandHandler("money", convertPlayerMoney)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>Alex7202https://wiki.multitheftauto.com/index.php?title=RU/getFreeDimension&diff=66938RU/getFreeDimension2020-06-16T10:14:01Z<p>Alex7202: </p>
<hr />
<div>{{Useful Function}}<br />
<lowercasetitle></lowercasetitle><br />
__NOTOC__<br />
Эта функция получает свободное измерение.<br />
<br />
==Синтаксис==<br />
<syntaxhighlight lang="lua">int getFreeDimension()</syntaxhighlight><br />
<br />
===Возврат===<br />
Вернет номер свободного измерения<br />
<br />
==Код==<br />
{{RequiredFunctions|getElementsInDimension}}<br />
<section name="Код" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function getFreeDimension ()<br />
local freeDim = nil<br />
for dim = 1, 60000 do<br />
if #getElementsInDimension ("player", dim) == 0 then<br />
freeDim = dim<br />
break<br />
end<br />
end<br />
return freeDim<br />
end<br />
<br />
function getElementsInDimension(theType,dimension)<br />
local elementsInDimension = { }<br />
for key, value in ipairs(getElementsByType(theType)) do<br />
if getElementDimension(value)==dimension then<br />
table.insert(elementsInDimension,value)<br />
end<br />
end<br />
return elementsInDimension<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
Автор: Alex7202<br />
<br />
==Смотрите также==<br />
{{RU/Useful_Functions}}<br />
<br />
[[EN:getFreeDimension]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=RU/getFreeDimension&diff=66937RU/getFreeDimension2020-06-16T10:13:31Z<p>Alex7202: Created page with "{{Useful Function}} <lowercasetitle></lowercasetitle> __NOTOC__ Эта функция получает свободное измерение. ==Синтаксис== <syntaxhi..."</p>
<hr />
<div>{{Useful Function}}<br />
<lowercasetitle></lowercasetitle><br />
__NOTOC__<br />
Эта функция получает свободное измерение.<br />
<br />
==Синтаксис==<br />
<syntaxhighlight lang="lua">int getFreeDimension()</syntaxhighlight><br />
<br />
===Возврат===<br />
Вернет номер свободного измерения<br />
<br />
==Код==<br />
{{RequiredFunctions|getElementsInDimension}}<br />
<section name="Код" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function getFreeDimension ()<br />
local freeDim = nil<br />
for dim = 1, 60000 do<br />
if #getElementsInDimension ("player", dim) == 0 then<br />
freeDim = dim<br />
break<br />
end<br />
end<br />
return freeDim<br />
end<br />
<br />
function getElementsInDimension(theType,dimension)<br />
local elementsInDimension = { }<br />
for key, value in ipairs(getElementsByType(theType)) do<br />
if getElementDimension(value)==dimension then<br />
table.insert(elementsInDimension,value)<br />
end<br />
end<br />
return elementsInDimension<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
Автор: Alex7202<br />
<br />
==Смотрите также==<br />
{{Useful_Functions}}<br />
<br />
[[EN:getFreeDimension]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=GetFreeDimension&diff=66936GetFreeDimension2020-06-16T10:11:51Z<p>Alex7202: </p>
<hr />
<div>{{Useful Function}}<br />
<lowercasetitle></lowercasetitle><br />
__NOTOC__<br />
This function get free dimension.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">int getFreeDimension()</syntaxhighlight><br />
<br />
===Returns===<br />
Returns a number of free dimension<br />
<br />
==Code==<br />
{{RequiredFunctions|getElementsInDimension}}<br />
<section name="Function source" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function getFreeDimension ()<br />
local freeDim = nil<br />
for dim = 1, 60000 do<br />
if #getElementsInDimension ("player", dim) == 0 then<br />
freeDim = dim<br />
break<br />
end<br />
end<br />
return freeDim<br />
end<br />
<br />
function getElementsInDimension(theType,dimension)<br />
local elementsInDimension = { }<br />
for key, value in ipairs(getElementsByType(theType)) do<br />
if getElementDimension(value)==dimension then<br />
table.insert(elementsInDimension,value)<br />
end<br />
end<br />
return elementsInDimension<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
Author: Alex7202<br />
<br />
==See Also==<br />
{{Useful_Functions}}<br />
<br />
[[RU:getFreeDimension]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=GetFreeDimension&diff=66935GetFreeDimension2020-06-16T10:11:28Z<p>Alex7202: </p>
<hr />
<div>{{Useful Function}}<br />
<lowercasetitle></lowercasetitle><br />
__NOTOC__<br />
This function get free dimension.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">int getFreeDimension()</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''tbl''': The table for sort1.<br />
<br />
===Returns===<br />
Returns a new sort table with only userdata content.<br />
<br />
==Code==<br />
{{RequiredFunctions|getElementsInDimension}}<br />
<section name="Function source" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function getFreeDimension ()<br />
local freeDim = nil<br />
for dim = 1, 60000 do<br />
if #getElementsInDimension ("player", dim) == 0 then<br />
freeDim = dim<br />
break<br />
end<br />
end<br />
return freeDim<br />
end<br />
<br />
function getElementsInDimension(theType,dimension)<br />
local elementsInDimension = { }<br />
for key, value in ipairs(getElementsByType(theType)) do<br />
if getElementDimension(value)==dimension then<br />
table.insert(elementsInDimension,value)<br />
end<br />
end<br />
return elementsInDimension<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
Author: Alex7202<br />
<br />
==See Also==<br />
{{Useful_Functions}}<br />
<br />
[[RU:getFreeDimension]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=GetFreeDimension&diff=66934GetFreeDimension2020-06-16T10:11:17Z<p>Alex7202: Created page with "{{Useful Function}} <lowercasetitle></lowercasetitle> __NOTOC__ This function get free dimension. ==Syntax== <syntaxhighlight lang="lua">int getFreeDimension()</syntaxhighlig..."</p>
<hr />
<div>{{Useful Function}}<br />
<lowercasetitle></lowercasetitle><br />
__NOTOC__<br />
This function get free dimension.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">int getFreeDimension()</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''tbl''': The table for sort1.<br />
<br />
===Returns===<br />
Returns a new sort table with only userdata content.<br />
<br />
==Code==<br />
{{RequiredFunctions|getElementSpeed}}<br />
<section name="Function source" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function getFreeDimension ()<br />
local freeDim = nil<br />
for dim = 1, 60000 do<br />
if #getElementsInDimension ("player", dim) == 0 then<br />
freeDim = dim<br />
break<br />
end<br />
end<br />
return freeDim<br />
end<br />
<br />
function getElementsInDimension(theType,dimension)<br />
local elementsInDimension = { }<br />
for key, value in ipairs(getElementsByType(theType)) do<br />
if getElementDimension(value)==dimension then<br />
table.insert(elementsInDimension,value)<br />
end<br />
end<br />
return elementsInDimension<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
Author: Alex7202<br />
<br />
==See Also==<br />
{{Useful_Functions}}<br />
<br />
[[RU:getFreeDimension]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=66933Template:Useful Functions2020-06-16T10:07:32Z<p>Alex7202: /* Data 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.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 />
<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 />
<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 />
<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 />
=== Elements 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 />
*[[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 />
<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 />
*[[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 />
*[[getRealMonthH]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function convert english months to arabic months</span><br />
*[[getRealMonthM]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function gives you the real months 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 />
*[[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 />
<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 />
=====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 />
*[[guiComboBoxAddPlayersName]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function is add players name in combobox .</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 />
<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 />
<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 />
*[[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 />
<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 />
<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 />
*[[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 />
*[[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 />
*[[getPreviousAndNextWeapon]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the next weapon and previous.</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 />
=== 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 />
*[[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>Alex7202https://wiki.multitheftauto.com/index.php?title=GuiEditSetMaxLength&diff=66797GuiEditSetMaxLength2020-06-03T11:00:19Z<p>Alex7202: </p>
<hr />
<div>__NOTOC__ <br />
{{Client function}}<br />
This function sets the maximum text length that can be typed into an edit box.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool guiEditSetMaxLength ( element guiEdit, int length )<br />
</syntaxhighlight><br />
{{OOP||[[Element/GUI/Edit_field|GuiEdit]]:setMaxLength|maxLength|guiEditGetMaxLength}}<br />
<br />
===Required Arguments=== <br />
<br />
*'''theElement:''' The edit box to be changed.<br />
*'''length:''' An integer indicating the maximum number of characters that can be typed into the box.<br />
<br />
===Returns===<br />
Returns ''true'' if the max length was set successfully, ''false'' otherwise.<br />
<br />
==Example== <br />
This example creates an edit box with a limit on text length, alongside an "Output!" button. When the button is clicked, it will output the message in the edit box into the Chat Box.<br />
<syntaxhighlight lang="lua"><br />
-- create our button<br />
button = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true )<br />
-- create an edit box and define it as "editBox".<br />
editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "Type your message here!", true )<br />
-- set a maximum text length of 128 characters<br />
guiEditSetMaxLength ( editBox, 128 )<br />
<br />
-- setup our function to output the message to the chatbox<br />
function outputEditBox ()<br />
local text = guiGetText ( editBox ) -- get the text from the edit box<br />
outputChatBox ( text ) -- output that text<br />
end<br />
addEventHandler ( "onClientGUIClick", button, outputEditBox )<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{GUI_functions}}<br />
{{GUI_events}}<br />
[[RU:guiEditSetMaxLength]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=RU/guiEditSetMaxLength&diff=66796RU/guiEditSetMaxLength2020-06-03T11:00:07Z<p>Alex7202: Created page with "__NOTOC__ {{RU/Client function}} Эта функция устанавливает максильно-допустимое количество символов которое..."</p>
<hr />
<div>__NOTOC__ <br />
{{RU/Client function}}<br />
Эта функция устанавливает максильно-допустимое количество символов которое можно ввести в Редактируемые поля<br />
<br />
==Синтаксис== <br />
<syntaxhighlight lang="lua"><br />
bool guiEditSetMaxLength ( element guiEdit, int length )<br />
</syntaxhighlight><br />
{{OOP||[[Element/GUI/Edit_field|GuiEdit]]:setMaxLength|maxLength|guiEditGetMaxLength}}<br />
<br />
===Обязательные аргументы=== <br />
<br />
*'''theElement:''' Поле которое будет изменяться.<br />
*'''length:''' Максимальное число символов.<br />
<br />
===Возвращает===<br />
Возвращает ''true'' если кол-во символов ограничилось, ''false'' если ошибка.<br />
<br />
==Пример== <br />
Этот пример создает редактируемое поле с лимитом символов. Когда вы нажмете на кнопку "Вывести!", в чат выведет сообщение которое вы набрали в редактируемом поле. <br />
<syntaxhighlight lang="lua"><br />
-- создаем кнопку<br />
button = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true )<br />
-- создадим редактируемое поле и назовем его "editBox".<br />
editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "Type your message here!", true )<br />
-- установим длину символов в 128 единиц<br />
guiEditSetMaxLength ( editBox, 128 )<br />
<br />
function outputEditBox ()<br />
local text = guiGetText ( editBox ) -- получаем текст из нашего editBox<br />
outputChatBox ( text ) -- выводим в чат этот текст<br />
end<br />
addEventHandler ( "onClientGUIClick", button, outputEditBox )<br />
</syntaxhighlight><br />
<br />
==Смотрите также==<br />
{{RU/GUI_functions}}<br />
<br />
[[EN:guiEditSetMaxLength]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=AR/%D9%88%D8%B8%D8%A7%D8%A6%D9%81_%D9%85%D9%81%D9%8A%D8%AF%D8%A9&diff=66795AR/وظائف مفيدة2020-06-03T10:47:00Z<p>Alex7202: </p>
<hr />
<div><pageclass class="#228B22"></pageclass><br />
{{MessageBox|<br />
bordercolorhex = 000000 |<br />
bordertype = dotted |<br />
bgcolorhex = EFEFEF |<br />
image = File:Package-x-generic.png |<br />
title = لا تنسى أن تتفقد الـ[[Useful Classes]] |<br />
subtext = <span style="font-size: 85%;">''هذه الصفحة تضم الـ classes التي تم عملها بواسطة الأعضاء والتي لم توجد في الأصل في أوامر مالتي ذفت أوتو ''</span> |<br />
}}<br />
{{Adding_Pages_to_Categories_and_Templates}}<br />
<br />
هذه الصفحة تضم الوظائف من صنع الأعضاء والتي لم تكن موجودة في الأصل في مالتي ذفت أوتو. والتي هدفها تقديم بعض الوظائف المفيدة بشكل أسرع للمبرمجين، لذا لن يضطروا إلى تضييع أوقاتهم في برمجتها من الصفر عند الحاجة لها .<br />
<br />
تمت الترجمة بواسطة : ''' A7MeDx666 '''<br />
<br />
__TOC__<br />
<br />
{{Useful_Functions}}<br />
<br />
[[HU:Useful Functions]]<br />
[[ES:Funciones Útiles]]<br />
[[ru:Полезные функции]]<br />
[[de:Nützliche_Funktionen]]<br />
[[PL:Użyteczne Funkcje]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=PL/U%C5%BCyteczne_Funkcje&diff=66794PL/Użyteczne Funkcje2020-06-03T10:46:55Z<p>Alex7202: </p>
<hr />
<div><pageclass class="#228B22"></pageclass><br />
{{MessageBox|<br />
bordercolorhex = 000000 |<br />
bordertype = dotted |<br />
bgcolorhex = EFEFEF |<br />
image = File:Package-x-generic.png |<br />
title = Nie zapomnij, aby zerknąć na [[Useful Classes]] |<br />
subtext = <span style="font-size: 85%;">''Na tej stronie znajdziesz użyteczne klasy zrobione przez użytkowników, które nie są zawarte w czystym MTA ''</span> |<br />
}}<br />
{{Adding_Pages_to_Categories_and_Templates}}<br />
<br />
Na tej stronie znajdziesz listę użytecznych funkcji stworzonych przez użytkowników które nie są zawarte w domyślnym MTA. Jej celem jest dostarczenie użytecznych funkcji które mogą Ci się przydać podczas skryptowania, dzięki czemu nie musisz pisać ich od nowa.<br />
<br />
<br />
{{PL/Użyteczne_funkcje}}<br />
<br />
[[ES:Funciones Útiles]]<br />
[[ru:Useful Functions]]<br />
[[de:Nützliche_Funktionen]]<br />
[[Ar:وظائف مفيدة]]<br />
[[ru:Полезные функции]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=DE/N%C3%BCtzliche_Funktionen&diff=66793DE/Nützliche Funktionen2020-06-03T10:46:45Z<p>Alex7202: </p>
<hr />
<div><pageclass class="#228B22"></pageclass><br />
<br />
Diese Seite listet Funktionen auf die nicht im Client oder Server enthalten sind aber trotzdem nützlich sind.<br />
<br/><br/><br />
{{Template:DE/Nützliche Funktionen}}<br />
<br/><br/><br />
[[en:Useful Functions]]<br />
[[ru:Полезные функции]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=ES/Funciones_%C3%9Atiles&diff=66792ES/Funciones Útiles2020-06-03T10:46:34Z<p>Alex7202: </p>
<hr />
<div><pageclass class="#228B22"></pageclass><br />
<br />
Esta pagina contiene una lista de las functiones que no están incluidas como de servidor or de client, pero siguen siendo útiles.<br />
<br/><br/><br />
{{Funciones Útiles}}<br />
<br/><br/><br />
[[en:Useful Functions]]<br />
[[ru:Полезные функции]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=HU/Useful_Functions&diff=66791HU/Useful Functions2020-06-03T10:46:16Z<p>Alex7202: </p>
<hr />
<div><pageclass class="#228B22"></pageclass><br />
{{MessageBox|<br />
bordercolorhex = 000000 |<br />
bordertype = dotted |<br />
bgcolorhex = EFEFEF |<br />
image = File:Package-x-generic.png |<br />
title = Don't forget to check out the [[Useful Classes]] |<br />
subtext = <span style="font-size: 85%;">''That page lists user-made classes that are not included by default in MTA. ''</span> |<br />
}}<br />
{{Adding_Pages_to_Categories_and_Templates hu}}<br />
<br />
Ez az oldal olyan felhasználók által készített Lua funkciókat tartalmaz, melyek alapértelmezetten nem szerepelnek az MTA-ban. Célja, hogy néhány hasznos funkciót nyújtson a szkriptereknek, így szükség esetén nem kell nekik azzal vesztegetni az idejüket, hogy megcsinálják.<br />
__TOC__<br />
<br />
{{Useful_Functions hu}}<br />
<br />
[[en:Useful Functions]]<br />
[[ES:Funciones Útiles]]<br />
[[ru:Полезные функции]]<br />
[[de:Nützliche_Funktionen]]<br />
[[PL:Użyteczne Funkcje]]<br />
[[Ar:وظائف مفيدة]]<br />
<br />
==Fordította==<br />
'''2018.07.14.''' <font size="3">'''[https://wiki.multitheftauto.com/wiki/User:Surge Surge]'''</font></div>Alex7202https://wiki.multitheftauto.com/index.php?title=GetElementSpeed&diff=66790GetElementSpeed2020-06-03T10:43:20Z<p>Alex7202: </p>
<hr />
<div>__NOTOC__<br />
{{Useful Function}}<br />
This function returns the speed of an element in m/s, km/h or mph.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
float/nil getElementSpeed ( element theElement [, int/string unit="m/s" ] )<br />
</syntaxhighlight><br />
<br />
===Required arguments===<br />
* '''theElement''': the [[element]] you want to get the speed of. Compatible [[element]] types are:<br />
** [[Player|Players]]<br />
** [[Ped|Peds]]<br />
** [[Object|Objects]]<br />
** [[Vehicle|Vehicles]]<br />
** [[Projectile|Projectiles]]<br />
<br />
===Optional arguments===<br />
{{OptionalArg}}<br />
* '''Unit''': The unit of the speed returned. If not specified, the unit will be ''m/s''. It can be specified as a ''[[string]]'' or ''number'' as follows:<br />
** '''0''' or '''m/s''': meters per second (speed unit of the [http://en.wikipedia.org/wiki/International_System_of_Units International System of Units], used in formal contexts).<br />
** '''1''' or '''km/h''': kilometres per hour (the most common speed unit, used in most countries).<br />
** '''2''' or '''mph''': miles per hour (used in some English-speaking countries).<br />
<br />
==Returns==<br />
This function returns a ''number'' containing the [[element]]'s speed if the arguments provided are valid. It returns ''[[nil]]'' plus an ''error'' otherwise.<br />
<br />
==Code==<br />
<section name="Function source" class="both" show="true"><br />
'''It is recommended to use MTA:SA 1.4''' or higher with this function to use [[OOP]].<br />
<syntaxhighlight lang="lua"><br />
function getElementSpeed(theElement, unit)<br />
-- Check arguments for errors<br />
assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")")<br />
local elementType = getElementType(theElement)<br />
assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")")<br />
assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)")<br />
-- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number<br />
unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit))<br />
-- Setup our multiplier to convert the velocity to the specified unit<br />
local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456)<br />
-- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit<br />
return (Vector3(getElementVelocity(theElement)) * mult).length<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
==Example==<br />
<section name="Clientside example" class="client" show="true"><br />
This example draws the local player's speed rounded to a single decimal in the top-right corner of the screen in different units.<br />
<syntaxhighlight lang="lua"><br />
local sx = guiGetScreenSize()<br />
local function drawSpeed()<br />
local vehicle = getPedOccupiedVehicle(getLocalPlayer())<br />
local speedms, speedkmh, speedmph = getElementSpeed(vehicle), getElementSpeed(vehicle, 1), getElementSpeed(vehicle, 2)<br />
local roundedSpeedms, roundedSpeedkmh, roundedSpeedmph = math.floor(speedms) == speedms and speedms or string.format(speedms, "%.1f"), math.floor(speedkmh) == speedkmh and speedkmh or string.format(speedkmh, "%.1f"), math.floor(speedmph) == speedmph and speedmph or string.format(speedmph, "%.1f")<br />
local speedoText = "Current speed: " .. roundedSpeedms .. " m/s | " .. roundedSpeedkmh .. " km/h | " .. roundedSpeedmph .. " mph"<br />
dxDrawText(speedoText, sx - dxGetTextWidth(speedoText), 0)<br />
end<br />
addEventHandler("onClientPreRender", getRootElement(), drawSpeed)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See also==<br />
{{Useful_Functions}}<br />
[[ru:getElementSpeed]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=RU/getElementSpeed&diff=66789RU/getElementSpeed2020-06-03T10:43:06Z<p>Alex7202: Created page with "__NOTOC__ {{RU/Useful Function}} Эта функция возвращает скорость элемента в м/с, км/ч или миль/ч. ==Синтаксис== <sy..."</p>
<hr />
<div>__NOTOC__<br />
{{RU/Useful Function}}<br />
Эта функция возвращает скорость элемента в м/с, км/ч или миль/ч.<br />
<br />
==Синтаксис==<br />
<syntaxhighlight lang="lua"><br />
float/nil getElementSpeed ( element theElement [, int/string unit="m/s" ] )<br />
</syntaxhighlight><br />
<br />
===Аргументы===<br />
* '''theElement''': [[element|Элемент]] скорость которого нужно получить. Доступны следующие типы [[element|элементов]]:<br />
** [[Player|Игроки]]<br />
** [[Ped|Педы]]<br />
** [[Object|Объекты]]<br />
** [[Vehicle|Машины]]<br />
** [[Projectile|Снаряды]]<br />
<br />
===Дополнительные аргументы===<br />
{{RU/OptionalArg}}<br />
* '''Unit''': Единицы измерения. Если не установлены, вернет в ''м/с''. Они могут быть заданы ''[[string|текстом]]'' или ''числом'':<br />
** '''0''' or '''m/s''': метров в секунду.<br />
** '''1''' or '''km/h''': километров в час.<br />
** '''2''' or '''mph''': миль в час.<br />
<br />
==Возврат==<br />
Вернет скорость [[element|элемнта]] если он есть, или ''[[nil]]'' если его нет.<br />
<br />
==Код==<br />
<section name="Для сервера и клиента" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function getElementSpeed(theElement, unit)<br />
assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")")<br />
local elementType = getElementType(theElement)<br />
assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")")<br />
assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)")<br />
unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit))<br />
local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456)<br />
return (Vector3(getElementVelocity(theElement)) * mult).length<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
==Пример==<br />
<section name="Клиент" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
local sx = guiGetScreenSize()<br />
local function drawSpeed()<br />
local vehicle = getPedOccupiedVehicle(getLocalPlayer())<br />
local speedms, speedkmh, speedmph = getElementSpeed(vehicle), getElementSpeed(vehicle, 1), getElementSpeed(vehicle, 2)<br />
local roundedSpeedms, roundedSpeedkmh, roundedSpeedmph = math.floor(speedms) == speedms and speedms or string.format(speedms, "%.1f"), math.floor(speedkmh) == speedkmh and speedkmh or string.format(speedkmh, "%.1f"), math.floor(speedmph) == speedmph and speedmph or string.format(speedmph, "%.1f")<br />
local speedoText = "Current speed: " .. roundedSpeedms .. " m/s | " .. roundedSpeedkmh .. " km/h | " .. roundedSpeedmph .. " mph"<br />
dxDrawText(speedoText, sx - dxGetTextWidth(speedoText), 0)<br />
end<br />
addEventHandler("onClientRender", getRootElement(), drawSpeed)<br />
</syntaxhighlight><br />
</section><br />
<br />
==Смотрите также==<br />
{{RU/Useful_Functions}}<br />
[[en:getElementSpeed]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=RU/getVehicleRPM&diff=66788RU/getVehicleRPM2020-06-03T10:31:59Z<p>Alex7202: </p>
<hr />
<div>__NOTOC__<br />
{{RU/Useful Function}}<br />
Эта функция получает обороты двигателя [[vehicle|машины]]. Так же нужна функция [[RU/getElementSpeed|getElementSpeed]].<br />
==Синтаксис==<br />
<syntaxhighlight lang="lua">number getVehicleRPM (vehicle)</syntaxhighlight><br />
<br />
===Возврат===<br />
Возвращает ''число оборотов'' или ''0''.<br />
<br />
==Код==<br />
<section name="Клиент" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
function getVehicleRPM(vehicle)<br />
local vehicleRPM = 0<br />
if (vehicle) then <br />
if (getVehicleEngineState(vehicle) == true) then<br />
if getVehicleCurrentGear(vehicle) > 0 then <br />
vehicleRPM = math.floor(((getElementSpeed(vehicle, "km/h") / getVehicleCurrentGear(vehicle)) * 160) + 0.5) <br />
else<br />
vehicleRPM = math.floor((getElementSpeed(vehicle, "km/h") * 160) + 0.5)<br />
end<br />
if (vehicleRPM < 650) then<br />
vehicleRPM = math.random(650, 750) -- Когда машина стоит, обороты будут колебаться от 650 до 750, их можно менять<br />
elseif (vehicleRPM >= 9000) then<br />
vehicleRPM = math.random(9000, 9900) -- Максимальное количество оборотов<br />
end<br />
else<br />
vehicleRPM = 0<br />
end<br />
<br />
return tonumber(vehicleRPM)<br />
else<br />
return 0<br />
end<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
==Пример==<br />
<section name="Клиент" class="client" show="true"><br />
Получим обороты двигателя, и нарисуем их на экране.<br />
<syntaxhighlight lang="lua"><br />
addEventHandler ("onClientRender", root, function()<br />
local veh = getPedOccupiedVehicle (localPlayer)<br />
if veh then<br />
local rpm = getVehicleRPM (veh)<br />
dxDrawText (rpm, 500, 500, 100, 100)<br />
end<br />
end)<br />
</syntaxhighlight><br />
</section><br />
<br />
'''Автор: ''': nL~Enzo<br />
<br><br />
'''Перевел: ''': Alex7202<br />
<br />
==Смотрите также==<br />
{{RU/Useful Functions}}<br />
<br />
[[en:getVehicleRPM]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Element/Vehicle&diff=66787Element/Vehicle2020-06-03T10:29:56Z<p>Alex7202: </p>
<hr />
<div>__NOTOC__<br />
The vehicle class represents vehicles in the GTA world. Vehicles can be occupied and controlled by players.<br />
<br />
The element type of this class is '''"vehicle"'''.<br />
<br />
==XML syntax==<br />
<syntaxhighlight lang="xml"><br />
<vehicle model="" posX="" posY="" posZ="" rotX="" rotY="" rotZ="" color="" upgrades="" paintjob="" plate="" turretX="" turretY="" health="" sirens="" landingGearDown="" specialState="" locked="" interior="" dimension="" frozen=""/><br />
</syntaxhighlight><br />
<br />
===Required Attributes===<br />
* '''model''': The [[Vehicle IDs|vehicle ID]] of the vehicle being created.<br />
* '''posX''': A float representing the X position of the vehicle.<br />
* '''posY''': A float representing the Y position of the vehicle.<br />
* '''posZ''': A float representing the Z position of the vehicle.<br />
<br />
===Optional Attributes===<br />
* '''rotX''': A float representing the X rotation of the vehicle.<br />
* '''rotY''': A float representing the Y rotation of the vehicle.<br />
* '''rotZ''': A float representing the Z rotation of the vehicle.<br />
* '''color''': An integer indicating the vehicle's [[Vehicle Colors|color(s)]] (seperated by commas).<br />
* '''upgrades''': An integer representing the vehicle's mod upgrade(s) (seperated by commas), defined in San Andreas\data\maps\veh_mods\veh_mods.ide<br />
* '''paintjob''': An integer indicating the vehicle's paint job (only works on certain vehicles).<br />
* '''plate''': A set of up to 8 characters that will be shown on the vehicle's license plate.<br />
* '''turretX''': the vehicle's turret's rotation around the Z axis, in radians. Relative to the vehicle's rotation, i.e. turretX=0 will always make the turret point in the same direction as the vehicle.<br />
* '''turretY''': the vehicle's turret's rotation around the X axis, in radians. 0 means horizontal, positive values will make it point up and negative values point it down.<br />
* '''health''': the vehicle's health. A value of 1000 means completely healthy, although higher values are allowed.<br />
* '''sirens''': whether or not the vehicle's sirens are on (e.g. police cars and ambulances). Possible values are "true" and "false".<br />
* '''landingGearDown''': whether or not the vehicle's landing gear is down (only applicable to planes). Possible values are "true" and "false".<br />
* '''specialState''': the vehicle's adjustable property number.<br />
* '''locked''': whether or not the vehicle's doors are locked. "true" or "false".<br />
* '''interior''': the interior number of the vehicle<br />
* '''dimension''': the dimension number of the vehicle<br />
{{New feature|3.0110|1.1|<br />
* '''frozen''': A bool indicating whether the vehicle should be capable of moving<br />
}}<br />
<br />
==Related scripting functions==<br />
{{Vehicle functions}}<br />
[[Category:Element Types]]<br />
<br />
[[hu:Element/Vehicle]]<br />
[[it:Elemento/Veicolo]]<br />
[[ru:Element/Vehicle]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Element/Vehicle&diff=66786Element/Vehicle2020-06-03T10:29:44Z<p>Alex7202: </p>
<hr />
<div>__NOTOC__<br />
The vehicle class represents vehicles in the GTA world. Vehicles can be occupied and controlled by players.<br />
<br />
The element type of this class is '''"vehicle"'''.<br />
<br />
==XML syntax==<br />
<syntaxhighlight lang="xml"><br />
<vehicle model="" posX="" posY="" posZ="" rotX="" rotY="" rotZ="" color="" upgrades="" paintjob="" plate="" turretX="" turretY="" health="" sirens="" landingGearDown="" specialState="" locked="" interior="" dimension="" frozen=""/><br />
</syntaxhighlight><br />
<br />
===Required Attributes===<br />
* '''model''': The [[Vehicle IDs|vehicle ID]] of the vehicle being created.<br />
* '''posX''': A float representing the X position of the vehicle.<br />
* '''posY''': A float representing the Y position of the vehicle.<br />
* '''posZ''': A float representing the Z position of the vehicle.<br />
<br />
===Optional Attributes===<br />
* '''rotX''': A float representing the X rotation of the vehicle.<br />
* '''rotY''': A float representing the Y rotation of the vehicle.<br />
* '''rotZ''': A float representing the Z rotation of the vehicle.<br />
* '''color''': An integer indicating the vehicle's [[Vehicle Colors|color(s)]] (seperated by commas).<br />
* '''upgrades''': An integer representing the vehicle's mod upgrade(s) (seperated by commas), defined in San Andreas\data\maps\veh_mods\veh_mods.ide<br />
* '''paintjob''': An integer indicating the vehicle's paint job (only works on certain vehicles).<br />
* '''plate''': A set of up to 8 characters that will be shown on the vehicle's license plate.<br />
* '''turretX''': the vehicle's turret's rotation around the Z axis, in radians. Relative to the vehicle's rotation, i.e. turretX=0 will always make the turret point in the same direction as the vehicle.<br />
* '''turretY''': the vehicle's turret's rotation around the X axis, in radians. 0 means horizontal, positive values will make it point up and negative values point it down.<br />
* '''health''': the vehicle's health. A value of 1000 means completely healthy, although higher values are allowed.<br />
* '''sirens''': whether or not the vehicle's sirens are on (e.g. police cars and ambulances). Possible values are "true" and "false".<br />
* '''landingGearDown''': whether or not the vehicle's landing gear is down (only applicable to planes). Possible values are "true" and "false".<br />
* '''specialState''': the vehicle's adjustable property number.<br />
* '''locked''': whether or not the vehicle's doors are locked. "true" or "false".<br />
* '''interior''': the interior number of the vehicle<br />
* '''dimension''': the dimension number of the vehicle<br />
{{New feature|3.0110|1.1|<br />
* '''frozen''': A bool indicating whether the vehicle should be capable of moving<br />
}}<br />
<br />
==Related scripting functions==<br />
{{Vehicle functions}}<br />
[[Category:Element Types]]<br />
<br />
[[hu:Element/Vehicle]]<br />
[[it:Elemento/Veicolo]]<br />
[[ru:Elemento/Vehicle]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=GetVehicleRPM&diff=66785GetVehicleRPM2020-06-03T10:27:50Z<p>Alex7202: </p>
<hr />
<div>__NOTOC__<br />
{{Useful Function}}<br />
This function returns a [[vehicle]] engine speed. You will also need a function to [[getElementSpeed]].<br />
==Syntax==<br />
<syntaxhighlight lang="lua">vehicle getVehicleRPM (vehicle)</syntaxhighlight><br />
<br />
===Returns===<br />
It returns a [[vehicle]] engine speed. If not, it returns ''0''.<br />
<br />
==Code==<br />
<syntaxhighlight lang="lua"><br />
function getVehicleRPM(vehicle)<br />
local vehicleRPM = 0<br />
if (vehicle) then <br />
if (getVehicleEngineState(vehicle) == true) then<br />
if getVehicleCurrentGear(vehicle) > 0 then <br />
vehicleRPM = math.floor(((getElementSpeed(vehicle, "km/h") / getVehicleCurrentGear(vehicle)) * 160) + 0.5) <br />
if (vehicleRPM < 650) then<br />
vehicleRPM = math.random(650, 750)<br />
elseif (vehicleRPM >= 9000) then<br />
vehicleRPM = math.random(9000, 9900)<br />
end<br />
else<br />
vehicleRPM = math.floor((getElementSpeed(vehicle, "km/h") * 160) + 0.5)<br />
if (vehicleRPM < 650) then<br />
vehicleRPM = math.random(650, 750)<br />
elseif (vehicleRPM >= 9000) then<br />
vehicleRPM = math.random(9000, 9900)<br />
end<br />
end<br />
else<br />
vehicleRPM = 0<br />
end<br />
<br />
return tonumber(vehicleRPM)<br />
else<br />
return 0<br />
end<br />
end<br />
</syntaxhighlight><br />
'''Function made by''': nL~Enzo<br />
<br />
==Examples==<br />
<section name="Client example" class="client" show="true"><br />
This example get vehicle engine speed, and draw engine speed.<br />
<syntaxhighlight lang="lua"><br />
addEventHandler ("onClientRender", root, function()<br />
local veh = getPedOccupiedVehicle (localPlayer)<br />
if veh then<br />
local rpm = getVehicleRPM (veh)<br />
dxDrawText (rpm, 500, 500, 100, 100)<br />
end<br />
end)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See also==<br />
{{Useful Functions}}<br />
<br />
[[ru:getVehicleRPM]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=RU/getVehicleRPM&diff=66784RU/getVehicleRPM2020-06-03T10:27:33Z<p>Alex7202: Created page with "__NOTOC__ {{RU/Useful Function}} Эта функция получает обороты двигателя машины. Так же нужна функция ..."</p>
<hr />
<div>__NOTOC__<br />
{{RU/Useful Function}}<br />
Эта функция получает обороты двигателя [[RU/vehicle|машины]]. Так же нужна функция [[RU/getElementSpeed|getElementSpeed]].<br />
==Синтаксис==<br />
<syntaxhighlight lang="lua">number getVehicleRPM (vehicle)</syntaxhighlight><br />
<br />
===Возврат===<br />
Возвращает ''число оборотов'' или ''0''.<br />
<br />
==Код==<br />
<section name="Клиент" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
function getVehicleRPM(vehicle)<br />
local vehicleRPM = 0<br />
if (vehicle) then <br />
if (getVehicleEngineState(vehicle) == true) then<br />
if getVehicleCurrentGear(vehicle) > 0 then <br />
vehicleRPM = math.floor(((getElementSpeed(vehicle, "km/h") / getVehicleCurrentGear(vehicle)) * 160) + 0.5) <br />
else<br />
vehicleRPM = math.floor((getElementSpeed(vehicle, "km/h") * 160) + 0.5)<br />
end<br />
if (vehicleRPM < 650) then<br />
vehicleRPM = math.random(650, 750) -- Когда машина стоит, обороты будут колебаться от 650 до 750, их можно менять<br />
elseif (vehicleRPM >= 9000) then<br />
vehicleRPM = math.random(9000, 9900) -- Максимальное количество оборотов<br />
end<br />
else<br />
vehicleRPM = 0<br />
end<br />
<br />
return tonumber(vehicleRPM)<br />
else<br />
return 0<br />
end<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
==Пример==<br />
<section name="Клиент" class="client" show="true"><br />
Получим обороты двигателя, и нарисуем их на экране.<br />
<syntaxhighlight lang="lua"><br />
addEventHandler ("onClientRender", root, function()<br />
local veh = getPedOccupiedVehicle (localPlayer)<br />
if veh then<br />
local rpm = getVehicleRPM (veh)<br />
dxDrawText (rpm, 500, 500, 100, 100)<br />
end<br />
end)<br />
</syntaxhighlight><br />
</section><br />
<br />
'''Автор: ''': nL~Enzo<br />
<br><br />
'''Перевел: ''': Alex7202<br />
<br />
==Смотрите также==<br />
{{RU/Useful Functions}}<br />
<br />
[[en:getVehicleRPM]]</div>Alex7202https://wiki.multitheftauto.com/index.php?title=Template:RU/Useful_Functions&diff=66783Template:RU/Useful Functions2020-06-03T10:20:09Z<p>Alex7202: </p>
<hr />
<div>__NOTOC__<br />
=== Функции таблиц ===<br />
*[[RU/PairsByKeys|pairsByKeys]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Эта функция сортирует pairs таблицы.</span><br />
<br />
=== ACL фунции ===<br />
*[[RU/aclGroupClone|aclGroupClone]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Эта функция создает копию группы с другим названием с/буз ACL'ов и/или объектов.</span><br />
<br />
=== События ===<br />
*[[RU/isEventHandlerAdded|isEventHandlerAdded]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Эта функция проверяет, создано событие или нет.</span><br />
<br />
=== Функции машины ===<br />
*[[RU/getVehicleRPM|getVehicleRPM]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Эта функция получает кол-во оборотов машины.</span><br />
<br />
<noinclude>[[Category:RU/Useful Functions|Категория:Полезные функции]]</noinclude></div>Alex7202https://wiki.multitheftauto.com/index.php?title=Template:RU/Useful_Functions&diff=66782Template:RU/Useful Functions2020-06-03T10:18:57Z<p>Alex7202: </p>
<hr />
<div>__NOTOC__<br />
=== Функции таблиц ===<br />
*[[RU/PairsByKeys|pairsByKeys]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Эта функция сортирует pairs таблицы.</span><br />
<br />
=== ACL фунции ===<br />
*[[RU/aclGroupClone|aclGroupClone]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Эта функция создает копию группы с другим названием с/буз ACL'ов и/или объектов.</span><br />
<br />
=== События ===<br />
*[[RU/isEventHandlerAdded|isEventHandlerAdded]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Эта функция проверяет, создано событие или нет.</span><br />
<br />
<noinclude>[[Category:RU/Useful Functions|Категория:Полезные функции]]</noinclude></div>Alex7202