https://wiki.multitheftauto.com/api.php?action=feedcontributions&user=LordAzamath&feedformat=atomMulti Theft Auto: Wiki - User contributions [en]2024-03-29T00:25:03ZUser contributionsMediaWiki 1.39.3https://wiki.multitheftauto.com/index.php?title=GetVehiclePaintjob&diff=21819GetVehiclePaintjob2009-10-29T16:50:43Z<p>LordAzamath: </p>
<hr />
<div>{{Server client function}}<br />
__NOTOC__<br />
This function gets the current paintjob on the specified vehicle. <br /><br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">int getVehiclePaintjob ( vehicle theVehicle )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''theVehicle''': The [[vehicle]] you wish to get the paintjob of.<br />
<br />
==Returns==<br />
Returns an integer representing the current paintjob on the vehicle. <br /><br />
* '''0''': The first paintjob<br />
* '''1''': The second paintjob<br />
* '''2''': The third paintjob<br />
* '''3''': Default paintjob (no paintjob)<br />
Note: Always returns 3 if paintjobs are not supported for the vehicle.<br />
<br />
==Example==<br />
This example will set the paintjob of a new sultan to '2', then check it was set.<br />
<syntaxhighlight lang="lua"><br />
newvehicle = createVehicle ( 560, 100, 100, 40 ) -- create the sultan<br />
setVehiclePaintjob ( newvehicle, 2 ) -- change the paintjob<br />
paintjob = getVehiclePaintjob ( newvehicle )<br />
if ( paintjob == 2 ) then<br />
outputChatBox ( "the paintjob was successfully set" )<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Vehicle functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Help:Main_Page&diff=20325Help:Main Page2009-07-04T08:10:03Z<p>LordAzamath: </p>
<hr />
<div>Can you please add a link to the Italian main page(<nowiki>[[it:Pagina principale]]</nowiki>)? Thanks.<br/><span style="font-family:Courier New, Courier, monospace">[[User:Shadd|Shadd]]</span><sub>([[User_talk:Shadd|Сто?]])</sub> 11:49, 25 January 2008 (CST)<br />
:Done :) Keep up the good work! [[User:EAi|eAi]] 20:06, 25 January 2008 (CST)<br />
<br />
The Dutch one too please (<nowiki>[[nl:Main Page]]</nowiki>)? :P<br />
:Done :) [[User:EAi|eAi]] 11:24, 26 January 2008 (CST)<br />
<br />
<br/><br />
http://development.mtasa.com/index.php?title=Vehicle_Upgrades<br />
There is no link in 'Vehicle Upgrades' in the 'ID list'. I already knew that there is this page, but unfortunately we can't modify this page... :( <br/> [[User:Atti|Atti]] 03:29, 27 January 2008 (CST)<br />
<br />
Please add a Link to the German Translation. (DE/Hauptseite)<br />
<br />
Same [[Introduction to Scripting the GUI|page]] is linked twice in the 'Getting started' section ('Introduction to Scripting the GUI' and 'Scripted GUI'). [[User:Awwu|Awwu]] 05:03, 25 May 2008 (CDT)<br />
<br />
== Request ==<br />
<br />
I have a request for the italian wiki: it's possible to do that the functions in the code tag that are in the italian pages link to the italian pages of the functions, and not to the english one? Can you create, if in need, a namespace for the italian(and other langueges of course)wiki?<br />
Example:<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onGamemodeMapStart", g_root, loadMap)<br />
</syntaxhighlight><br />
If you click on the function name you'll get the addEventHandler page, I want that if I click on it in the italian wiki i can go to IT/addEventHandler instead of addEventHandler. Thanks. --<span style="font-family:Courier New, Courier, monospace">[[User:Shadd|Shadd]]</span><sub>([[User_talk:Shadd|In caso di emergenza rompere le scatole]])</sub> 06:51, 5 June 2008 (CDT)<br />
<br />
== Double link ==<br />
<br />
Links to [[Introduction to Scripting the GUI]] and [[Scripted GUI]] redirect to one page. -- [[User:Divine|Divine]] 04:27, 15 June 2008 (CDT)<br />
<br />
== Problem ==<br />
<br />
Guys i get a '''problem''' . I cant get the activation link from the www.mtasa.com . I waited 2 weeks for it.<br />
:Wiki isn't a discussion forum. Go to [http://forum.multitheftauto.com/ MTA forums] or to [irc://irc.gtanet.com/mta IRC] and ask about your problems there.<br />
----<br />
First thing is that ”Introduction to Scripting the GUI“ and ”Scripted GUI“ lead to the same page.<br />
Second thing is a question: Would you be so kind and add a link to the useful functions page/category?<br />
Third thing is mainly for making them three but: The screenshot of the script part looks not very good. I would either remove it or replace it with a new one. :P<br />
[[User:NeonBlack|NeonBlack]] 00:23, 4 July 2009 (CEST)<br />
If we already go into nitpicking mode, Lua should be preferred over LUA (http://www.lua.org/about.html last paragraph) ;) [[User:LordAzamath|LordAzamath]] 10:10, 4 July 2009 (CEST)</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Template_talk:Useful_Function&diff=20324Template talk:Useful Function2009-07-04T08:05:57Z<p>LordAzamath: Lowercased links</p>
<hr />
<div>I'd rather have lowercasetitle and edit the useful functions to correspond to that. Better style imo. [[User:LordAzamath|LordAzamath]] 10:05, 4 July 2009 (CEST)</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=User:LordAzamath&diff=20311User:LordAzamath2009-07-01T12:14:45Z<p>LordAzamath: </p>
<hr />
<div>Todo list about MTA:<br />
* Complete and release Shooting Range (1.0)<br />
* Write Chess (1.0, a bit more tricky one, but should keep me busy)* <br />
* Write other minigames (1.0 mainly)<br />
* Make a Security camera system (1.0) WIP<br />
* <strike>Complete HQInteriors (dp2.3 and 1.0)</strike><br />
** <strike>Poke Kasimir to get his maps working</strike> His maps are fail anyway<br />
** Map a cock shaped bunker for Willy (WIP)<br />
* <strike>Make lots of RvB maps</strike><br />
** <strike>Update rvb_Airstrike</strike><br />
* YAPR - Yet Another Property Resource (WIP)<br />
** Vehicle Shops<br />
** Real Estate<br />
** Shops<br />
* <strike>YAML - Yet Another Menu Manager :D </strike><br />
** <strike>Resource manager (not resourcemanager)</strike><br />
** Vehicle manager<br />
** Client manager<br />
** Ped manager<br />
** ACL manager<br />
** Messaging<br />
** Admin manager (If others get a good response, I'll start working on it. Don't expect another admin resource tho :D)<br />
* Add more items here</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=User:LordAzamath&diff=20301User:LordAzamath2009-06-30T21:18:23Z<p>LordAzamath: /*TODO*/</p>
<hr />
<div>Todo list about MTA:<br />
* Complete and release Shooting Range (1.0)<br />
* Write Chess (1.0, a bit more tricky one, but should keep me busy)* <br />
* Write other minigames (1.0 mainly)<br />
* Make a Security camera system (1.0) WIP<br />
* <strike>Complete HQInteriors (dp2.3 and 1.0)</strike><br />
** <strike>Poke Kasimir to get his maps working</strike> His maps are fail anyway<br />
** Map a cock shaped bunker for Willy (WIP)<br />
* <strike>Make lots of RvB maps</strike><br />
** <strike>Update rvb_Airstrike</strike><br />
* YAPR - Yet Another Property Resource (WIP)<br />
** Vehicle Shops<br />
** Real Estate<br />
** Shops<br />
* YARM - Yet Another Rightclick Menu :D (WIP)<br />
** Resource manager (not resourcemanager)<br />
** Vehicle manager<br />
** Client manager<br />
** Ped manager<br />
** ACL manager<br />
** Messaging<br />
** Admin manager (If others get a good response, I'll start working on it. Don't expect another admin resource tho :D)<br />
* Add more items here</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=GetElementModel&diff=20297GetElementModel2009-06-29T11:53:12Z<p>LordAzamath: Specified return</p>
<hr />
<div>__NOTOC__<br />
{{Server client function}}<br />
<br />
Returns the model ID of a given element. This can be a player/ped skin, a pickup model, an object model or a vehicle model.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
int getElementModel ( element theElement )<br />
</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''theElement:''' the element to retrieve the model ID of.<br />
<br />
===Returns===<br />
Returns the model ID if successful, ''false'' otherwise.<br />
* For players/peds: A GTASA player model (skin) ID. See [[Character Skins]].<br />
* For vehicles: The [[Vehicle IDs|vehicle ID]] of the vehicle.<br />
* For objects: An [[int]] specifying the model id.<br />
<br />
==Example==<br />
<section class="server" name="Example 1 (Server)" show="true"><br />
This example destroys a haystack when a player targets it.<br />
<syntaxhighlight lang="lua"><br />
function onPlayerTargeted ( targetElem )<br />
if ( getElementType ( targetElem ) == "object" ) and ( getElementModel ( targetElem ) == 3374 ) then<br />
destroyElement ( targetElem )<br />
end<br />
end<br />
addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTargeted )<br />
</syntaxhighlight><br />
</section><br />
<section class="server" name="Example 2 (Server)" show="true"><br />
This example prints out a message when a Shamal or AT-400 is entered by a player.<br />
<syntaxhighlight lang="lua"><br />
function planeEnter ( theVehicle, seat, jacked ) -- when someone enters a vehicle<br />
local id = getElementModel ( theVehicle ) -- get the model ID of the vehicle<br />
if id == 519 or id == 577 then -- if theVehicle is either Shamal or AT-400<br />
local vehicleName = getVehicleName ( theVehicle ) -- get the name of theVehicle<br />
outputChatBox ( "Someone stole a " .. vehicleName .. "!" ) -- announce that someone stole the plane<br />
end<br />
end<br />
-- add the event handler to the event<br />
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), planeEnter )<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Element functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=SetElementModel&diff=20296SetElementModel2009-06-29T11:52:00Z<p>LordAzamath: Added specification to model variable</p>
<hr />
<div>__NOTOC__<br />
{{Server client function}}<br />
<br />
Sets the model of a given element. This allows you to change the model of a player (or ped), a vehicle or an object.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool setElementModel ( element theElement, int model )<br />
</syntaxhighlight><br />
<br />
===Required Arguments===<br />
*'''theElement:''' the element you want to change.<br />
*'''model:''' the model ID to set.<br />
** For players/peds: A GTASA player model (skin) ID. See [[Character Skins]].<br />
** For vehicles: The [[Vehicle IDs|vehicle ID]] of the vehicle being changed.<br />
** For objects: An [[int]] specifying the model id.<br />
<br />
===Returns===<br />
Returns ''true'' if successful, ''false'' otherwise.<br />
<br />
==Example==<br />
<section class="server" name="Example 1 (Server)" show="true"><br />
<syntaxhighlight lang="lua"><br />
addCommandHandler ( "changeveh",<br />
function ( thePlayer, command, newModel )<br />
local theVehicle = getPedOccupiedVehicle ( thePlayer ) -- get the vehicle the player is in<br />
newModel = tonumber ( newModel ) -- try to convert the string argument to a number<br />
if theVehicle and newModel then -- make sure the player is in a vehicle and specified a number<br />
setElementModel ( theVehicle, newModel )<br />
end<br />
end<br />
)<br />
</syntaxhighlight><br />
After the above code is executed, a player can get in any vehicle and execute e.g. the command "/changeveh 520" to change it into a hydra.<br />
</section><br />
<section class="server" name="Example 2 (Server)" show="true"><br />
This will continually change an object model every 2.5 seconds at the location -1084.52, -1634.81, 76.36 (Truth's farm).<br />
<syntaxhighlight lang="lua"><br />
myobject = createObject ( 5822, -1084.52, -1634.81, 76.36 )<br />
-- We create an initial object element. I choose object model 5822 to begin with.<br />
<br />
function objectRandomization () <br />
local randomobjectnumber = math.random(1, 18000)<br />
-- Choose a random number between 1 and 18000 as a whole integer and assign it to<br />
-- the variable 'randomobjectnumber'<br />
setElementModel ( myobject, randomobjectnumber )<br />
-- Change our object appearance by applying a new model ID<br />
end<br />
<br />
setTimer ( objectRandomization, 2500, 0 )<br />
-- Every 2.5 seconds, the function 'objectRandomization' is called by this timer.<br />
-- Each time the function runs, it changes the object model by applying a new whole-<br />
-- integer random object ID. This timer is called an infinite amount of times since <br />
-- its repeat value is set to 0.<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Element functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=GetElementDistanceFromCentreOfMassToBaseOfModel&diff=20272GetElementDistanceFromCentreOfMassToBaseOfModel2009-06-28T10:58:56Z<p>LordAzamath: As the function is a client function, changed /* See also */ to client element functions</p>
<hr />
<div>__NOTOC__<br />
{{Client function}}<br />
This function is used to retrieve the distance between a element's centre of mass to the base of the model. This can be used to calculate the position the element has to be set to, to have it on ground level.<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
float getElementDistanceFromCentreOfMassToBaseOfModel ( element theElement )<br />
</syntaxhighlight><br />
===Required Parameters===<br />
'''theElement:''' The element you want to retrieve the value of.<br />
===Returns===<br />
Returns a ''float'' with the distance, or ''false'' if the element is invalid.<br />
==Example==<br />
This example outputs the value for the local player.<br />
<syntaxhighlight lang="lua"><br />
local localPlayer = getLocalPlayer()<br />
local distance = getElementDistanceFromCentreOfMassToBaseOfModel(localPlayer)<br />
outputChatBox(tostring(distance))<br />
</syntaxhighlight><br />
==See Also==<br />
{{Client element functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&diff=20271Template:Useful Functions2009-06-28T10:43:15Z<p>LordAzamath: lowercased links</p>
<hr />
<div>*[[callClientFunction]]<br />
This function allows you to call any clientside function from the server's side.<br />
<br/><br/><br />
<br />
*[[callServerFunction]]<br />
This function allows you to call any server-side function from the client's side.<br />
<br/><br/><br />
<br />
*[[explode]]<br />
This function splits a string at a given separator and returns a table with the pieces.<br />
<br/><br/><br />
<br />
*[[findRotation]]<br />
Takes two points and returns the direction from point A to point B.<br />
<br/><br/><br />
<br />
*[[getPointFromDistanceRotation]]<br />
Finds a point based on a starting point, direction and distance.<br />
<br/><br/><br />
<br />
*[[getTimestamp]]<br />
With this function you can get the [http://en.wikipedia.org/wiki/Unix_time UNIX timestamp].<br />
<br/><br/><br />
<br />
*[[ifElse]]<br />
Returns one of two values based on a boolean expression.<br />
<br/><br/><br />
<br />
*[[isYearALeapYear]]<br />
Checks if the given year is a leap year<br />
<br/><br/><br />
<br />
*[[setTableProtected]]<br />
Protects a table and makes it read-only<br />
<br/><br/><br />
<br />
*[[table.copy]]<br />
This function copies a whole table and all the tables in that table.<br />
<br/><br/><br />
<br />
*[[table.map]]<br />
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.<br />
<br/><br/><br />
<br />
*[[table.size]]<br />
Finds the absolute size of a table.<br />
<br />
<br />
[[Category:Useful Functions]]</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=User:LordAzamath&diff=20216User:LordAzamath2009-06-27T10:13:31Z<p>LordAzamath: </p>
<hr />
<div>Todo list about MTA:<br />
* Complete and release Shooting Range (1.0)<br />
* Write Chess (1.0, a bit more tricky one, but should keep me busy)* <br />
* Write other minigames (1.0 mainly)<br />
* Make a Security camera system (1.0)<br />
* <strike>Complete HQInteriors (dp2.3 and 1.0)</strike><br />
** <strike>Poke Kasimir to get his maps working</strike> His maps are fail anyway<br />
** Map a cock shaped bunker for Willy (WIP)<br />
* <strike>Make lots of RvB maps</strike><br />
** <strike>Update rvb_Airstrike</strike><br />
* YAPR - Yet Another Property Resource<br />
** Vehicle Shops<br />
** Real Estate<br />
** Shops<br />
* Add more items here</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=User:LordAzamath&diff=20215User:LordAzamath2009-06-27T09:51:55Z<p>LordAzamath: </p>
<hr />
<div>Todo list about MTA:<br />
* Complete and release Shooting Range (1.0)<br />
* Write Chess (1.0, a bit more tricky one, but should keep me busy)* <br />
* Write other minigames (1.0 mainly)<br />
* Make a Security camera system (1.0)<br />
* <strike>Complete HQInteriors (dp2.3 and 1.0)</strike><br />
** <strike>Poke Kasimir to get his maps working</strike> His maps are fail anyway<br />
** Map a cock shaped bunker for Willy (WIP)<br />
* <strike>Make lots of RvB maps</strike><br />
** <strike>Update rvb_Airstrike</strike><br />
* YAPS - Yet Another Property Resource<br />
** Vehicle Shops<br />
** Real Estate<br />
** Shops<br />
* Add more items here</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=User:LordAzamath&diff=20214User:LordAzamath2009-06-27T09:49:05Z<p>LordAzamath: </p>
<hr />
<div>Todo list about MTA:<br />
* Complete and release Shooting Range (1.0)<br />
* Complete and release dx Chatbox (1.0)<br />
** Add channel support<br />
** Add color support<br />
* Write Chess (1.0, a bit more tricky one, but should keep me busy)* <br />
* Write other minigames (1.0 mainly)<br />
* Make a Security camera system (1.0)<br />
* <strike>Complete HQInteriors (dp2.3 and 1.0)</strike><br />
** <strike>Poke Kasimir to get his maps working</strike> His maps are fail anyway<br />
** Map a cock shaped bunker for Willy (WIP)<br />
* <strike>Make lots of RvB maps</strike><br />
** <strike>Update rvb_Airstrike</strike><br />
* Add more items here</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=SetTableProtected&diff=19782SetTableProtected2009-06-01T17:50:26Z<p>LordAzamath: setTableProtected - useful function</p>
<hr />
<div>{{Useful Function}}<br />
__NOTOC__<br />
This function sets a table protected from editing, so if you want to define constants that cannot be changed, this would be a way. I found that function from [http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=8028 Internet], by Nick Gammon.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">table setTableProtected( table tbl )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''tbl''': The table, which is to be set protected<br />
<br />
===Returns===<br />
Returns the table which can't be modified anymore<br />
<br />
==Code==<br />
<section name="Server- and/or clientside Script" class="both" show="true"><br />
<syntaxhighlight lang="lua"><br />
function setTableProtected (tbl)<br />
return setmetatable ({}, <br />
{<br />
__index = tbl, -- read access gets original table item<br />
__newindex = function (t, n, v)<br />
error ("attempting to change constant " .. <br />
tostring (n) .. " to " .. tostring (v), 2)<br />
end -- __newindex, error protects from editing<br />
})<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
==Example==<br />
<section name="Server- and/or clientside Script" class="both" show="true"><br />
This example shows the above function in work.<br />
<syntaxhighlight lang="lua">my_constants =<br />
{<br />
WIDTH = 22,<br />
HEIGHT = 44,<br />
FOO = "bar",<br />
}<br />
<br />
-- protect my table now<br />
my_constants = protect_table (my_constants) -- it's important to redeclare that variable what you want to protect, since you could still modify the original table.<br />
my_constants.WIDTH = 11<br />
my_constants.HEIGHT = 11<br />
-- These will return errors, because _newindex always returns error for that table<br />
-- test it<br />
print ("WIDTH", my_constants.WIDTH) --> WIDTH 22 -- and these remain unchanged<br />
print ("HEIGHT", my_constants.HEIGHT) --> HEIGHT 44<br />
<br />
</syntaxhighlight><br />
</section><br />
<br />
Author: Nick Gammon, commented a bit and found from Internets - Lordy<br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=User:LordAzamath&diff=19658User:LordAzamath2009-05-19T15:49:35Z<p>LordAzamath: scraped thongs</p>
<hr />
<div>Todo list about MTA:<br />
* Complete and release Shooting Range (1.0)<br />
* Complete and release dx Chatbox (1.0)<br />
** Add channel support<br />
** Add color support<br />
* Write Chess (1.0, a bit more tricky one, but should keep me busy)* <br />
* Write other minigames (1.0 mainly)<br />
* Make a Security camera system (1.0)<br />
* <strike>Complete HQInteriors (dp2.3 and 1.0)</strike><br />
** Poke Kasimir to get his maps working<br />
** Map a cock shaped bunker for Willy (WIP)<br />
* Make lots of RvB maps<br />
** Update rvb_Airstrike<br />
* Add more items here</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnPedWasted&diff=19609OnPedWasted2009-05-16T13:30:36Z<p>LordAzamath: added code tag start to syntax</p>
<hr />
<div>__NOTOC__ <br />
{{Server event}}<br />
This event is triggered when a ped is killed or dies.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua">int totalAmmo, element killer, int killerWeapon, int bodypart [, bool stealth ]<br />
</syntaxhighlight><br />
<br />
*'''totalAmmo''': an integer representing the total ammo the victim had when he died.<br />
*'''killer''': an [[element]] representing the player or vehicle who was the killer. If there was no killer this is ''false''.<br />
*'''killerWeapon''': an integer representing the [[weapon]] the killer used to kill the player.<br />
*'''bodypart''': an integer representing the bodypart ID the victim was hit on when he died.<br />
{{BodyParts}}<br />
*'''stealth''': boolean value representing whether or not this was a stealth kill<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[ped]] that died or got killed.</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientChatMessage&diff=19605OnClientChatMessage2009-05-16T10:38:16Z<p>LordAzamath: /* Example */ event is not cancelable - example is wrong</p>
<hr />
<div>{{Client event}}<br />
__NOTOC__ <br />
This event is triggered when any text is output to chatbox, including MTA's hardcoded messages.<br />
<br />
==Parameters== <br />
<syntaxhighlight lang="lua"><br />
string text, int r, int g, int b<br />
</syntaxhighlight><br />
*'''text:''' The text that was output to chatbox<br />
*'''r:''' The amount of red in the color of the text.<br />
*'''g:''' The amount of green in the color of the text.<br />
*'''b:''' The amount of blue in the color of the text.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the root element.<br />
==Example==<br />
This event doesn't have an example added yet<br />
<!--<br />
This example doesn't output anything to chatbox if it consists only of numbers<br />
<syntaxhighlight lang="lua"><br />
[lua]<br />
function onClientChatMessageHandler(text)<br />
if string.match(text,"%d+") --[[string.match searches for pattern "%d+", means decimals]] == text then -- if string.match and text itself are the same<br />
cancelEvent() -- don't output it<br />
end<br />
end<br />
addEventHandler("onClientChatMessage", getRootElement(), onClientChatMessageHandler)<br />
</syntaxhighlight><br />
--><br />
<br />
==See Also==<br />
<br />
===Client other events===<br />
{{Client_other_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientChatMessage&diff=19604OnClientChatMessage2009-05-16T10:33:44Z<p>LordAzamath: /* Example */</p>
<hr />
<div>{{Client event}}<br />
__NOTOC__ <br />
This event is triggered when any text is output to chatbox, including MTA's hardcoded messages.<br />
<br />
==Parameters== <br />
<syntaxhighlight lang="lua"><br />
string text, int r, int g, int b<br />
</syntaxhighlight><br />
*'''text:''' The text that was output to chatbox<br />
*'''r:''' The amount of red in the color of the text.<br />
*'''g:''' The amount of green in the color of the text.<br />
*'''b:''' The amount of blue in the color of the text.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the root element.<br />
==Example==<br />
This example doesn't output anything to chatbox if it consists only of numbers<br />
<syntaxhighlight lang="lua"><br />
[lua]<br />
function onClientChatMessageHandler(text)<br />
if string.match(text,"%d+") --[[string.match searches for pattern "%d+", means decimals]] == text then -- if string.match and text itself are the same<br />
cancelEvent() -- don't output it<br />
end<br />
end<br />
addEventHandler("onClientChatMessage", getRootElement(), onClientChatMessageHandler)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
<br />
===Client other events===<br />
{{Client_other_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientChatMessage&diff=19603OnClientChatMessage2009-05-16T10:32:59Z<p>LordAzamath: /* Example */</p>
<hr />
<div>{{Client event}}<br />
__NOTOC__ <br />
This event is triggered when any text is output to chatbox, including MTA's hardcoded messages.<br />
<br />
==Parameters== <br />
<syntaxhighlight lang="lua"><br />
string text, int r, int g, int b<br />
</syntaxhighlight><br />
*'''text:''' The text that was output to chatbox<br />
*'''r:''' The amount of red in the color of the text.<br />
*'''g:''' The amount of green in the color of the text.<br />
*'''b:''' The amount of blue in the color of the text.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the root element.<br />
==Example==<br />
This example doesn't output anything to chatbox if it consists only of numbers<br />
<syntaxhighlight lang="lua"><br />
[lua]<br />
function onClientChatMessageHandler(text)<br />
if string.match(text,"%d+") --[[string.match searches for pattern "%d+", means decimals]] == text then -- if string.match and text itself are the same<br />
cancelEvent() -- don't output it<br />
end<br />
end<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
<br />
===Client other events===<br />
{{Client_other_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Talk:CallServerFunction&diff=19602Talk:CallServerFunction2009-05-16T06:20:28Z<p>LordAzamath: </p>
<hr />
<div>I would rather use this variant for both calling client and server functions..<br />
<br />
<syntaxhighlight lang="lua"><br />
[lua]<br />
-- client side<br />
addEvent("onServerRequest", true)<br />
addEventHandler("onServerRequest", rootElement,<br />
function (funcname, ...)<br />
_G[funcname](...)<br />
end<br />
)<br />
-- server side<br />
addEvent("onClientRequest", true)<br />
addEventHandler("onClientRequest", rootElement,<br />
function (funcname, ...)<br />
_G[funcname](...)<br />
end<br />
)<br />
-- @see down below for this<br />
--and call them like<br />
-- triggerServerEvent("onClientRequest", rootElement, "changeResStateS", resource, state)<br />
-- while I have defined a function changeResStateS(resource, state) end on server side and vice versa.<br />
</syntaxhighlight><br />
[[User:LordAzamath|LordAzamath]] 19:47, 14 May 2009 (CEST)<br />
----<br />
Yeah, nice idea to save some space except for the trigger-Event solution. CallClient/ServerFunction should enshorten this. [[User:NeonBlack|NeonBlack]] 20:23, 15 May 2009 (CEST)<br /><br />
By the way: I think the yellow note isn't needed since there is no way hacking mta to call some function. To get the possibility for calling functions the scripter needs adding this possibility manually. So this note would be just as well be added to banPlayer. [[User:NeonBlack|NeonBlack]] 20:37, 15 May 2009 (CEST)<br />
: In that case the triggerEvent part should be replaced with<br />
<syntaxhighlight lang="lua"><br />
[lua]<br />
function callServerFunction(functionName, ...)<br />
return triggerServerEvent("onClientRequest", rootElement, functionName, ...)<br />
end<br />
-- and<br />
function callClientFunction( player, functionName, ...)<br />
if getElementType(player) = "player" then<br />
return triggerClientEvent(player, "onClientRequest", rootElement, functionName, ...)<br />
else -- while here player will actually be the function name and functionName the first argument given actually<br />
return triggerClientEvent("onClientRequest", rootElement, player, functionName, ...)<br />
end<br />
end<br />
</syntaxhighlight><br />
[[User:LordAzamath|LordAzamath]] 08:20, 16 May 2009 (CEST)</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Talk:CallServerFunction&diff=19601Talk:CallServerFunction2009-05-16T06:20:02Z<p>LordAzamath: </p>
<hr />
<div>I would rather use this variant for both calling client and server functions..<br />
<br />
<syntaxhighlight lang="lua"><br />
[lua]<br />
-- client side<br />
addEvent("onServerRequest", true)<br />
addEventHandler("onServerRequest", rootElement,<br />
function (funcname, ...)<br />
_G[funcname](...)<br />
end<br />
)<br />
-- server side<br />
addEvent("onClientRequest", true)<br />
addEventHandler("onClientRequest", rootElement,<br />
function (funcname, ...)<br />
_G[funcname](...)<br />
end<br />
)<br />
-- @see down below for this<br />
--and call them like<br />
-- triggerServerEvent("onClientRequest", rootElement, "changeResStateS", resource, state)<br />
-- while I have defined a function changeResStateS(resource, state) end on server side and vice versa.<br />
</syntaxhighlight><br />
[[User:LordAzamath|LordAzamath]] 19:47, 14 May 2009 (CEST)<br />
----<br />
Yeah, nice idea to save some space except for the trigger-Event solution. CallClient/ServerFunction should enshorten this. [[User:NeonBlack|NeonBlack]] 20:23, 15 May 2009 (CEST)<br /><br />
By the way: I think the yellow note isn't needed since there is no way hacking mta to call some function. To get the possibility for calling functions the scripter needs adding this possibility manually. So this note would be just as well be added to banPlayer. [[User:NeonBlack|NeonBlack]] 20:37, 15 May 2009 (CEST)<br />
: In that case the triggerEvent part should be replaced with<br />
<syntaxhighlight lang="lua"><br />
[lua]<br />
function callServerFunction(functionName, ...)<br />
return triggerServerEvent("onClientRequest", rootElement, functionName, ...)<br />
end<br />
-- and<br />
function callClientFunction([ player], functionName, ...)<br />
if getElementType(player) = "player" then<br />
return triggerClientEvent(player, "onClientRequest", rootElement, functionName, ...)<br />
else -- while here player will actually be the function name and functionName the first argument given actually<br />
return triggerClientEvent("onClientRequest", rootElement, player, functionName, ...)<br />
end<br />
end<br />
</syntaxhighlight><br />
[[User:LordAzamath|LordAzamath]] 08:20, 16 May 2009 (CEST)</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=RemoveEventHandler&diff=19583RemoveEventHandler2009-05-15T09:02:40Z<p>LordAzamath: /* Example */</p>
<hr />
<div>__NOTOC__ <br />
{{Server client function}}<br />
This functions removes a handler function from an [[event]], so that the function is not called anymore when the event is triggered. See [[event system]] for more information on how the event system works.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool removeEventHandler ( string eventName, element attachedTo, function functionVar ) <br />
</syntaxhighlight> <br />
<br />
===Required Arguments=== <br />
*'''eventName:''' The name of the [[event]] you want to detach the handler function from.<br />
*'''attachedTo:''' The [[element]] the handler was attached to.<br />
*'''functionVar:''' The handler function that was attached.<br />
<br />
===Returns===<br />
Returns ''true'' if the event handler was removed successfully. Returns ''false'' if the specified event handler could not be found or invalid parameters were passed.<br />
<br />
==Example==<br />
This example shows how to toggle a message on/off a screen with a command.<br />
<syntaxhighlight lang="lua"><br />
<br />
function drawText() -- A function to draw the text we want<br />
dxDrawText(text, 10,100) -- creates a dx text 10 pixels from left, 100 from top of the screen<br />
end<br />
function doText(command, ...)<br />
if command == "starttext" then -- if player wrote /starttext<br />
text = table.concat({...}," ") -- then we retrieve the text<br />
func = addEventHandler -- and since addEventHandler and removeEventHandler's syntax is the same, we just define the function we use later<br />
elseif command == "stoptext" then<br />
func = removeEventHandler -- this time we use removeEventHandler<br />
end<br />
func("onClientRender", getRootElement(),drawText) -- and varying on which one we chose up, we either add an event handler to show the text or remove it to stop drawing dx text.<br />
end<br />
addCommandHandler("starttext", doText) -- add two command handlers to doText function<br />
addCommandHandler("stoptext", doText)<br />
<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=DxDrawLine3D&diff=19582DxDrawLine3D2009-05-15T08:50:16Z<p>LordAzamath: /* Example */ Moved even handler out of the createLine to avoid adding event handlers each frame</p>
<hr />
<div>__NOTOC__ <br />
{{Client function}} <br />
This function draws a 3D line between two points in the 3D world - rendered for '''one''' frame. This should be used in conjunction with [[onClientRender]] in order to display continuously.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool dxDrawLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ, int color[, int width, bool postGUI,float zBuffer ] )<br />
</syntaxhighlight><br />
<br />
===Required Arguments=== <br />
* '''startX:''' The start X position of the 3D line, representing a coordinate in the GTA world.<br />
* '''startY:''' The start Y position of the 3D line, representing a coordinate in the GTA world.<br />
* '''startZ:''' The start Z position of the 3D line, representing a coordinate in the GTA world.<br />
* '''endX:''' The end X position of the 3D line, representing a coordinate in the GTA world.<br />
* '''endY:''' The end Y position of the 3D line, representing a coordinate in the GTA world.<br />
* '''endZ:''' The end Z position of the 3D line, representing a coordinate in the GTA world.<br />
* '''color:''' An integer of the hex color, produced using [[tocolor]].<br />
<br />
==Optional Arguments==<br />
{{OptionalArg}}<br />
* '''width:''' The width/thickness of the line<br />
* '''postGUI:''' A bool representing whether the line should be drawn on top of or behind any ingame GUI (rendered by CEGUI).<br />
* '''zBuffer:''' A float of the ordering in the 3D world, where a high value is likely to appear behind a 3D object, and a low value is likely to always appear in front.<br />
<br />
===Returns===<br />
Returns a ''true'' if the operation was successful, ''false'' otherwise.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This is a small example of creating 3D Line / "Rope" between vehicle and player.<br />
<syntaxhighlight lang="lua"><br />
testVehicle = createVehicle ( 411, 0, 0, 5 ) -- Create our test vehicle.<br />
function makeLineAppear()<br />
addEventHandler("onClientRender",getRootElement(), createLine) -- onClientRender keeps the 3D Line visible.<br />
end<br />
function createLine ( )<br />
x1, y1, z1 = getElementPosition ( testVehicle ) -- Get test vehicles position.<br />
x2, y2, z2 = getElementPosition ( getLocalPlayer ()) -- Get local players position.<br />
dxDrawLine3D ( x1, y1, z1, x2, y2, z2, tocolor ( 0, 255, 0, 230 ), 2) -- Create 3D Line between test vehicle and local player.<br />
end<br />
addCommandHandler("test", makeLineAppear)<br />
</syntaxhighlight><br />
<br />
</section><br />
<br />
==See Also==<br />
{{Drawing_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Talk:CallServerFunction&diff=19580Talk:CallServerFunction2009-05-14T17:47:36Z<p>LordAzamath: An inmproved one discussion</p>
<hr />
<div>I would rather use this variant for both calling client and server functions..<br />
<br />
<syntaxhighlight lang="lua"><br />
[lua]<br />
-- client side<br />
addEvent("onServerRequest", true)<br />
addEventHandler("onServerRequest", rootElement,<br />
function (funcname, ...)<br />
_G[funcname](...)<br />
end<br />
)<br />
-- server side<br />
addEvent("onClientRequest", true)<br />
addEventHandler("onClientRequest", rootElement,<br />
function (funcname, ...)<br />
_G[funcname](...)<br />
end<br />
)<br />
-- and call them like<br />
triggerServerEvent("onClientRequest", rootElement, "changeResStateS", resource, state)<br />
-- while I have defined a function changeResStateS(resource, state) end on server side and vice versa.<br />
</syntaxhighlight><br />
[[User:LordAzamath|LordAzamath]] 19:47, 14 May 2009 (CEST)</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=User:LordAzamath&diff=19416User:LordAzamath2009-05-05T17:27:46Z<p>LordAzamath: </p>
<hr />
<div>Todo list about MTA:<br />
* Complete and release Shooting Range (1.0)<br />
* Complete and release Cinematics (1.0)<br />
** Needs adding ped/time/event<br />
* Rewrite Menu Core (with Right Click Menus, current one is good, but not good enough) (1.0)<br />
* Maybe revisit a Real Estate system (1.0)<br />
* Rewrite cookiesys(with customisable binds for example)(1.0 and dp2.3)<br />
* Complete and release dx Chatbox (1.0)<br />
** Add channel support<br />
** Add color support<br />
* Write dx gui helper core (1.0 making buttons which work etc.)<br />
* Write Chess (1.0, a bit more tricky one, but should keep me busy)* <br />
* Write other minigames (1.0 mainly)<br />
* Make a Security camera system (1.0)<br />
* Rewrite and release mines and SAM sites (dp2.3 and 1.0)<br />
* <strike>Complete HQInteriors (dp2.3 and 1.0)</strike><br />
** Poke Kasimir to get his maps working<br />
** Map a cock shaped bunker for Willy (WIP)<br />
* Make lots of RvB maps<br />
** Update rvb_Airstrike<br />
* Add more items here<br />
* <strike>Go to school today</strike></div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=User:LordAzamath&diff=19413User:LordAzamath2009-05-05T04:44:36Z<p>LordAzamath: I IS</p>
<hr />
<div>Todo list about MTA:<br />
* Complete and release Shooting Range (1.0)<br />
* Complete and release Cinematics (1.0)<br />
** Needs adding ped/time/event<br />
* Rewrite Menu Core (with Right Click Menus, current one is good, but not good enough) (1.0)<br />
* Maybe revisit a Real Estate system (1.0)<br />
* Rewrite cookiesys(with customisable binds for example)(1.0 and dp2.3)<br />
* Complete and release dx Chatbox (1.0)<br />
** Add channel support<br />
** Add color support<br />
* Write dx gui helper core (1.0 making buttons which work etc.)<br />
* Write Chess (1.0, a bit more tricky one, but should keep me busy)* <br />
* Write other minigames (1.0 mainly)<br />
* Make a Security camera system (1.0)<br />
* Rewrite and release mines and SAM sites (dp2.3 and 1.0)<br />
* Complete HQInteriors (dp2.3 and 1.0)<br />
* Map a cock shaped bunker for Willy<br />
* Add more items here<br />
* <strike>Go to school today</strike></div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientPlayerWeaponFire&diff=19379OnClientPlayerWeaponFire2009-05-02T15:10:55Z<p>LordAzamath: Added deprecated note</p>
<hr />
<div>{{Client event}}<br />
{{deprecated}}<br />
__NOTOC__ <br />
This event is called when player shoots a weapon. This does not trigger for projectiles based, or melee weapons. Also note that this event is only triggered for players nearby the local player's camera. This is due to elements far away being streamed out.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
int weapon, int ammo, int ammoInClip, float hitX, float hitY, float hitZ, element hitElement<br />
</syntaxhighlight> <br />
*'''weapon''': an [[int]] representing [[weapons|weapon]] used for making a shot.<br />
*'''ammo''': an [[int]] ammount of ammo left for this weapon type.<br />
*'''ammoInClip''': an [[int]] ammount of ammo left for this weapon type in clip.<br />
*'''hitX''', '''hitY''', '''hitZ''': [[float]] world coordinates representing a hit point.<br />
*'''hitElement''': an [[element]] which was hit by a shot.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the player who fired the weapon.<br />
<br />
==Example== <br />
This example sends a warning to the local player if they shoot another player with a minigun.<br />
<syntaxhighlight lang="lua"><br />
--First, we create a function for the event handler to use.<br />
function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )<br />
if weapon == 38 and getElementType(hitElement)=="player" then -- If the player shoots with a minigun, and hits another player...<br />
outputChatBox ( "Don't kill people with minigun, it's lame!", 255, 0, 0 ) -- We output a warning to him.<br />
end<br />
end<br />
-- Add this as a handler so that the function will be triggered every time the local player fires.<br />
addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc )<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
===Client player events===<br />
{{Client_player_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientPedWeaponFire&diff=19378OnClientPedWeaponFire2009-05-02T15:10:20Z<p>LordAzamath: onClientPedWeaponFire</p>
<hr />
<div>{{Client event}}<br />
__NOTOC__ <br />
This event is called when ped shoots a weapon. This does not trigger for projectiles based, or melee weapons. Also note that this event is only triggered for peds nearby the local player's camera. This is due to elements far away being streamed out.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
int weapon, int ammo, int ammoInClip, float hitX, float hitY, float hitZ, element hitElement<br />
</syntaxhighlight> <br />
*'''weapon''': an [[int]] representing [[weapons|weapon]] used for making a shot.<br />
*'''ammo''': an [[int]] ammount of ammo left for this weapon type.<br />
*'''ammoInClip''': an [[int]] ammount of ammo left for this weapon type in clip.<br />
*'''hitX''', '''hitY''', '''hitZ''': [[float]] world coordinates representing a hit point.<br />
*'''hitElement''': an [[element]] which was hit by a shot.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[ped]] who fired the weapon.<br />
<br />
==Example== <br />
<br />
==See Also==<br />
===Client ped events===<br />
{{Client_ped_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientPlayerWasted&diff=19377OnClientPlayerWasted2009-05-02T15:08:56Z<p>LordAzamath: Added deprecated note</p>
<hr />
<div>__NOTOC__<br />
{{Client event}}<br />
{{deprecated}}<br />
This event is triggered whenever a player, including those remote, dies.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
element killer, int weapon, int bodypart<br />
</syntaxhighlight> <br />
<br />
*'''killer''': A [[player]] [[element]] representing the killer.<br />
*'''weapon''': An integer representing the weapon ID the killer used<br />
*'''bodypart''': An integer representing the bodypart the player was damaged<br />
{{BodyParts}}<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[player]] that died.<br />
<br />
==Example== <br />
This example outputs a mocking message when the local player dies.<br />
<syntaxhighlight lang="lua"><br />
messages = { <br />
"Better luck next time",<br />
"Don't think you're so cool now, do you?",<br />
"Nice one, pal",<br />
"Your opinion is void" <br />
}<br />
<br />
function wastedMessage ( killer, weapon, bodypart )<br />
local randomID = math.random ( 1, #messages ) --get a random ID from the table<br />
local randomMessage = messages[randomID] --use that to retrieve a message<br />
outputChatBox ( randomMessage, 255, 0, 0 ) --output the message<br />
end<br />
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), wastedMessage ) --add an event for the local player only<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
===Client player events===<br />
{{Client_player_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientPedWasted&diff=19376OnClientPedWasted2009-05-02T15:08:31Z<p>LordAzamath: onClientPedWasted</p>
<hr />
<div>__NOTOC__<br />
{{Client event}}<br />
This event is triggered whenever a ped, including those remote, dies.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
element killer, int weapon, int bodypart<br />
</syntaxhighlight> <br />
<br />
*'''killer''': A [[player]] [[element]] representing the killer.<br />
*'''weapon''': An integer representing the weapon ID the killer used<br />
*'''bodypart''': An integer representing the bodypart the player was damaged<br />
{{BodyParts}}<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[ped]] that died.<br />
<br />
==Example== <br />
<br />
==See Also==<br />
===Client ped events===<br />
{{Client_ped_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientPlayerDamage&diff=19375OnClientPlayerDamage2009-05-02T15:06:32Z<p>LordAzamath: Added deprecated note</p>
<hr />
<div>__NOTOC__<br />
{{Client event}}<br />
{{deprecated}}<br />
This event is triggered whenever a player is damaged.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
element attacker, int weapon, int bodypart [, float loss ]<br />
</syntaxhighlight> <br />
<br />
*'''attacker''': A [[player]] [[element]] representing the attacker or [[vehicle]] [[element]] (when you fall of a bike).<br />
*'''weapon''': An integer representing the weapon ID the attacker used<br />
*'''bodypart''': An integer representing the bodypart the player was damaged<br />
{{BodyParts}}<br />
*'''loss''': A float representing the percentage of health the player lost. ('''from DP3''')<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[player]] that got damaged<br />
<br />
==Cancel effect==<br />
If this event is [[Event system#Canceling|canceled]], then any damaging effects to the local player will cease.<br />
<br />
==Example== <br />
This example prevents any damage from the minigun.<br />
<syntaxhighlight lang="lua"><br />
function stopMinigunDamage ( attacker, weapon, bodypart )<br />
if ( weapon == 38 ) then --if the weapon used was the minigun<br />
cancelEvent() --cancel the event<br />
end<br />
end<br />
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage )<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
===Client player events===<br />
{{Client_player_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientPedDamage&diff=19374OnClientPedDamage2009-05-02T15:05:53Z<p>LordAzamath: onClientPedDamage</p>
<hr />
<div>__NOTOC__<br />
{{Client event}}<br />
This event is triggered whenever a [[ped]] is damaged.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
element attacker, int weapon, int bodypart [, float loss ]<br />
</syntaxhighlight> <br />
<br />
*'''attacker''': A [[player]] [[element]] representing the attacker or [[vehicle]] [[element]] (when a ped falls of a bike).<br />
*'''weapon''': An integer representing the weapon ID the attacker used<br />
*'''bodypart''': An integer representing the bodypart the ped was damaged<br />
{{BodyParts}}<br />
*'''loss''': A float representing the percentage of health the ped lost.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[ped]] that got damaged<br />
<br />
==Cancel effect==<br />
If this event is [[Event system#Canceling|canceled]], then any damaging effects to the ped will cease.<br />
<br />
==Example== <br />
<br />
<br />
==See Also==<br />
===Client ped events===<br />
{{Client_ped_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientPlayerDamage&diff=19373OnClientPlayerDamage2009-05-02T15:05:13Z<p>LordAzamath: Undo revision 19372 by LordAzamath (Talk) edited wrong page</p>
<hr />
<div>__NOTOC__<br />
{{Client event}}<br />
This event is triggered whenever a player is damaged.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
element attacker, int weapon, int bodypart [, float loss ]<br />
</syntaxhighlight> <br />
<br />
*'''attacker''': A [[player]] [[element]] representing the attacker or [[vehicle]] [[element]] (when you fall of a bike).<br />
*'''weapon''': An integer representing the weapon ID the attacker used<br />
*'''bodypart''': An integer representing the bodypart the player was damaged<br />
{{BodyParts}}<br />
*'''loss''': A float representing the percentage of health the player lost. ('''from DP3''')<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[player]] that got damaged<br />
<br />
==Cancel effect==<br />
If this event is [[Event system#Canceling|canceled]], then any damaging effects to the local player will cease.<br />
<br />
==Example== <br />
This example prevents any damage from the minigun.<br />
<syntaxhighlight lang="lua"><br />
function stopMinigunDamage ( attacker, weapon, bodypart )<br />
if ( weapon == 38 ) then --if the weapon used was the minigun<br />
cancelEvent() --cancel the event<br />
end<br />
end<br />
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage )<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
===Client player events===<br />
{{Client_player_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientPlayerDamage&diff=19372OnClientPlayerDamage2009-05-02T15:03:36Z<p>LordAzamath: onClientPedDamage</p>
<hr />
<div>__NOTOC__<br />
{{Client event}}<br />
This event is triggered whenever a [[ped]] is damaged.<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
element attacker, int weapon, int bodypart [, float loss ]<br />
</syntaxhighlight> <br />
<br />
*'''attacker''': A [[player]] [[element]] representing the attacker or [[vehicle]] [[element]] (when a ped falls of a bike).<br />
*'''weapon''': An integer representing the weapon ID the attacker used<br />
*'''bodypart''': An integer representing the bodypart the ped was damaged<br />
{{BodyParts}}<br />
*'''loss''': A float representing the percentage of health the ped lost.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[ped]] that got damaged<br />
<br />
==Cancel effect==<br />
If this event is [[Event system#Canceling|canceled]], then any damaging effects to the ped will cease.<br />
<br />
==Example== <br />
<br />
<br />
==See Also==<br />
===Client ped events===<br />
{{Client_ped_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Client_Scripting_Events&diff=19371Client Scripting Events2009-05-02T14:58:11Z<p>LordAzamath: Added client ped events template</p>
<hr />
<div><pageclass class="client"></pageclass><br />
This page lists all '''client-side''' scripting [[event]]s that have been implemented and are available in the Deathmatch mod. To request a function or event, use [[Requested Functions and Events]].<br />
<br />
'''Server-side scripting events can be found here: [[Server Scripting Events]]<br />
<br />
==Colshape events==<br />
{{Client_colshape_events}}<br />
<br />
==Element events==<br />
{{Client_element_events}}<br />
<br />
==GUI events==<br />
{{GUI_events}}<br />
<br />
==Marker events==<br />
{{New feature|3|1.0|<br />
{{Client_marker_events}}<br />
}}<br />
<br />
==Ped events==<br />
{{Client_ped_events}}<br />
<br />
==Player events==<br />
{{Client_player_events}}<br />
<br />
==Projectile events==<br />
{{Client_projectile_events}}<br />
<br />
==Resource events==<br />
{{Client_resource_events}}<br />
<br />
==Vehicle events==<br />
{{Client_vehicle_events}}<br />
<br />
==Other events==<br />
{{Client_other_events}}<br />
<br />
[[pl:Zdarzenia_po_stronie_klienta]]</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Template:Client_ped_events&diff=19370Template:Client ped events2009-05-02T14:56:46Z<p>LordAzamath: Client ped events</p>
<hr />
<div>{{New feature|3|1.0|<br />
*[[onClientPedDamage]]<br />
*[[onClientPedWasted]]<br />
*[[onClientPedWeaponFire]]<br />
}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientChatMessage&diff=19369OnClientChatMessage2009-05-01T11:49:42Z<p>LordAzamath: </p>
<hr />
<div>{{Client event}}<br />
__NOTOC__ <br />
This event is triggered when any text is output to chatbox, including MTA's hardcoded messages.<br />
<br />
==Parameters== <br />
<syntaxhighlight lang="lua"><br />
string text, int r, int g, int b<br />
</syntaxhighlight><br />
*'''text:''' The text that was output to chatbox<br />
*'''r:''' The amount of red in the color of the text.<br />
*'''g:''' The amount of green in the color of the text.<br />
*'''b:''' The amount of blue in the color of the text.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the root element.<br />
==Example==<br />
<br />
==See Also==<br />
<br />
===Client other events===<br />
{{Client_other_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientChatMessage&diff=19368OnClientChatMessage2009-05-01T11:48:42Z<p>LordAzamath: </p>
<hr />
<div>{{Client event}}<br />
__NOTOC__ <br />
This event is triggered when any text is output to chatbox, including MTA's hardcoded messages.<br />
<br />
==Parameters== <br />
<syntaxhighlight lang="lua"><br />
string text, int r, int g, int b<br />
</syntaxhighlight><br />
*'''text:''' The text that was output to chatbox<br />
*'''r:''' The amount of red in the color of the text.<br />
*'''g:''' The amount of green in the color of the text.<br />
*'''b:''' The amount of blue in the color of the text.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the root element.<br />
==Example==<br />
<br />
==See Also==<br />
<br />
===GUI events===<br />
{{GUI_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=OnClientChatMessage&diff=19367OnClientChatMessage2009-05-01T11:46:54Z<p>LordAzamath: OnClientChatMessage</p>
<hr />
<div>{{Client event}}<br />
__NOTOC__ <br />
This event is triggered when any text is outputted to chatbox, including MTA's hardcoded messages.<br />
<br />
==Parameters== <br />
<syntaxhighlight lang="lua"><br />
string text, int r, int g, int b<br />
</syntaxhighlight><br />
*'''text:''' The text that was output to chatbox<br />
*'''r:''' The amount of red in the color of the text.<br />
*'''g:''' The amount of green in the color of the text.<br />
*'''b:''' The amount of blue in the color of the text.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the root element.<br />
==Example==<br />
<br />
==See Also==<br />
<br />
===GUI events===<br />
{{GUI_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=DxDrawRectangle&diff=18742DxDrawRectangle2009-03-26T09:21:03Z<p>LordAzamath: Removed Category:Needs example as there is one</p>
<hr />
<div>__NOTOC__ <br />
{{Client function}} <br />
This function draws a 2D rectangle across the screen - rendered for '''one''' frame. This should be used in conjunction with [[onClientRender]] in order to display continuously. <br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool dxDrawRectangle ( int startX, startY, float width, float height [, int color = white, bool postGUI = false] )<br />
</syntaxhighlight><br />
<br />
===Required Arguments=== <br />
* '''startX:''' An integer representing the '''absolute''' origin X position of the rectangle, represented by pixels on the screen.<br />
* '''startY:''' An integer representing the '''absolute''' origin Y position of the rectangle, represented by pixels on the screen.<br />
* '''width:''' An float representing the width of the rectangle, drawn in a ''right'' direction from the origin.<br />
* '''height:''' An float representing the height of the rectangle, drawn in a ''downwards'' direction from the origin.<br />
<br />
===Optional Arguments===<br />
*'''color:''' the color of the rectangle.<br />
* '''postGUI:''' A bool representing whether the line should be drawn on top of or behind any ingame GUI.<br />
<br />
===Returns===<br />
Returns a true if the operation was successful, false otherwise.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
Example of MOTD (message of the day), made using DxDrawText, -Line and -Rectangle.<br />
<syntaxhighlight lang="lua"><br />
local rootElement = getRootElement()<br />
local x,y = guiGetScreenSize() -- Get players resolution.<br />
local playerName = getPlayerName ( getLocalPlayer() ) -- Get players name.<br />
local MOTDText = "Welcome to our server, this is a test MOTD script for MTA's Wiki." -- Example of MOTD message.<br />
<br />
<br />
function create2DRectangle ( )<br />
dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) -- Create our black transparent MOTD background Rectangle.<br />
dxDrawText ( "Welcome " .. playerName, x/3.5, y/3.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) -- Create Welcome title.<br />
dxDrawText ( "Welcome " .. playerName, x/3.48, y/3.58, x, y, tocolor ( 0, 0, 0, 255 ), 1, "bankgothic" ) -- Create Welcome title shadow.<br />
dxDrawLine ( x/3.6, y/3.3, x/1.35, y/3.3, tocolor ( 255, 255, 255, 255 ), 2 ) -- Create underline for title.<br />
dxDrawLine ( x/3.59, y/3.275, x/1.348, y/3.275, tocolor ( 0, 0, 0, 255 ), 2 ) -- Create underline shadow.<br />
dxDrawText ( MOTDText, x/3.6, y/3, x, y, tocolor ( 255, 255, 255, 255 ), 1, "clear" ) -- Create MOTD text.<br />
end<br />
<br />
<br />
function HandleTheRendering ( )<br />
addEventHandler("onClientRender",rootElement, create2DRectangle) -- Keep everything visible with onClientRender.<br />
end<br />
addEventHandler("onClientResourceStart",rootElement, HandleTheRendering)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Drawing_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=DxDrawLine&diff=18741DxDrawLine2009-03-26T09:20:21Z<p>LordAzamath: Removed Category:Needs example as there is one</p>
<hr />
<div>__NOTOC__ <br />
{{Client function}} <br />
This function draws a 2D line across the screen - rendered for '''one''' frame. This should be used in conjunction with [[onClientRender]] in order to display continuously.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool dxDrawLine ( int startX, int startY, int endX, int endY, int color, [float width=1, bool postGUI=false] )<br />
</syntaxhighlight><br />
<br />
===Required Arguments=== <br />
* '''startX:''' An integer representing the '''absolute''' start X position of the line, represented by pixels on the screen.<br />
* '''startY:''' An integer representing the '''absolute''' start Y position of the line, represented by pixels on the screen.<br />
* '''endX:''' An integer representing the '''absolute''' end X position of the line, represented by pixels on the screen.<br />
* '''endY:''' An integer representing the '''absolute''' end Y position of the line, represented by pixels on the screen.<br />
* '''color:''' An integer of the hex color, produced using [[tocolor]].<br />
<br />
==Optional Arguments==<br />
{{OptionalArg}}<br />
* '''width:''' The width/thickness of the line <br />
* '''postGUI:''' A bool representing whether the line should be drawn on top of or behind any ingame GUI (rendered by CEGUI).<br />
<br />
===Returns===<br />
Returns a true if the operation was successful, false otherwise. <br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
Example code for drawing crosshair for Tank.<br />
<syntaxhighlight lang="lua"><br />
local rootElement = getRootElement()<br />
local x,y = guiGetScreenSize() -- Get players resolution.<br />
<br />
<br />
function create2DLine ( )<br />
dxDrawLine ( x/2, y/2-200, x/2, y/2-170, tocolor ( 0, 255, 0, 255 ), 1 ) -- Draw vertical crosshair line.<br />
dxDrawLine ( x/2-20, y/2-185, x/2+20, y/2-185, tocolor ( 0, 255, 0, 255 ), 1 ) -- Draw horizontal crosshair line.<br />
end<br />
<br />
<br />
function HandleTheRendering()<br />
addEventHandler("onClientRender",rootElement, create2DLine) -- Keep the line visible with onClientRender.<br />
end<br />
addEventHandler("onClientResourceStart",rootElement, HandleTheRendering)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Drawing_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=GetCameraMatrix&diff=18740GetCameraMatrix2009-03-26T09:18:21Z<p>LordAzamath: Added an example</p>
<hr />
<div>__NOTOC__<br />
{{Server client function}}<br />
This function gets the position of the camera and the position of the point it is facing.<br />
<br />
Note: The server-side version of this function returns the last camera matrix that was set by the server, and thus does not necessarily indicate the current matrix of the camera (since it may have been changed client-side).<br />
<br />
==Syntax==<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
float float float float float float getCameraMatrix ( player thePlayer )<br />
</syntaxhighlight><br />
<br />
===Required Arguments=== <br />
*'''thePlayer:''' The player whose camera matrix is to be returned.<br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
float float float float float float getCameraMatrix ( )<br />
</syntaxhighlight><br />
<br />
===Required Arguments=== <br />
''None.''<br />
</section><br />
<br />
===Returns===<br />
Returns six ''float'' numbers if the argument(s) are valid; the first three indicate the position of the camera, the last three indicate the position of the point it's facing. Returns ''false'' if the arguments are invalid.<br />
<br />
==Example==<br />
'''Example 1:''' This clientside example moves camera +1 unit on X axis.<br />
<syntaxhighlight lang="lua"><br />
local x, y, z, lx, ly, lz = getCameraMatrix() -- Get the current location and lookat of camera<br />
x, lx = x + 1, lx + 1 -- What will be the new x and x lookat values<br />
setCameraMatrix(x,y,z,lx,ly,lz) -- Set camera to new position<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Camera functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=SetRadioChannel&diff=18727SetRadioChannel2009-03-25T19:05:16Z<p>LordAzamath: /* Required Arguments */</p>
<hr />
<div>__NOTOC__ <br />
{{Client function}}<br />
This function sets the currently active radio channel.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool setRadioChannel ( int ID ) <br />
</syntaxhighlight> <br />
<br />
<br />
===Required Arguments=== <br />
*'''ID:''' The ID of the radio station you want to play.<br />
<br />
{{SoundID}}<br />
<br />
===Returns===<br />
Returns true if channel was set successfully, false otherwise.<br />
<br />
==Example== <br />
<syntaxhighlight lang="lua"><br />
addCommandHandler("setradio",<br />
function (player, command, argument)<br />
<br />
setRadioChannel( tonumber( argument ) )<br />
<br />
outputChatBox("You set your radio station to: " .. argument)<br />
<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
<br />
{{Client_audio_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Template:Radio_Station_IDs&diff=18726Template:Radio Station IDs2009-03-25T19:03:04Z<p>LordAzamath: Formatted the same way as other ID templates</p>
<hr />
<div><div style="border:3px solid red;margin-bottom:3px;padding-left:5px;"><div style="float:right;padding-right:5px;font-weight:bold;"></div><br />
* '''0:''' Radio off<br />
* '''1:''' Playback FM<br />
* '''2:''' K-Rose<br />
* '''3:''' K-DST<br />
* '''4:''' Bounce FM<br />
* '''5:''' SF-UR<br />
* '''6:''' Radio Los Santos<br />
* '''7:''' Radio X<br />
* '''8:''' CSR 103.9<br />
* '''9:''' K-Jah West<br />
* '''10:''' Master Sounds 98.3<br />
* '''11:''' WCTR<br />
* '''12:''' User Track Player<br />
</div></div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=KillPed&diff=18682KillPed2009-03-19T07:59:45Z<p>LordAzamath: /* Optional Arguments */ Added BodyParts template</p>
<hr />
<div>{{Server function}}<br />
__NOTOC__<br />
This function kills the specified ped.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">bool killPed ( ped thePed, [ ped theKiller = nil, int weapon=255, int bodyPart=255, bool stealth ] )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''thePed:''' The [[ped]] to kill<br />
<br />
===Optional Arguments===<br />
* '''theKiller:''' The ped responsible for the kill<br />
* '''weapon:''' The ID of the weapon that should appear to have killed the ped (doesn't affect how they die)<br />
* '''bodyPart:''' The ID of the body part that should appear to have been hit by the weapon (doesn't affect how they die)<br />
{{BodyParts}}<br />
* '''stealth:''' Boolean value, representing whether or not this a stealth kill ('''From 1.0''')<br />
<br />
===Returns===<br />
Returns ''true'' if the ped was killed, ''false'' if the ped specified could not be killed or is invalid.<br />
<br />
==Example==<br />
'''Example 1:''' This simple example adds a '''kill''' command to commit suicide.<br />
<syntaxhighlight lang="lua"><br />
function commitSuicide ( sourcePlayer )<br />
-- kill the player and make him responsible for it<br />
killPed ( sourcePlayer, sourcePlayer )<br />
end<br />
-- attach our handler to the "kill" command<br />
addCommandHandler ( "kill", commitSuicide )<br />
</syntaxhighlight><br />
<br />
'''Example 2:''' This example enables 1 hit kills if a player is shot in the head.<br />
<syntaxhighlight lang="lua"><br />
function headshotKill ( attacker, attackerweapon, bodypart, loss )<br />
if bodypart == 9 then --if the bodypart is the head<br />
--kill the player, emulating the correct killer, weapon and bodypart.<br />
killPed ( source, attacker, attackerweapon, bodypart )<br />
end<br />
end<br />
addEventHandler ( "onPlayerDamage", getRootElement(), headshotKill )<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Ped functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=KillPed&diff=18681KillPed2009-03-19T07:55:46Z<p>LordAzamath: /* Optional Arguments */ dp3 -> 1.0</p>
<hr />
<div>{{Server function}}<br />
__NOTOC__<br />
This function kills the specified ped.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua">bool killPed ( ped thePed, [ ped theKiller = nil, int weapon=255, int bodyPart=255, bool stealth ] )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''thePed:''' The [[ped]] to kill<br />
<br />
===Optional Arguments===<br />
* '''theKiller:''' The ped responsible for the kill<br />
* '''weapon:''' The ID of the weapon that should appear to have killed the ped (doesn't affect how they die)<br />
* '''bodyPart:''' The ID of the body part that should appear to have been hit by the weapon (doesn't affect how they die)<br />
* '''stealth:''' Boolean value, representing whether or not this a stealth kill ('''From 1.0''')<br />
<br />
===Returns===<br />
Returns ''true'' if the ped was killed, ''false'' if the ped specified could not be killed or is invalid.<br />
<br />
==Example==<br />
'''Example 1:''' This simple example adds a '''kill''' command to commit suicide.<br />
<syntaxhighlight lang="lua"><br />
function commitSuicide ( sourcePlayer )<br />
-- kill the player and make him responsible for it<br />
killPed ( sourcePlayer, sourcePlayer )<br />
end<br />
-- attach our handler to the "kill" command<br />
addCommandHandler ( "kill", commitSuicide )<br />
</syntaxhighlight><br />
<br />
'''Example 2:''' This example enables 1 hit kills if a player is shot in the head.<br />
<syntaxhighlight lang="lua"><br />
function headshotKill ( attacker, attackerweapon, bodypart, loss )<br />
if bodypart == 9 then --if the bodypart is the head<br />
--kill the player, emulating the correct killer, weapon and bodypart.<br />
killPed ( source, attacker, attackerweapon, bodypart )<br />
end<br />
end<br />
addEventHandler ( "onPlayerDamage", getRootElement(), headshotKill )<br />
</syntaxhighlight><br />
<br />
==See Also==<br />
{{Ped functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Talk:GUI_Classes&diff=18467Talk:GUI Classes2009-02-28T18:45:20Z<p>LordAzamath: /* =About the URL of links */</p>
<hr />
<div>===About the URL of links===<br />
Maybe the functions should be in index.php?title=GUI_Classes/Element:function rather than index.php?title=Element:function to show that they belong to the GUI classes only. [[User:LordAzamath|LordAzamath]] 19:44, 28 February 2009 (CET)</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Talk:GUI_Classes&diff=18466Talk:GUI Classes2009-02-28T18:44:55Z<p>LordAzamath: linkage</p>
<hr />
<div>===About the URL of links==<br />
Maybe the functions should be in index.php?title=GUI_Classes/Element:function rather than index.php?title=Element:function to show that they belong to the GUI classes only. [[User:LordAzamath|LordAzamath]] 19:44, 28 February 2009 (CET)</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=CreateBlip&diff=18138CreateBlip2009-01-15T19:05:48Z<p>LordAzamath: dp3 -> 1.0</p>
<hr />
<div>__NOTOC__ <br />
{{Server client function}}<br />
This function creates a [[blip]] [[element]], which is displayed as an icon on the client's radar.<br />
<br />
==Syntax==<br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua"><br />
blip createBlip ( float x, float y, float z, [int icon=0, int size=2, int r=255, int g=0, int b=0, int a=255, int ordering=0 *, visibleTo = getRootElement()] )<br />
</syntaxhighlight> <br />
<br />
===Required Arguments=== <br />
*'''x:''' The x position of the blip, in world coordinates.<br />
*'''y:''' The y position of the blip, in world coordinates.<br />
*'''z:''' The z position of the blip, in world coordinates.<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''icon:''' The icon that the radar blips should be. Valid values are:<br />
{{Blip_Icons}}<br />
*'''size:''' The size of the radar blip. Default is 2.<br />
*'''r:''' The amount of red in the blip's color (0 - 255). Only applicable to the ''none'' icon. Default is 255. <br />
*'''g:''' The amount of green in the blip's color (0 - 255). Only applicable to the ''none'' icon. Default is 0.<br />
*'''b:''' The amount of blue in the blip's color (0 - 255). Only applicable to the ''none'' icon. Default is 0.<br />
*'''a:''' The amount of alpha in the blip's color (0 - 255). Default is 255.<br />
*'''ordering:''' This defines the blip's Z-level ordering (-32768 - 32767). Default is 0. '''* Note: This argument is not in DP2, it is 1.0 only.'''<br />
* '''visibleTo:''' What elements can see the blip. Defaults to visible to everyone. See [[visibility]].<br />
</section><br />
<section name="Client" class="client" show="false"><br />
<syntaxhighlight lang="lua"><br />
blip createBlip ( float x, float y, float z, [int icon=0, int size=2, int r=255, int g=0, int b=0, int a=255, int ordering=0 *] )<br />
</syntaxhighlight> <br />
<br />
===Required Arguments=== <br />
*'''x:''' The x position of the blip, in world coordinates.<br />
*'''y:''' The y position of the blip, in world coordinates.<br />
*'''z:''' The z position of the blip, in world coordinates.<br />
<br />
===Optional Arguments=== <br />
{{OptionalArg}} <br />
*'''icon:''' The icon that the radar blips should be. Valid values are:<br />
{{Blip_Icons}}<br />
*'''size:''' The size of the radar blip. Default is 2.<br />
*'''r:''' The amount of red in the blip's color (0 - 255). Only applicable to the ''none'' icon. Default is 255. <br />
*'''g:''' The amount of green in the blip's color (0 - 255). Only applicable to the ''none'' icon. Default is 0.<br />
*'''b:''' The amount of blue in the blip's color (0 - 255). Only applicable to the ''none'' icon. Default is 0.<br />
*'''a:''' The amount of alpha in the blip's color (0 - 255). Default is 255.<br />
*'''ordering:''' This defines the blip's Z-level ordering (-32768 - 32767). Default is 0. '''* Note: This argument is not in DP2, it is 1.0 only.'''<br />
</section><br />
<br />
==Returns==<br />
Returns an [[element]] of the [[blip]] if it was created successfully, ''false'' otherwise.<br />
<br />
==Example== <br />
<section name="Server" class="server" show="true"><br />
'''Example 1:''' This example creates a radar blip at a random player's position and makes it so that it is only visible to that player.<br />
<syntaxhighlight lang="lua"><br />
-- Pick a random player<br />
myPlayer = getRandomPlayer ()<br />
-- Retrieve the player's position and store it in the variables x, y and z<br />
x,y,z = getElementPosition ( myPlayer )<br />
-- Create a radar blip at the player's position, with a 'cash' icon and only visible to the player<br />
myBlip = createBlip ( x, y, z, 51, 0, 0, 0, 255, myPlayer )<br />
</syntaxhighlight><br />
<br />
'''Example 2:''' This example attaches a blip to a player. You can attach a blip to an element by just setting the blip's parent to that element.<br />
<syntaxhighlight lang="lua"><br />
-- Pick a random player<br />
myPlayer = getRandomPlayer ()<br />
-- Create a radar blip in the middle of the map<br />
myBlip = createBlip ( 0, 0, 0 )<br />
-- Make the player the parent of the blip, so that the blip follows the player around<br />
setElementParent ( myBlip, myPlayer )<br />
</section><br />
<br />
==See Also==<br />
{{Blip_functions}}</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=Control_names&diff=17627Control names2008-08-24T09:57:13Z<p>LordAzamath: </p>
<hr />
<div>This page lists all the control names. These can be used as key arguments by the console commands ''bind'' and ''unbind'' as well as the script functions [[bindKey]], [[unbindKey]] etc.<br />
<br />
<div style="border:3px solid green;margin-bottom:3px;"><div style="float:right;padding-right:5px;font-weight:bold;">ON FOOT</div><br />
* '''fire''' Fire a player's weapon<br />
* '''next_weapon''' Switch to the next weapon<br />
* '''previous_weapon''' Switch to the previous weapon<br />
* '''forwards''' Move forwards<br />
* '''backwards''' Move backwards<br />
* '''left''' Move left<br />
* '''right''' Move right<br />
* '''zoom_in''' Zoom targeted weapon in (sniper/rocket launcher/camera etc)<br />
* '''zoom_out''' Zoom targeted weapon out<br />
* '''change_camera''' Change camera mode<br />
* '''jump''' Make the player jump<br />
* '''sprint''' Make the player sprint<br />
* '''look_behind''' Make the player look behind (and allow the player to see behind them)<br />
* '''crouch''' Make the player crouch/duck<br />
* '''action''' Show the stats menu<br />
* '''walk''' Make the player move slowly/quietly<br />
* '''aim_weapon''' Aim the player's current weapon (if possible)<br />
* '''conversation_yes''' Answer yes to a question<br />
* '''conversation_no''' Answer no to a question<br />
* '''group_control_forwards''' Make the group you are controlling move forwards<br />
* '''group_control_back''' Make the group you are controlling move backwards<br />
* '''enter_exit''' Make the player enter a vehicle. Also used for alternative fighting styles.<br />
</div><br />
<div style="border:3px solid red;margin-bottom:3px;"><div style="float:right;padding-right:5px;font-weight:bold;">IN VEHICLE</div><br />
* '''vehicle_fire''' Fire the player's vehicle's primary weapon (e.g. hunter's missiles)<br />
* '''vehicle_secondary_fire''' Fire the player's vehicle's secondary weapon (e.g. hunter's minigun)<br />
* '''vehicle_left''' Make the player's vehicle turn left<br />
* '''vehicle_right''' Make the player's vehicle turn right<br />
* '''steer_forward''' Make the player's vehicle turn down (lean forwards for helicopters/planes)<br />
* '''steer_back''' Make the player's vehicle turn up (lean backwards for helicopters/planes)<br />
* '''accelerate''' Make the player's vehicle accelerate<br />
* '''brake_reverse''' Make the player's brake (slow down) and if stationary reverse<br />
* '''radio_next''' Change to the next radio station<br />
* '''radio_previous''' Change to the previous radio station<br />
* '''radio_user_track_skip''' Skip the current track being played on the custom radio station<br />
* '''horn''' Play the horn of the player's vehicle (if the vehicle has a horn) and can trigger the siren on emergency vehicles<br />
* '''sub_mission''' Start a submission if one is avaliable (e.g. taxi missions)<br />
* '''handbrake''' Apply the handbrake on the player's vehicle<br />
* '''vehicle_look_left''' Look to the left<br />
* '''vehicle_look_right''' Look to the right<br />
* '''vehicle_look_behind''' Look behind<br />
* '''vehicle_mouse_look''' <br />
* '''special_control_left''' Move the some special vehicle component left (e.g. tank's turret)<br />
* '''special_control_right''' Move the some special vehicle component right (e.g. tank's turret)<br />
* '''special_control_down''' Move the some special vehicle component down (e.g. tank's turret)<br />
* '''special_control_up''' Move the some special vehicle component up (e.g. tank's turret)<br />
* '''enter_exit''' Make the player exit a vehicle<br />
</div><br />
<br />
The following are names of hard-coded MTA commands which do not use bindKey, but can act as bindKey by using them in an [[addCommandHandler]]. Other than that, this control list will '''only''' work with the functions [[toggleControl]] and [[toggleAllControls]].<br />
<br />
<div style="border:3px solid blue;margin-bottom:3px;"><div<br />
style="float:right;padding-right:5px;font-weight:bold;">MTA COMMANDS</div><br />
* '''enter_passenger''' Enter's the closest vehicle as passenger<br />
* '''playerlist''' Toggles the player-list showing<br />
* '''screenshot''' Takes a screenshot<br />
* '''chatbox''' Opens the chatbox for input<br />
* '''radar''' Toggles the radar-map showing<br />
* '''radar_zoom_in''' Zooms in on the radar-map<br />
* '''radar_zoom_out''' Zooms out on the radar-map<br />
* '''radar_move_north''' Moves north on the radar-map<br />
* '''radar_move_south''' Moves south on the radar-map<br />
* '''radar_move_east''' Moves east on the radar-map<br />
* '''radar_move_west''' Moves west on the radar-map<br />
* '''radar_attach''' Attaches the view to the local-player on the radar-map<br />
</div><br />
[[Category:Scripting Concepts]]</div>LordAzamathhttps://wiki.multitheftauto.com/index.php?title=ExecuteCommandHandler&diff=17626ExecuteCommandHandler2008-08-24T08:42:20Z<p>LordAzamath: Client part is different from server</p>
<hr />
<div>{{Server client function}}<br />
__NOTOC__<br />
<br />
This function will call all the attached functions of an existing console command, for a specified player.<br />
<br />
==Syntax== <br />
<section name="Server" class="server" show="true"><br />
<syntaxhighlight lang="lua">bool executeCommandHandler ( string commandName, player thePlayer, [ string args ] )</syntaxhighlight><br />
<br />
==Required Arguments==<br />
*'''commandName:''' The name of the command you wish to execute. This is what must be typed into the console to trigger the function.<br />
*'''thePlayer:''' The player that will be presented as executer of the command to the handler function(s) of the command<br />
<br />
==Optional Arguments==<br />
{{OptionalArg}}<br />
* '''args:''' Additional parameters that will be passed to the handler function(s) of the command that is called.<br />
</section><br />
<section name="Client" class="client" show="false"><br />
<syntaxhighlight lang="lua">bool executeCommandHandler ( string commandName, [ string args ] )</syntaxhighlight><br />
<br />
==Required Arguments==<br />
*'''commandName:''' The name of the command you wish to execute. This is what must be typed into the console to trigger the function.<br />
<br />
==Optional Arguments==<br />
{{OptionalArg}}<br />
* '''args:''' Additional parameters that will be passed to the handler function(s) of the command that is called.<br />
</section><br />
===Returns===<br />
Returns ''true'' if the command handler was called successfully, ''false'' otherwise.<br />
<br />
==Example== <br />
<section name="Server" class="server" show="true"><br />
This example defines a command handler for the command ''createmarker'' (which creates a red marker at the caller's position). It then creates a second command handler ''createmarker2'' which will call the first one.<br />
<syntaxhighlight lang="lua"><br />
-- Define the function that will handle the 'createmarker' command<br />
function consoleCreateMarker ( playerSource, commandName )<br />
-- If a player triggered it (rather than the admin) then<br />
if ( playerSource )<br />
-- Get that player's position<br />
x, y, z = getElementPosition ( playerSource )<br />
-- Create a marker at their position<br />
createMarker ( x, y, z, 0, "checkpoint", 255, 0, 0, 255 )<br />
-- Output it in the chat box<br />
outputChatBox ( "You got a red marker", playerSource )<br />
end<br />
end<br />
-- Add the function as a handler for the command<br />
addCommandHandler ( "createmarker", consoleCreateMarker )<br />
<br />
-- Define a second console command that will just call the first.<br />
-- First define the function<br />
function consoleCreateMarker2 ( playerSource, commandName )<br />
-- re-route back to the original<br />
executeCommandHandler ( "createmarker", playerSource )<br />
end<br />
-- Then add it as a handler for the new console command<br />
addCommandHandler ( "createmarker2", consoleCreateMarker2 )<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Server functions}}</div>LordAzamath