<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MrX</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MrX"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/MrX"/>
	<updated>2026-04-25T14:06:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=TakeAllWeapons&amp;diff=35538</id>
		<title>TakeAllWeapons</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=TakeAllWeapons&amp;diff=35538"/>
		<updated>2013-04-23T14:20:27Z</updated>

		<summary type="html">&lt;p&gt;MrX: Can also be used on Peds&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function removes every weapons from a specified ped, rendering it unarmed.&lt;br /&gt;
{{Note|Weapons are removed when a ped dies by default. This means that it is only appropriate to use this function while a ped is alive.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool takeAllWeapons ( ped thePed )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer''': A [[ped]] element referencing the specified ped&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the function succeeded, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example removes all weapons from every player&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
takeAllWeapons ( getRootElement() )  --remove all the weapons&lt;br /&gt;
outputChatBox ( &amp;quot;Weapons are not permitted!&amp;quot; ) --tell the players why they lost their weapons&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Weapon functions}}&lt;br /&gt;
[[ru:takeAllWeapons]]&lt;/div&gt;</summary>
		<author><name>MrX</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=35250</id>
		<title>Template:Useful Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=35250"/>
		<updated>2013-03-28T17:11:08Z</updated>

		<summary type="html">&lt;p&gt;MrX: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any clientside function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any server-side function from the client's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function center the window in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if it's arguments are of the right types and calls the error-function if one isn't.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Fix for hidden coroutine error messages&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawColorText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a dx text with #RRGGBB color codes support.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculate a font size from given height for dxDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Accurately measures the pixel height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes two points and returns the direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[FormatDate]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[GenerateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can generate a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all the alive players by a client side, so you can store them into a Gridlist or something like that, faster.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players in a team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks in which way the cursor is currently moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of enabled weapons usable on a jetpack.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOffsetFromXYZ]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function will give the online admins.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all online staff, names separated by two spaces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get player From his Name part.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets all the players in a photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can get the UNIX timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all children of a node&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getVehicleRespawnPosition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get the spawn position of a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Adjusts the combobox to have a correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiEditSetActive]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Puts the caret of an editbox to the gived position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element was in the player's camera picture.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check is the element's range to the main point is smaller than (or as big as) the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a ped is aiming.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if the player in the team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Checks if the given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns an iterator for your for loops saving time typing ipairs( getElementsByType( type ) ), instead you type: iterElements( type ).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Rounds a number whereas the number of decimals to keep and the method may be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks one element to many, handy and clean.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicles weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set moving element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[smoothMoveCamera]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function allows you to create a cinematic camera flight.&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function counts a text from a text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function splits a string at a given separator pattern and returns a table with the pieces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allow the value of a variable or expression to control the flow of program execution via a multiway branch.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function copies a whole table and all the tables in that table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.condition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if both tables is equal. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check is empty table or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» 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.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random variable from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function outputs information about one or more variables using outputConsole()&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string representing the color in hexadecimal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used clientside.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wavelengthToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a phisical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts large numbers and adds commas to it. (Example: 100000 -&amp;gt; 100,000)&amp;lt;/span&amp;gt;&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>MrX</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=HasObjectPermissionTo&amp;diff=32387</id>
		<title>HasObjectPermissionTo</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=HasObjectPermissionTo&amp;diff=32387"/>
		<updated>2012-08-18T15:29:09Z</updated>

		<summary type="html">&lt;p&gt;MrX: &amp;quot;Ban command&amp;quot; -&amp;gt; &amp;quot;Kick command&amp;quot; in the example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function returns whether or not the given object has access to perform the given action. &lt;br /&gt;
&lt;br /&gt;
Scripts frequently wish to limit access to features to particular users. The naïve way to do this would be to check if the player who is attempting to perform an action is in a particular group (usually the Admin group). The main issue with doing this is that the Admin group is not guaranteed to exist. It also doesn't give the server admin any flexibility. He might want to allow his 'moderators' access to the function you're limiting access to, or he may want it disabled entirely. &lt;br /&gt;
&lt;br /&gt;
This is where using the ACL properly comes in, and luckily this is very easy. It all comes down to using this function. This, somewhat confusingly named function lets you check if an ACL object (a player or a resource) has a particular ACL right. In this case, we just care about players.&lt;br /&gt;
&lt;br /&gt;
So, first of all, think of a name for your 'right'. Let's say we want a private area only certain people can go in, we'll call our right accessPrivateArea. Then, all you need to do is add one 'if' statement to your code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;if hasObjectPermissionTo ( player, &amp;quot;resource.YourResourceName.accessPrivateArea&amp;quot;, false ) then&lt;br /&gt;
-- Whatever you want to happen if they're allowed in&lt;br /&gt;
else&lt;br /&gt;
-- Whatever you want to happen if they aren't&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that we've named the ''right'' using ''resource.YourResourceName.accessPrivateArea'' - this is just for neatness, so that the admin knows what resource the right belongs to. It's strongly advised you follow this convention. The ''false'' argument specifies the 'defaultPermission', false indicating that if the user hasn't had the right allowed or dissallowed (i.e. the admin hasn't added it to the config), that it should default to being not allowed.&lt;br /&gt;
&lt;br /&gt;
The only downside of using this method is that the admin has to modify his config. The upsides are that the admin has much more control and your script will work for any server, however the admin has configured it.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool hasObjectPermissionTo ( string / element theObject, string theAction [, bool defaultPermission = true ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theObject:''' The object to test if has permission to. This can be a client element (ie. a player), a resource or a string in the form &amp;quot;user.&amp;lt;name&amp;gt;&amp;quot; or &amp;quot;resource.&amp;lt;name&amp;gt;&amp;quot;.&lt;br /&gt;
*'''theAction:''' The action to test if the given object has access to. Ie. &amp;quot;function.kickPlayer&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''defaultPermission:''' The default permission if none is specified in either of the groups the given object is a member of. If this is left to true, the given object will have permissions to perform the action unless the opposite is explicitly specified in the [[ACL]]. If false, the action will be denied by default unless explicitly approved by the [[Access Control List]].&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the given object has permission to perform the given action, ''false'' otherwise. Returns ''nil'' if the function failed because of bad arguments.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example kicks a player if the user using it has access to the kickPlayer function.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Kick command&lt;br /&gt;
function onKickCommandHandler ( playerSource, commandName, playerToKick, stringReason )&lt;br /&gt;
    -- Does the calling user have permission to kick the player? Default&lt;br /&gt;
    -- to false for safety reasons. We do this so any user can't use us to&lt;br /&gt;
    -- kick players.&lt;br /&gt;
    if ( hasObjectPermissionTo ( playerSource, &amp;quot;function.kickPlayer&amp;quot;, false ) ) then&lt;br /&gt;
&lt;br /&gt;
        -- Do we have permission to kick the player? We do this so we can fail&lt;br /&gt;
        -- nicely if this resource doesn't have access to call that function.&lt;br /&gt;
        if ( hasObjectPermissionTo ( getThisResource (), &amp;quot;function.kickPlayer&amp;quot;, true ) ) then&lt;br /&gt;
            -- Kick him&lt;br /&gt;
            kickPlayer ( playerToKick, playerSource, stringReason )&lt;br /&gt;
        else&lt;br /&gt;
            -- Resource doesn't have any permissions, sorry&lt;br /&gt;
            outputChatBox ( &amp;quot;kick: The admin resource is not able to kick players. Please give this resource access to 'function.kickPlayer' in the ACL to use this function.&amp;quot;, playerSource )&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        -- User doesn't have any permissions&lt;br /&gt;
        outputChatBox ( &amp;quot;kick: You don't have permissions to use this command.&amp;quot;, playerSource )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;kick&amp;quot;, onKickCommandHandler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&amp;lt;!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc --&amp;gt;&lt;br /&gt;
{{ACL_functions}}&lt;/div&gt;</summary>
		<author><name>MrX</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxDrawImage3D&amp;diff=31653</id>
		<title>DxDrawImage3D</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxDrawImage3D&amp;diff=31653"/>
		<updated>2012-06-27T01:03:32Z</updated>

		<summary type="html">&lt;p&gt;MrX: fixed rotation being an optional parameter, fixed example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function draws a textured 3D line between two points in the 3D world that appers to be a 3D image - rendered for one frame  This should be used in conjunction with [[onClientPreRender]] in order to display continuously.&lt;br /&gt;
&lt;br /&gt;
The 3D line with a large width value and a texture effectively becomes a 3D image, hence the possibility to construct basic shapes such as boxes with several large width lines and the appropriate values for 'faceToward'.&lt;br /&gt;
&lt;br /&gt;
3D lines are drawn at a particular place in the [[Game_Processing_Order|game processing order]], so use [[onClientPreRender]] for drawing if you are attaching them to world elements.&amp;lt;br&amp;gt;&lt;br /&gt;
* '''NOTE:''' This is made to be used clientside!.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool dxDraw3DImage ( float x, float y, float z, float width, float height, element material[, int color, float rotation, float faceTowardX, float faceTowardY, float faceTowardZ]&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''X/Y/Z:''' The start position of the 3D image, representing a coordinate in the GTA world.&lt;br /&gt;
* '''width:''' The width of the image in GTA world units. (This is 1/75th of the width used in dxDrawLine3D)&lt;br /&gt;
* '''height:''' The height of the image in GTA world units. (This is 1/75th of the width used in dxDrawLine3D)&lt;br /&gt;
* '''material:''' A material to draw the image with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''color:''' An integer of the hex color, produced using [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).&lt;br /&gt;
* '''rotation:''' Rotation (end point of the image) offset&lt;br /&gt;
* '''faceTowardX/Y/Z:''' The direction the front of the image should face towards. If this is not set, the front of the image always faces toward the camera.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''true'' if the operation was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local white = tocolor(255,255,255,255)&lt;br /&gt;
function dxDrawImage3D(x,y,z,w,h,m,c,r,...)&lt;br /&gt;
        local lx, ly, lz = x+w, y+h, (z+tonumber(r or 0)) or z&lt;br /&gt;
	return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, m, h, c or white, ...)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This draws a trollface in the middle of the GTA world for no reason&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local face = dxCreateTexture(&amp;quot;trollface.png&amp;quot;)&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root,&lt;br /&gt;
    function()&lt;br /&gt;
        dxDrawImage3D(0,0, 20, 20, 20, face, tocolor(255,255,255,255))&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: qaisjp&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrX</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxDrawRectangle3D&amp;diff=31652</id>
		<title>DxDrawRectangle3D</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxDrawRectangle3D&amp;diff=31652"/>
		<updated>2012-06-27T01:02:32Z</updated>

		<summary type="html">&lt;p&gt;MrX: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function draws a textured 3D line between two points in the 3D world that appers to be a rectangle - rendered for one frame  This should be used in conjunction with [[onClientPreRender]] in order to display continuously.&lt;br /&gt;
&lt;br /&gt;
The 3D line with a large width value effectively becomes a rectangle, hence the possibility to construct basic shapes such as boxes with several large width lines and the appropriate values for 'faceToward'.&lt;br /&gt;
&lt;br /&gt;
3D lines are drawn at a particular place in the [[Game_Processing_Order|game processing order]], so use [[onClientPreRender]] for drawing if you are attaching them to world elements.&amp;lt;br&amp;gt;&lt;br /&gt;
* '''NOTE:''' This is made to be used clientside!.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool dxDrawRectangle3D ( float x, float y, float z, float width, float height[, int color, float rotation, float faceTowardX, float faceTowardY, float faceTowardZ]&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''X/Y/Z:''' The start position of the 3D rectangle, representing a coordinate in the GTA world.&lt;br /&gt;
* '''width:''' The width of the rect in GTA world units. (This is 1/75th of the width used in dxDrawLine3D)&lt;br /&gt;
* '''height:''' The height of the rect in GTA world units. (This is 1/75th of the width used in dxDrawLine3D)&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''color:''' An integer of the hex color, produced using [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).&lt;br /&gt;
* '''rotation:''' Rotation (end point of the rect) offset&lt;br /&gt;
* '''faceTowardX/Y/Z:''' The direction the front of the rect should face towards. If this is not set, the front of the rect always faces toward the camera.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''true'' if the operation was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local dot = dxCreateTexture(1,1)&lt;br /&gt;
local white = tocolor(255,255,255,255)&lt;br /&gt;
function dxDrawRectangle3D(x,y,z,w,h,c,r,...)&lt;br /&gt;
        local lx, ly, lz = x+w, y+h, (z+tonumber(r or 0)) or z&lt;br /&gt;
	return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, dot, h, c or white, ...)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This draws a white rectangle in the middle of the GTA world for no reason&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root,&lt;br /&gt;
    function()&lt;br /&gt;
        dxDrawRectangle3D(0,0, 20, 20, 20, tocolor(255,255,255,255))&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: qaisjp&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrX</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxDrawRectangle3D&amp;diff=31651</id>
		<title>DxDrawRectangle3D</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxDrawRectangle3D&amp;diff=31651"/>
		<updated>2012-06-27T01:02:01Z</updated>

		<summary type="html">&lt;p&gt;MrX: fixed rotation being an optional parameter&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function draws a textured 3D line between two points in the 3D world that appers to be a rectangle - rendered for one frame  This should be used in conjunction with [[onClientPreRender]] in order to display continuously.&lt;br /&gt;
&lt;br /&gt;
The 3D line with a large width value effectively becomes a rectangle, hence the possibility to construct basic shapes such as boxes with several large width lines and the appropriate values for 'faceToward'.&lt;br /&gt;
&lt;br /&gt;
3D lines are drawn at a particular place in the [[Game_Processing_Order|game processing order]], so use [[onClientPreRender]] for drawing if you are attaching them to world elements.&amp;lt;br&amp;gt;&lt;br /&gt;
* '''NOTE:''' This is made to be used clientside!.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool dxDrawRectangle3D ( float x, float y, float z, float width, float height[, int color, float rotation, float faceTowardX, float faceTowardY, float faceTowardZ]&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''X/Y/Z:''' The start position of the 3D rectangle, representing a coordinate in the GTA world.&lt;br /&gt;
* '''width:''' The width of the rect in GTA world units. (This is 1/75th of the width used in dxDrawLine3D)&lt;br /&gt;
* '''height:''' The height of the rect in GTA world units. (This is 1/75th of the width used in dxDrawLine3D)&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''color:''' An integer of the hex color, produced using [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).&lt;br /&gt;
* '''rotation:''' Rotation (end point of the rect) offset&lt;br /&gt;
* '''faceTowardX/Y/Z:''' The direction the front of the rect should face towards. If this is not set, the front of the rect always faces toward the camera.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''true'' if the operation was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local dot = dxCreateTexture(1,1)&lt;br /&gt;
local white = tocolor(255,255,255,255)&lt;br /&gt;
function dxDrawRectangle3D(x,y,z,w,h,c,r,...)&lt;br /&gt;
        r = r or 0&lt;br /&gt;
        local lx, ly, lz = x+w, y+h, (z+tonumber(r)) or z&lt;br /&gt;
	return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, dot, h, c or white, ...)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This draws a white rectangle in the middle of the GTA world for no reason&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root,&lt;br /&gt;
    function()&lt;br /&gt;
        dxDrawRectangle3D(0,0, 20, 20, 20, tocolor(255,255,255,255))&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: qaisjp&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrX</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Resource:Mapmanager&amp;diff=25512</id>
		<title>Resource:Mapmanager</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Resource:Mapmanager&amp;diff=25512"/>
		<updated>2011-03-21T22:14:52Z</updated>

		<summary type="html">&lt;p&gt;MrX: Undo revision 25502 by HYp3R (talk) English...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Resource page}}&lt;br /&gt;
The map manager is a resource included in the MTA DM server suite. It offers commands, functions and events for the gamemodes to dynamically manage their maps. For example, when a race server needs to load different tracks for each race, instead of having all of them in the same resource as the main script, they can be stored in separate resources and then loaded simply with the &amp;quot;changeGamemodeMap&amp;quot; function when a new race starts. &lt;br /&gt;
&lt;br /&gt;
Specifically, the map manager lists gamemodes/maps and manages gamemode/map loading. It applies certain map settings affecting the game world and sets ASE game type and map name rule values as well. It includes a web listing which autoupdates and highglights the current mode/map combination.&lt;br /&gt;
&lt;br /&gt;
==A simple tutorial==&lt;br /&gt;
In this section we are going to continue the basic gamemode we created in the [[Scripting Introduction|Introduction to Scripting]]. We will add a simple map resource that only contains the spawnpoint data for the players, and load the data in the main script when the player needs to spawn.&lt;br /&gt;
&lt;br /&gt;
First of all, we make a folder under /Your MTA Server/mods/deathmatch/resources/, and name it &amp;quot;mymap&amp;quot;. Then under /mymap/ directory, create a text file and name it &amp;quot;meta.xml&amp;quot;, which is required for every resource.&lt;br /&gt;
&lt;br /&gt;
Enter the following codes in the ''meta.xml'' file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
   &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;myserver&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;map src=&amp;quot;mymap.map&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note that this resource is &amp;quot;linked&amp;quot; to the main resource with the ''gamemodes=&amp;quot;&amp;quot;'' tag, which contains the name of the main resource. In the ''map'' tag, it indicates the name of the .map file which contains the actual map data.&lt;br /&gt;
&lt;br /&gt;
Now let's create another text file under /mymap/ and name it &amp;quot;mymap.map&amp;quot;, and enter the following codes:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
   &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;18&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note that &amp;quot;spawnpoint&amp;quot; is the type of the element, used in [[getElementsByType]] function; likewise, &amp;quot;id&amp;quot; is used in [[getElementByID]] function. &lt;br /&gt;
&lt;br /&gt;
To load the map data, the main script needs access to the map resource itself. Now let's edit the script.lua file in &amp;quot;myserver&amp;quot; resource. Enter the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function loadMap(startedMap)&lt;br /&gt;
	mapRoot = getResourceRootElement(startedMap)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), loadMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Basically, the &amp;quot;onGamemodeMapStart&amp;quot; event gives us the handle of the map (&amp;quot;startedMap&amp;quot;), which we used to extract the handle of the resource containing the map (&amp;quot;mapRoot&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
With the resource handle, we can extract the spawnpoint information from it. Look at the joinHandler() function in script.lua, instead of specifying x, y and z, we can use the map data as the following:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler()&lt;br /&gt;
	local spawn = getElementsByType(&amp;quot;spawnpoint&amp;quot;, mapRoot)&lt;br /&gt;
	local x,y,z,r&lt;br /&gt;
	for key, value in pairs(spawn) do&lt;br /&gt;
		x = getElementData(value, &amp;quot;posX&amp;quot;)&lt;br /&gt;
		y = getElementData(value, &amp;quot;posY&amp;quot;)&lt;br /&gt;
		z = getElementData(value, &amp;quot;posZ&amp;quot;)&lt;br /&gt;
		r = getElementData(value, &amp;quot;rot&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	spawnPlayer(source, x, y, z)&lt;br /&gt;
	fadeCamera(source, true)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Now you may start the gamemode in the server console with the following command:&lt;br /&gt;
&lt;br /&gt;
'''gamemode myserver mymap'''&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
To use the map manager, your resources must first be marked as either gamemodes or maps.&lt;br /&gt;
&lt;br /&gt;
You have to tag the '''gamemode resource''' with the correct type in its info tag:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;info description=&amp;quot;A gamemode&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Map resources''' also need the ''type=&amp;quot;map&amp;quot;'' tag, plus a ''gamemodes'' tag listing the gamemode resources they're compatible with in a comma-separated list ''without spaces''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;info description=&amp;quot;A gamemode map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;ctv,koth&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There can be only one gamemode and one gamemode map loaded at once.&lt;br /&gt;
&lt;br /&gt;
==Optional resource attributes==&lt;br /&gt;
These attributes all go in the corresponding resource's info tag.&lt;br /&gt;
&lt;br /&gt;
'''name:''' A friendly name for your gamemode or map, to be displayed in the start messages or map listings instead of the filename.&lt;br /&gt;
&lt;br /&gt;
==Commands==&lt;br /&gt;
'''changemap newmap [newgamemode]''' (changes the gamemode map to a new one, optionally changing the gamemode as well)&lt;br /&gt;
&lt;br /&gt;
'''changemode newgamemode [newmap]''' (changes to a new gamemode, optionally starting a map with it)&lt;br /&gt;
&lt;br /&gt;
'''gamemode newgamemode [newmap]''' (same as previous one)&lt;br /&gt;
&lt;br /&gt;
'''stopmode''' (stops the current mode and mode map)&lt;br /&gt;
&lt;br /&gt;
'''stopmap''' (stops the current mode map)&lt;br /&gt;
&lt;br /&gt;
'''maps [gamemode]''' (lists all maps in the server, optionally all maps compatible with a gamemode)&lt;br /&gt;
&lt;br /&gt;
'''gamemodes''' (lists all gamemodes)&lt;br /&gt;
&lt;br /&gt;
==Settings==&lt;br /&gt;
'''*mapmanager.color''' [hex color string] (changes the mapmanager's output messages' color) (default: #E1AA5A)&lt;br /&gt;
&lt;br /&gt;
'''*mapmanager.messages''' [boolean] (whether map/gm changes are enabled) (default: true)&lt;br /&gt;
&lt;br /&gt;
'''*mapmanager.ASE''' [boolean] (whether the manager will set ASE gametype / mapname) (default: true)&lt;br /&gt;
&lt;br /&gt;
==Exported functions==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool changeGamemode ( resource newGamemode, [ resource mapToLoadWith ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Changes the gamemode to a new one, optionally specifying an initial map for it (will load without a map by default).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool changeGamemodeMap ( resource newMap, [ resource gamemodeToChangeTo ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Changes the GM map to a new one, optionally specifying a gamemode to change to before loading it (will load with the current gamemode by default).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getGamemodes ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Returns a table of all gamemode resource pointers.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getGamemodesCompatibleWithMap ( resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Returns a table of compatible gamemode resource pointers.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getMaps ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Returns a table of all map resource pointers.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Returns a table of compatible map resource pointers. If the gamemode is left blank, it returns all maps which aren't compatible with any gamemode.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;resource getRunningGamemode ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Returns the currently running gamemode's resource pointer.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;resource getRunningGamemodeMap ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Returns the currently running GM map's resource pointer.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isGamemode ( resource theGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Determines if a resource is a gamemode or not.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isGamemodeCompatibleWithMap ( resource theGamemode, resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Determines if a gamemode is compatible with a map or not.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMap ( resource theMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Determines if a resource is a map or not.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMapCompatibleWithGamemode ( resource theMap, resource theGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Determines if a map is compatible with a gamemode or not.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool stopGamemode ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Stops the current gamemode and its map.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool stopGamemodeMap ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Stop the current GM map.&lt;br /&gt;
Determines if a map is compatible with a gamemode or not.&lt;br /&gt;
&lt;br /&gt;
==Fired events==&lt;br /&gt;
''(For all these events, &amp;quot;source&amp;quot; is the resource's root element.)''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeStart ( resource startedGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Fired before a gamemode starts.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeStop ( resource stoppedGamemode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Fired before a gamemode is stopped.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeMapStart ( resource startedMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Fired before a GM map starts.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;onGamemodeMapStop ( resource stoppedMap )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Fired before a GM map is stopped.&lt;br /&gt;
&lt;br /&gt;
==Supported map settings==&lt;br /&gt;
The following settings from the [[settings system|registry]] are applied by the map manager when a map is started:&lt;br /&gt;
&amp;lt;br&amp;gt;'''gamespeed''' [number]: The map's game speed.&lt;br /&gt;
&amp;lt;br&amp;gt;'''gravity''' [number]: The map's gravity.&lt;br /&gt;
&amp;lt;br&amp;gt;'''time''' [string of the form '''hh:mm''']: The map's time.&lt;br /&gt;
&amp;lt;br&amp;gt;'''weather''' [number]: The map's weather ID.&lt;br /&gt;
&amp;lt;br&amp;gt;'''waveheight''' [number]: The map's wave height.&lt;br /&gt;
&amp;lt;br&amp;gt;'''locked_time''' [boolean]: Whether the set time will be frozen by the manager or not.&lt;br /&gt;
&amp;lt;br&amp;gt;'''minplayers''' [number]: The required minimum number of players to start the map.&lt;br /&gt;
&amp;lt;br&amp;gt;'''maxplayers''' [number]: The allowed maximum number of players to start the map.&lt;br /&gt;
&lt;br /&gt;
[[it:Map manager]]&lt;br /&gt;
[[ru:Resource:Mapmanager]]&lt;/div&gt;</summary>
		<author><name>MrX</name></author>
	</entry>
</feed>