https://wiki.multitheftauto.com/api.php?action=feedcontributions&user=Rut&feedformat=atomMulti Theft Auto: Wiki - User contributions [en]2024-03-29T07:48:20ZUser contributionsMediaWiki 1.39.3https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=65126Template:Useful Functions2020-02-12T17:04:57Z<p>Rut: /* 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 />
<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 />
*[[isPlayerStaff]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a player is server admin or staff.</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 />
*[[removeAccountData]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function is used to remove data from an account.</span><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 />
*[[isInSlot]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks your cursor is in slot.</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 />
*[[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.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 />
<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 />
*[[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 />
*[[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 />
*[[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 />
*[[getServerIp]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns the public IP of the server.</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 />
*[[isCursorOnElement]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks whether the cursor is in a particular area.</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 />
*[[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 />
<br />
<noinclude>[[Category:Useful Functions]]</noinclude></div>Ruthttps://wiki.multitheftauto.com/index.php?title=SetPedAnimationSpeed&diff=64518SetPedAnimationSpeed2019-10-14T11:09:05Z<p>Rut: /* Example */</p>
<hr />
<div>__NOTOC__<br />
{{Server client function}}<br />
{{New feature/item|3.0156|1.5.5|14219|<br />
Sets the speed of a currently running animation for a particular player or ped.<br />
}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool setPedAnimationSpeed ( ped thePed [, string anim = "", float speed = 1.0 ] )<br />
</syntaxhighlight><br />
{{OOP||[[ped]]:setAnimationProgress}}<br />
<br />
===Required Arguments===<br />
*'''thePed:''' the [[player]] or [[ped]] you want to change animation speed of.<br />
<br />
===Optional Arguments===<br />
*'''anim:''' the animation name it will affect.<br />
*'''speed:''' a [[float]] containing the speed between 0.0–1.0 you want to apply to the animation. ''This limitation may be adjusted in the future, so do not provide speeds outside this boundary.''<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
In this example we give the animation of dancing to the player and after 5 seconds it becomes 0.2s slower.<br />
<syntaxhighlight lang="lua"><br />
addCommandHandler('dance',<br />
function( player, cmd )<br />
setPedAnimation( player, 'DANCING', 'DAN_Down_A', -1 )<br />
source = player<br />
setTimer(function() <br />
setPedAnimationSpeed( source, 'DAN_Down_A', 0.2 )<br />
end,5000,1)<br />
end<br />
)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Ped_functions}}</div>Ruthttps://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=64515Template:Useful Functions2019-10-13T13:25:06Z<p>Rut: /* 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 />
<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 />
*[[isPlayerStaff]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a player is server admin or staff.</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 />
*[[removeAccountData]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function is used to remove data from an account.</span><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 />
*[[convertNumber]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function converts and formats large numbers.</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 />
*[[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.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 />
<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 />
*[[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 />
*[[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 />
*[[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 />
<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 />
*[[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 />
*[[isCursorOnElement]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks whether the cursor is in a particular area.</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 />
*[[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 />
*[[thisCommandHandlersExist]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This method checks a string if this exist as command Handlers</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 />
<br />
<noinclude>[[Category:Useful Functions]]</noinclude></div>Ruthttps://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=62464Template:Useful Functions2019-04-14T06:20:09Z<p>Rut: /* Drawing 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 />
<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 />
*[[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 />
*[[isPlayerStaff]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a player is server admin or staff.</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 />
*[[removeAccountData]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function is used to remove data from an account.</span><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 />
*[[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 />
<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 />
*[[convertNumber]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function converts and formats large numbers.</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 />
*[[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 />
*[[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.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 />
*[[isLowerOrUpper]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">»This function checks whether the letter is large or small.</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 />
*[[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 a 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 />
*[[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 />
*[[getPlayersInGroup]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns all Players In Group .</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 />
<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 />
*[[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 />
<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 />
*[[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 />
*[[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 />
*[[isCursorOnElement]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks whether the cursor is in a particular area.</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 />
*[[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 />
*[[thisCommandHandlersExist]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This method checks a string if this exist as command Handlers</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 />
<br />
<noinclude>[[Category:Useful Functions]]</noinclude></div>Ruthttps://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=62463Template:Useful Functions2019-04-14T06:18:45Z<p>Rut: /* Drawing 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 />
<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 />
*[[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 />
*[[isPlayerStaff]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks if a player is server admin or staff.</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 />
*[[removeAccountData]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function is used to remove data from an account.</span><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 />
*[[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 />
*[[dxDrawRombo]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» Esta funcion crea un rombo en dx.</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 />
<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 />
*[[convertNumber]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function converts and formats large numbers.</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 />
*[[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 />
*[[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.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 />
*[[isLowerOrUpper]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">»This function checks whether the letter is large or small.</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 />
*[[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 a 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 />
*[[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 />
*[[getPlayersInGroup]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function returns all Players In Group .</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 />
<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 />
*[[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 />
<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 />
*[[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 />
*[[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 />
*[[isCursorOnElement]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This function checks whether the cursor is in a particular area.</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 />
*[[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 />
*[[thisCommandHandlersExist]] <span style="color:gray; font-family:'Georgia',sans-serif; font-size:smaller;">» This method checks a string if this exist as command Handlers</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 />
<br />
<noinclude>[[Category:Useful Functions]]</noinclude></div>Rut