https://wiki.multitheftauto.com/api.php?action=feedcontributions&user=Cleopatradev&feedformat=atom
Multi Theft Auto: Wiki - User contributions [en]
2024-03-29T05:09:27Z
User contributions
MediaWiki 1.39.3
https://wiki.multitheftauto.com/index.php?title=GetVehicleCurrentGear&diff=73948
GetVehicleCurrentGear
2022-02-01T13:31:51Z
<p>Cleopatradev: Add OOP definitions</p>
<hr />
<div>__NOTOC__ <br />
{{Client function}} <br />
<br />
Gets the specified vehicle's current gear.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
int getVehicleCurrentGear ( vehicle theVehicle )<br />
</syntaxhighlight><br />
{{OOP||[[vehicle]]:getGear||.gear}}<br />
<br />
===Required Arguments=== <br />
*'''theVehicle:''' the vehicle to get the gear of<br />
<br />
===Returns===<br />
Returns the gear if successful, ''false'' otherwise.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
Example of a program that outputs the current gear to the lower, center of the screen<br />
<syntaxhighlight lang="lua"><br />
function makeGearGui( )<br />
local sx, sy = guiGetScreenSize()<br />
local wx = 50<br />
local wy = 50<br />
gearLabel = guiCreateLabel(((sx / 2) - wx), (sy - wy), wx, wy, "5", false)<br />
end<br />
makeGearGui()<br />
<br />
function onRender()<br />
g_vehicle = getPedOccupiedVehicle(localPlayer)<br />
if g_vehicle then<br />
g_curGear = tostring(getVehicleCurrentGear(g_vehicle))<br />
guiSetText(gearLabel, g_curGear)<br />
else<br />
guiSetText(gearLabel, "")<br />
end<br />
end<br />
addEventHandler("onClientRender", root, onRender)<br />
</syntaxhighlight><br />
</section><br />
<br />
==See Also==<br />
{{Vehicle_functions}}</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=ShowCol&diff=69681
ShowCol
2021-03-21T18:18:29Z
<p>Cleopatradev: </p>
<hr />
<div>__NOTOC__ <br />
{{Client function}}<br />
{{New feature/item|3.0160|1.5.8|20840|Shows collision previews for developers.}}<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua">bool showCol ( bool state )</syntaxhighlight><br />
===Required Arguments=== <br />
*'''state:''' true/false<br />
===Returns===<br />
* If the operation is executed, it returns 'true', otherwise it returns 'false'.<br />
<br />
==Example==<br />
You can refer to the example below.<br />
<syntaxhighlight lang="lua"><br />
setDevelopmentMode(true)<br />
<br />
addCommandHandler("devdebug",<br />
function()<br />
showCol(not isShowCollisionsEnabled())<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.8-9.20840|}}<br />
<br />
==See Also==<br />
{{Client_utility_functions}}</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=ShowCol&diff=69680
ShowCol
2021-03-21T18:18:02Z
<p>Cleopatradev: Created page with "__NOTOC__ {{Client function}} {{New feature/item|3.0160|1.5.8|20840|Shows collision previews for developers.}} ==Syntax== <syntaxhighlight lang="lua">bool showCol ( bool st..."</p>
<hr />
<div>__NOTOC__ <br />
{{Client function}}<br />
{{New feature/item|3.0160|1.5.8|20840|Shows collision previews for developers.}}<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua">bool showCol ( bool state )</syntaxhighlight><br />
===Required Arguments=== <br />
*'''state:''' true/false<br />
===Returns===<br />
* If the operation is executed, it returns 'true', otherwise it returns 'false'.<br />
<br />
==Example==<br />
You can refer to the example below.<br />
<syntaxhighlight lang="lua"><br />
setDevelopmentMode(true)<br />
<br />
addCommandHandler("devdebug",<br />
function()<br />
showCol(not isShowCollisionsEnabled())<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.8-9.20840|}}<br />
<br />
==See Also==<br />
{{Client_object_functions}}</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=Coreconfig.xml&diff=69603
Coreconfig.xml
2021-03-07T20:10:03Z
<p>Cleopatradev: </p>
<hr />
<div>This file is used to set your UI e.g. chat box color, chat font or even bind keys. You can modify it to make your chat box look better or add favourite servers manually. Coreconfig.xml is located in your MTA San Andreas 1.x\MTA\ folder with another file called [[Chatboxpresents.xml]].<br />
<br />
== Settings ==<br />
Most of the settings are self-explained.<br />
*'''nick''' - Your nickname in-game<br />
*'''host''' - Last played server's IP<br />
*'''port''' - Last played server's port<br />
*'''password''' - Last played server's password<br />
*'''qc_host''' - Quick Connect IP<br />
*'''qc_port''' - Quick Connect Port<br />
*'''qc_password''' - Quick Connect Password<br />
*'''debugfile''' - <br />
*'''console_pos''' - X, Y co-ords of the screen where console should be shown (after pressing ` (tilde) key)<br />
*'''console_size''' - The size of the console after setting it's co-ordinates.<br />
*'''serverbrowser_size''' - The size of the server browser.<br />
*'''fps_limit''' - The limit for your FPS(Frames Per Second)<br />
*'''chat_font''' - Font ID you want to be used in chat box<br />
*'''chat_lines''' - How many lines you want to be displayed in chat box<br />
*'''chat_color''' - Chat box background color (format is: RGBA, values between 0 - 255)<br />
*'''chat_input_color''' - Background of the line shown when you type text (displayed when you press T or Y)<br />
*'''chat_input_prefix_color''' - Color of the word "Say:" or "Team Say:" when you press T or Y<br />
*'''chat_input_text_color''' - Color of the text you type, when you press T or Y<br />
*'''chat_scale''' - Scale of the chat box, that is size of it (format is: width height, floating values between 0 - 1)<br />
*'''chat_width''' - Width of the chat box, text will wrap if it reaches this end<br />
*'''chat_css_style_text''' - (needs explanation)<br />
*'''chat_css_style_background''' - (needs explanation)<br />
*'''chat_line_life''' - (needs explanation)<br />
*'''chat_line_fade_out''' - Time after which line should fade out (milliseconds)<br />
*'''chat_use_cegui''' - Should chat use CEGUI? (values 0 or 1).<br />
*'''text_scale''' - Scale of the text.<br />
*'''invert_mouse''' - Should the mouse be inverted? (Values 0 or 1).<br />
*'''fly_with_mouse''' - Should you fly with mouse? (Values 0 or 1).<br />
*'''steer_with_mouse''' - Should you steer with the mouse? (Values 0 or 1).<br />
*'''classic_controls''' - Should the classic controls be on? (Values 0 or 1).<br />
*'''mtavolume''' - Your MTA's Volume.<br />
*'''voicevolume''' - The in-game players voice volume.<br />
*'''async_loading''' - (Explaination)<br />
*'''menu_options''' - Contains the flags for the animated 3D menu scene (as given in the Video tab). Set to 255 to enable all options. Set to 248 to disable all options in case of problems/issues in the main menu (and not during game play).<br />
<br />
== Bind key ==<br />
Binding key format is easy and almost everyone can bind their own keys to make the game easier to play and speed up your gaming a little bit. You can bind a command you use the most often to a key, so when you press the key that command will execute.<br />
<br />
Example binding key "h" which will execute /help command:<br />
<syntaxhighlight lang="xml"><bind key="h" command="help" /></syntaxhighlight> it's that simple.<br />
You can also use arguments in commands e.g. some servers have banking systems so you can /deposit money using keys too, eg: <syntaxhighlight lang="xml"><bind key="[" command="deposit" arguments="1000" /></syntaxhighlight><br />
This will deposit your $1000.<br />
<br />
==Coreconfig.xml Files: ==<br />
<section name="1.4" class="client"><br />
<syntaxhighlight lang="xml"><br />
<mainconfig><br />
<settings><br />
<nick></nick><br />
<host>128.0.0.1</host><br />
<port>22003</port><br />
<password></password><br />
<qc_host>192.168.1.101</qc_host><br />
<qc_port>22003</qc_port><br />
<qc_password></qc_password><br />
<debugfile></debugfile><br />
<console_pos>59 328</console_pos><br />
<console_size>689 450</console_size><br />
<serverbrowser_size>720 495</serverbrowser_size><br />
<fps_limit>100</fps_limit><br />
<chat_font>1</chat_font><br />
<chat_lines>10</chat_lines><br />
<chat_color>0 0 0 0</chat_color><br />
<chat_input_color>0 0 0 0</chat_input_color><br />
<chat_input_prefix_color>172 213 254 255</chat_input_prefix_color><br />
<chat_input_text_color>172 213 254 255</chat_input_text_color><br />
<chat_scale>1 1</chat_scale><br />
<chat_width>1.500000</chat_width><br />
<chat_css_style_text>0</chat_css_style_text><br />
<chat_css_style_background>0</chat_css_style_background><br />
<chat_line_life>12000</chat_line_life><br />
<chat_line_fade_out>3000</chat_line_fade_out><br />
<chat_use_cegui>0</chat_use_cegui><br />
<text_scale>1.000000</text_scale><br />
<invert_mouse>0</invert_mouse><br />
<fly_with_mouse>0</fly_with_mouse><br />
<steer_with_mouse>0</steer_with_mouse><br />
<classic_controls>1</classic_controls><br />
<mtavolume>0.500000</mtavolume><br />
<voicevolume>0.500000</voicevolume><br />
<async_loading>1</async_loading><br />
<mapalpha>127</mapalpha><br />
<browser_speed>1</browser_speed><br />
<single_download>0</single_download><br />
<syntaxhighlight lang="lua"_path>0</code_path><br />
<update_build_type>0</update_build_type><br />
<volumetric_shadows>0</volumetric_shadows><br />
<aspect_ratio>0</aspect_ratio><br />
<display_windowed>0</display_windowed><br />
<multimon_fullscreen_minimize>0</multimon_fullscreen_minimize><br />
<screenshot_path>C:\Program Files\MTA San Andreas 1.4\screenshots</screenshot_path><br />
<current_skin>Default</current_skin><br />
<chat_text_color>152 15 152 212</chat_text_color><br />
<fixup_flags>-cb-ma</fixup_flags><br />
<community_username></community_username><br />
<community_password></community_password><br />
<save_server_passwords>1</save_server_passwords><br />
<auto_refresh_browser>1</auto_refresh_browser><br />
<streaming_memory>247</streaming_memory><br />
<force_browse_other_versions></force_browse_other_versions><br />
<reportsettings>filter2@+all,-{1000~2007},-2050,-2051,-{3120},-{3211},-{4002},-5132,-5133,-5809,-7011,-7106,-7801,-7043,-7050,-7051,-7420,-7601,-{7842~7845},-7940;max@4001;min@11</reportsettings><br />
<anisotropic>0</anisotropic><br />
<grass>0</grass><br />
<network_encryption>1</network_encryption><br />
<fast_clothes_loading>1</fast_clothes_loading><br />
<allow_screen_upload>1</allow_screen_upload><br />
<max_clientscript_log_kb>5000</max_clientscript_log_kb><br />
</settings><br />
<binds><br />
<bind key="num_0" control="fire"></bind><br />
<bind key="lctrl" control="fire"></bind><br />
<bind key="mouse1" control="fire"></bind><br />
<bind key="e" control="next_weapon"></bind><br />
<bind key="num_enter" control="next_weapon"></bind><br />
<bind key="q" control="previous_weapon"></bind><br />
<bind key="num_dec" control="previous_weapon"></bind><br />
<bind key="arrow_u" control="forwards"></bind><br />
<bind key="w" control="forwards"></bind><br />
<bind key="arrow_d" control="backwards"></bind><br />
<bind key="s" control="backwards"></bind><br />
<bind key="arrow_l" control="left"></bind><br />
<bind key="a" control="left"></bind><br />
<bind key="arrow_r" control="right"></bind><br />
<bind key="d" control="right"></bind><br />
<bind key="pgup" control="zoom_in"></bind><br />
<bind key="x" control="zoom_in"></bind><br />
<bind key="mouse_wheel_up" control="zoom_in"></bind><br />
<bind key="pgdn" control="zoom_out"></bind><br />
<bind key="z" control="zoom_out"></bind><br />
<bind key="mouse_wheel_down" control="zoom_out"></bind><br />
<bind key="enter" control="enter_exit"></bind><br />
<bind key="v" control="change_camera"></bind><br />
<bind key="home" control="change_camera"></bind><br />
<bind key="space" control="jump"></bind><br />
<bind key="lshift" control="sprint"></bind><br />
<bind key="mouse3" control="look_behind"></bind><br />
<bind key="c" control="crouch"></bind><br />
<bind key="tab" control="action"></bind><br />
<bind key="lalt" control="walk"></bind><br />
<bind key="rctrl" control="vehicle_fire"></bind><br />
<bind key="lalt" control="vehicle_fire"></bind><br />
<bind key="mouse1" control="vehicle_fire"></bind><br />
<bind key="lctrl" control="vehicle_secondary_fire"></bind><br />
<bind key="num_0" control="vehicle_secondary_fire"></bind><br />
<bind key="a" control="vehicle_left"></bind><br />
<bind key="arrow_l" control="vehicle_left"></bind><br />
<bind key="d" control="vehicle_right"></bind><br />
<bind key="arrow_r" control="vehicle_right"></bind><br />
<bind key="arrow_u" control="steer_forward"></bind><br />
<bind key="arrow_d" control="steer_back"></bind><br />
<bind key="w" control="accelerate"></bind><br />
<bind key="s" control="brake_reverse"></bind><br />
<bind key="x" control="radio_next"></bind><br />
<bind key="z" control="radio_previous"></bind><br />
<bind key="F5" control="radio_user_track_skip"></bind><br />
<bind key="h" control="horn"></bind><br />
<bind key="2" control="sub_mission"></bind><br />
<bind key="num_add" control="sub_mission"></bind><br />
<bind key="space" control="handbrake"></bind><br />
<bind key="rctrl" control="handbrake"></bind><br />
<bind key="q" control="vehicle_look_left"></bind><br />
<bind key="e" control="vehicle_look_right"></bind><br />
<bind key="mouse3" control="vehicle_look_behind"></bind><br />
<bind key="mouse2" control="vehicle_mouse_look"></bind><br />
<bind key="num_4" control="special_control_left"></bind><br />
<bind key="num_6" control="special_control_right"></bind><br />
<bind key="num_2" control="special_control_down"></bind><br />
<bind key="end" control="special_control_down"></bind><br />
<bind key="num_8" control="special_control_up"></bind><br />
<bind key="delete" control="special_control_up"></bind><br />
<bind key="delete" control="aim_weapon"></bind><br />
<bind key="capslock" control="aim_weapon"></bind><br />
<bind key="mouse2" control="aim_weapon"></bind><br />
<bind key="y" control="conversation_yes"></bind><br />
<bind key="n" control="conversation_no"></bind><br />
<bind key="g" control="group_control_forwards"></bind><br />
<bind key="h" control="group_control_back"></bind><br />
<bind key="g" state="down" command="enter_passenger" arguments=""></bind><br />
<bind key="t" state="down" command="chatbox" arguments="chatboxsay"></bind><br />
<bind key="y" state="down" command="chatbox" arguments="teamsay 255 0 0"></bind><br />
<bind key="F11" state="down" command="radar" arguments="-1"></bind><br />
<bind key="num_add" state="down" command="radar_zoom_in" arguments=""></bind><br />
<bind key="num_sub" state="down" command="radar_zoom_out" arguments=""></bind><br />
<bind key="num_8" state="down" command="radar_move_north" arguments=""></bind><br />
<bind key="num_2" state="down" command="radar_move_south" arguments=""></bind><br />
<bind key="num_6" state="down" command="radar_move_east" arguments=""></bind><br />
<bind key="num_4" state="down" command="radar_move_west" arguments=""></bind><br />
<bind key="num_0" state="down" command="radar_attach" arguments=""></bind><br />
<bind key="z" state="down" command="voiceptt" arguments="1"></bind><br />
<bind key="z" state="up" command="voiceptt" arguments="0"></bind><br />
<bind key="pgup" state="down" command="chatscrollup" arguments="1"></bind><br />
<bind key="pgup" state="up" command="chatscrollup" arguments="0"></bind><br />
<bind key="pgdn" state="down" command="chatscrolldown" arguments="-1"></bind><br />
<bind key="pgdn" state="up" command="chatscrolldown" arguments="0"></bind><br />
<bind key="pgup" state="down" command="debugscrollup" arguments="1"></bind><br />
<bind key="pgup" state="up" command="debugscrollup" arguments="0"></bind><br />
<bind key="pgdn" state="down" command="debugscrolldown" arguments="-1"></bind><br />
<bind key="pgdn" state="up" command="debugscrolldown" arguments="0"></bind><br />
<bind key="num_div" state="down" command="radar_opacity_down" arguments=""></bind><br />
<bind key="num_mul" state="down" command="radar_opacity_up" arguments=""></bind><br />
<bind key="num_1" state="down" command="radar_help" arguments=""></bind><br />
<bind key="F12" state="down" command="screenshot" arguments=""></bind><br />
</binds><br />
<updater><br />
<var><br />
<version_lastchecktime>2012-08-31 23:36:44</version_lastchecktime><br />
<master_lastchecktime>2012-08-31 23:36:43</master_lastchecktime><br />
<master_highestnotifyrevision>2011-c-09-02</master_highestnotifyrevision><br />
<news_lastchecktime>2012-08-31 23:36:44</news_lastchecktime><br />
<news_lastnewsdate>2012-01-24</news_lastnewsdate><br />
<crashdump_historylist><br />
</crashdump_historylist><br />
</var><br />
<mastercache><br />
<master><br />
<revision>2012-05-09</revision><br />
<serverlist><br />
<server>http://updatesa.mtasa.com/sa/master/?v=%VERSION%&amp;id=%ID%</server><br />
<server>http://updatesa.multitheftauto.com/sa/master/?v=%VERSION%&amp;id=%ID%</server><br />
</serverlist><br />
<interval>12h</interval><br />
</master><br />
<version><br />
<serverlist><br />
<server priority="3">http://updatesa.mtasa.com/sa/version/?v=%VERSION%&amp;id=%ID%&amp;ty=%TYPE%&amp;da=%DATA%&amp;be=%BETA%&amp;re=%REFER%</server><br />
<server priority="4">http://updatesa.multitheftauto.com/sa/version/?v=%VERSION%&amp;id=%ID%&amp;ty=%TYPE%&amp;da=%DATA%&amp;be=%BETA%&amp;re=%REFER%</server><br />
</serverlist><br />
<interval>12h</interval><br />
</version><br />
<report><br />
<serverlist><br />
<server>http://updatesa.mtasa.com/sa/report/?v=%VERSION%&amp;id=%ID%</server><br />
<server>http://updatesa.multitheftauto.com/sa/report/?v=%VERSION%&amp;id=%ID%</server><br />
</serverlist><br />
<interval>12h</interval><br />
<filter2>+all,-{1000~2007},-2050,-2051,-{3120},-{3211},-{4002},-5132,-5133,-5809,-7011,-7106,-7801,-7043,-7050,-7051,-7420,-7601,-{7842~7845},-7940</filter2><br />
<minsize>11</minsize><br />
<maxsize>4001</maxsize><br />
</report><br />
<crashdump><br />
<serverlist><br />
<server priority="3">http://updatesa.mtasa.com/sa/crashdump/?v=%VERSION%&amp;id=%ID%&amp;file=%FILE%</server><br />
<server priority="4">http://updatesa.multitheftauto.com/sa/crashdump/?v=%VERSION%&amp;id=%ID%&amp;file=%FILE%</server><br />
</serverlist><br />
<duplicates>0</duplicates><br />
<maxhistorylength>100</maxhistorylength><br />
</crashdump><br />
<gtadatafiles><br />
<serverlist><br />
<server priority="3">http://updatesa.mtasa.com/sa/gtadatafiles/?v=%VERSION%&amp;id=%ID%</server><br />
<server priority="4">http://updatesa.multitheftauto.com/sa/gtadatafiles/?v=%VERSION%&amp;id=%ID%</server><br />
</serverlist><br />
</gtadatafiles><br />
<gtadatafiles2><br />
<serverlist><br />
<server priority="3">http://updatesa.mtasa.com/sa/gtadatafiles2/?v=%VERSION%&amp;id=%ID%</server><br />
</serverlist><br />
</gtadatafiles2><br />
<trouble><br />
<serverlist><br />
<server>http://updatesa.multitheftauto.com/sa/trouble/?v=%VERSION%&amp;id=%ID%&amp;tr=%TROUBLE%</server><br />
</serverlist><br />
</trouble><br />
<ase><br />
<serverlist><br />
<server priority="3">http://master.multitheftauto.com/ase/mta/?v=%VERSION%&amp;id=%ID%</server><br />
</serverlist><br />
</ase><br />
<sidegrade><br />
<serverlist><br />
<server priority="3">http://updatesa.mtasa.com/sa/sidegrade/?v=%VERSION%&amp;id=%ID%&amp;be=%BETA%&amp;re=%REFER%&amp;wv=%WANTVER%</server><br />
<server priority="4">http://updatesa.multitheftauto.com/sa/sidegrade/?v=%VERSION%&amp;id=%ID%&amp;be=%BETA%&amp;re=%REFER%&amp;wv=%WANTVER%</server><br />
</serverlist><br />
<nobrowselist><br />
<nobrowse version="1.0">1.1n;1.1N;1.2n;1.2sx;1.3n;1.3v;</nobrowse><br />
<nobrowse version="1.1">1.1n;1.1N;1.2n;1.2sx;1.3n;1.3v;</nobrowse><br />
</nobrowselist><br />
<onlybrowselist><br />
<onlybrowse version="1.1">1.3;1.2;1.1;1.0</onlybrowse><br />
<onlybrowse version="1.2">1.3;1.2;1.1;1.0</onlybrowse><br />
<onlybrowse version="1.3">1.3;1.2;1.1;1.0</onlybrowse><br />
</onlybrowselist><br />
</sidegrade><br />
<news><br />
<serverlist><br />
<server priority="3">http://updatesa.multitheftauto.com/sa/news/?v=%VERSION%&amp;id=%ID%&amp;be=%BETA%&amp;ln=%LASTNEWS%</server><br />
<server priority="4">http://updatesa.mtasa.com/sa/news/?v=%VERSION%&amp;id=%ID%&amp;be=%BETA%&amp;ln=%LASTNEWS%</server><br />
</serverlist><br />
<interval>12h</interval><br />
<oldestpost>2010-11-02</oldestpost><br />
<maxhistorylength>3</maxhistorylength><br />
</news><br />
<misc><br />
<debug><br />
<filter2>-all,+{500~2000}</filter2><br />
</debug><br />
</misc><br />
</mastercache><br />
</updater><br />
<serverbrowser_options><br />
<list id="0" include_empty="1" include_full="1" include_locked="1"></list><br />
<list id="1" include_empty="1" include_full="1" include_locked="1" active="1"></list><br />
<list id="2" include_empty="1" include_full="1" include_locked="1" include_offline="1"></list><br />
<list id="3" include_empty="1" include_full="1" include_locked="1" include_offline="1"></list><br />
</serverbrowser_options><br />
<recently_played_servers><br />
</recently_played_servers><br />
<connect_history><br />
</connect_history><br />
<server_passwords><br />
</server_passwords><br />
<favourite_servers></favourite_servers><br />
</mainconfig><br />
</syntaxhighlight><br />
</section><br />
<br />
== See Also ==<br />
[[Key names]]<br><br />
[[Control names]]<br />
[[Category:Incomplete]]</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=EngineLoadIMGContainer&diff=68932
EngineLoadIMGContainer
2021-02-13T22:10:15Z
<p>Cleopatradev: need to local var</p>
<hr />
<div>{{Useful Function}}<br />
<lowercasetitle/><br />
__NOTOC__<br />
This function loads the IMG container.<br />
==Syntax==<br />
<syntaxhighlight lang="lua">table engineLoadIMGContainer( string path )</syntaxhighlight><br />
<br />
===Required Arguments===<br />
* '''path''': The IMG file you want to load.<br />
<br />
==Code==<br />
<section name="Clientsided Script" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
local fileStream = {<br />
--Variable<br />
file = false;<br />
cacheSize = 1024*1024; --1MB<br />
cachedString = ""; <br />
cachedIndex = false;<br />
--Function<br />
loadFile = function(self,fname)<br />
if fileExists(fname) then<br />
self.file = fname<br />
end<br />
end;<br />
cache = function(self,offset)<br />
local filePath = self.file<br />
if filePath then<br />
local f = fileOpen(self.file)<br />
fileSetPos(f,offset)<br />
self.cachedString = fileRead(f,self.cacheSize)<br />
self.cachedIndex = offset<br />
fileClose(f)<br />
return str<br />
end<br />
return false<br />
end;<br />
get = function(self,offset,bytes,direct)<br />
local filePath = self.file<br />
if filePath then<br />
if direct then<br />
local f = fileOpen(filePath)<br />
fileSetPos(f,offset)<br />
local str = fileRead(f,bytes)<br />
fileClose(f)<br />
return str<br />
else<br />
if not self.cachedIndex then self:cache(offset) end<br />
local cacheStart,cacheEnd = self.cachedIndex,self.cachedIndex+self.cacheSize<br />
local readStart,readEnd = offset,offset+bytes<br />
local str = ""<br />
if readStart >= cacheStart then<br />
if readStart >= cacheEnd then<br />
self:cache(readStart)<br />
return self:get(offset,bytes)<br />
end<br />
if readEnd <= cacheEnd then<br />
return self.cachedString:sub(readStart-cacheStart+1,readEnd-cacheStart)<br />
else<br />
str = self.cachedString:sub(readStart-cacheStart+1)<br />
while true do<br />
self:cache(self.cachedIndex+self.cacheSize)<br />
local _cacheEnd = self.cachedIndex+self.cacheSize<br />
if self.cachedIndex+self.cacheSize >= readEnd then<br />
str = str..self.cachedString:sub(1,readEnd-self.cachedIndex)<br />
break<br />
else<br />
str = str..self.cachedString<br />
end<br />
end<br />
return str<br />
end<br />
else<br />
self:cache(readStart)<br />
return self:get(offset,bytes)<br />
end<br />
end<br />
end<br />
end;<br />
readChar = function(self,offset,bytes)<br />
local str = self:get(offset,bytes)<br />
local zero = str:find("%z")<br />
if zero then<br />
return str:sub(1,zero-1)<br />
end<br />
return str<br />
end;<br />
readNumber = function(self,offset,bytes)<br />
local str = self:get(offset,bytes)<br />
local num = 0<br />
for i=1,bytes do<br />
num = num+str:sub(i,i):byte()*0x100^(i-1)<br />
end<br />
return num<br />
end;<br />
}<br />
<br />
function engineLoadIMGContainer(file)<br />
assert(type(file) == "string","Bad argument @'engineLoadIMGContainer' at argument 1, expected a string got "..type(file))<br />
assert(fileExists(file),"Bad argument @'engineLoadIMGContainer' at argument 1, file "..file.." doesn't exist")<br />
local fs = fileStream<br />
fs:loadFile(file)<br />
local imgFile = {<br />
files = {},<br />
directory = {},<br />
directoryNameToIndex = {},<br />
}<br />
--Read Head<br />
local readIndex = 0<br />
local IMGVer = fs:readChar(readIndex,4)<br />
readIndex = readIndex+4<br />
imgFile.version = IMGVer<br />
local entriesCount = fs:readNumber(readIndex,4)<br />
readIndex = readIndex+4<br />
imgFile.entriesCount = entriesCount<br />
--Read Directory<br />
for index=1,entriesCount do<br />
local i = index-1<br />
local offset,streamingSize,sizeInArchive,name<br />
offset = fs:readNumber(readIndex,4)<br />
readIndex = readIndex+4<br />
streamingSize = fs:readNumber(readIndex,2)<br />
readIndex = readIndex+2<br />
sizeInArchive = fs:readNumber(readIndex,2)<br />
readIndex = readIndex+2<br />
name = fs:readChar(readIndex,24)<br />
readIndex = readIndex+24<br />
imgFile.directory[index] = {name=name,streamingSize=streamingSize*2048,sizeInArchive=sizeInArchive*2048,offset=offset*2048}<br />
imgFile.files[index] = name<br />
imgFile.directoryNameToIndex[name] = index<br />
end<br />
imgFile.getFile = function(self,name)<br />
if self then<br />
local index = imgFile.directoryNameToIndex[name]<br />
if index then<br />
local dirData = imgFile.directory[index]<br />
return fs:get(dirData.offset,dirData.streamingSize)<br />
end<br />
return false<br />
end<br />
end<br />
imgFile.fileExists = function(self,name)<br />
return imgFile.directoryNameToIndex[name] or false<br />
end<br />
imgFile.listFiles = function(self)<br />
return imgFile.files<br />
end<br />
return imgFile<br />
end<br />
</syntaxhighlight><br />
</section><br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
<syntaxhighlight lang="lua"><br />
<br />
local img = engineLoadIMGContainer("gta3.img")<br />
txd = engineLoadTXD(img:getFile("banshee.txd"))<br />
dff = engineLoadDFF(img:getFile("banshee.dff"))<br />
engineImportTXD(txd,411)<br />
engineReplaceModel(dff,411)<br />
</syntaxhighlight><br />
</section><br />
<br />
Author:thisdp<br />
<br />
==See Also==<br />
{{Useful_Functions}}</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=OnElementDimensionChange&diff=68469
OnElementDimensionChange
2021-01-30T11:36:19Z
<p>Cleopatradev: </p>
<hr />
<div>__NOTOC__<br />
{{Server event}}<br />
{{New feature/item|3.0160|1.5.8|20724|This event is triggered when the dimension of an [[element]] is changed using [[setElementDimension]].}}<br />
<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
int oldDimension, int newDimension<br />
</syntaxhighlight><br />
*'''oldDimension''': an [[int]] representing the dimension the [[element]] was in before.<br />
*'''newDimension''': an [[int]] representing the dimension the [[element]] is in now.<br />
<br />
==Source==<br />
The [[event system#Event source|source]] of this event is the [[element]] that changed its dimension.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
local vehicle = createVehicle ( 411, 0, 0, 3 )<br />
setTimer ( setElementDimension, 1000, 1, vehicle, 10 )<br />
<br />
addEventHandler ( "onElementDimensionChange", vehicle,<br />
function ( oldDimension, newDimension )<br />
outputChatBox ( inspect ( source ) .. "'s dimension changed from " .. oldDimension .. " to " .. newDimension )<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|1.5.8-9.20724|n/a|}}<br />
<br />
{{See also/Server event|Element events}}</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=Template:Client_object_functions&diff=68376
Template:Client object functions
2021-01-21T22:51:15Z
<p>Cleopatradev: </p>
<hr />
<div>*[[breakObject]]<br />
*[[createObject]]<br />
*[[getObjectMass]]<br />
*[[getObjectScale]]<br />
*[[isObjectBreakable]]<br />
*[[moveObject]]<br />
*[[respawnObject]]<br />
*[[setObjectBreakable]]<br />
*[[setObjectMass]]<br />
*[[setObjectScale]]<br />
*[[stopObject]]<br />
*[[toggleObjectRespawn]]<br />
{{New items|3.0157|1.5.6|<br />
*[[getObjectProperty]]<br />
*[[setObjectProperty]]<br />
|14370}}<br />
{{New items|3.0160|1.5.8|<br />
*[[isObjectMoving]]<br />
|20811}}<br />
<br />
<noinclude>[[Category:Functions templates]]</noinclude></div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=Template:Client_object_functions&diff=68375
Template:Client object functions
2021-01-21T22:51:00Z
<p>Cleopatradev: </p>
<hr />
<div>*[[breakObject]]<br />
*[[createObject]]<br />
*[[getObjectMass]]<br />
*[[getObjectScale]]<br />
*[[isObjectBreakable]]<br />
*[[moveObject]]<br />
*[[respawnObject]]<br />
*[[setObjectBreakable]]<br />
*[[setObjectMass]]<br />
*[[setObjectScale]]<br />
*[[stopObject]]<br />
*[[toggleObjectRespawn]]<br />
{{New items|3.0157|1.5.6|<br />
*[[getObjectProperty]]<br />
*[[setObjectProperty]]<br />
|14370}}<br />
{{New items|3.0160|1.6.0|<br />
*[[isObjectMoving]]<br />
|20811}}<br />
<br />
<noinclude>[[Category:Functions templates]]</noinclude></div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=Template:Client_object_events&diff=68374
Template:Client object events
2021-01-21T22:49:27Z
<p>Cleopatradev: </p>
<hr />
<div>*[[onClientObjectBreak]]<br />
*[[onClientObjectDamage]]<br />
*[[onClientObjectMoveStart]]<br />
*[[onClientObjectMoveStop]]<br />
<br />
<noinclude>[[Category:Events templates]]</noinclude></div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=IsObjectMoving&diff=68370
IsObjectMoving
2021-01-21T22:33:35Z
<p>Cleopatradev: Removed redirect to IsElementMoving</p>
<hr />
<div>__NOTOC__ <br />
{{Client function}}<br />
This function checks if the object is movings.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua">bool isObjectMoving ( object theObject )</syntaxhighlight><br />
===Required Arguments=== <br />
*'''theObject:''' The [[object]]<br />
===Returns===<br />
* ''true'' if the object is moving.<br />
* ''false'' if the object is not moving.<br />
<br />
==Example==<br />
This example creates an object when the resource starts and checks if the object is moving.<br />
<syntaxhighlight lang="lua"><br />
addEventHandler("onClientResourceStart", resourceRoot,<br />
function()<br />
local x, y, z = getElementPosition(localPlayer)<br />
object = createObject(1239, x, y, z)<br />
<br />
moveObject(object, 5000, x, y, z + 5)<br />
end<br />
)<br />
<br />
addCommandHandler("getmoving",<br />
function(cmd)<br />
outputChatBox("Is object "..(isObjectMoving(object) and "moving" or "not moving"))<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.8-9.20811|}}<br />
<br />
==See Also==<br />
{{Client_object_functions}}</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=OnClientObjectMoveStop&diff=68368
OnClientObjectMoveStop
2021-01-21T22:26:26Z
<p>Cleopatradev: </p>
<hr />
<div>__NOTOC__<br />
{{Client event}}<br />
This event is triggered when an object moves stop.<br />
<br />
==Source==<br />
The source of this event is the object which was moved.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
local obj = createObject(5239, -2417.22339, -606.70374, 132.56250)<br />
moveObject(obj, 3000, -2417.22339, -606.70374, 137.56250)<br />
<br />
addEventHandler("onClientObjectMoveStop", obj,<br />
function()<br />
outputChatBox("stopping moving object")<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.8-rc20811|}}<br />
<br />
==See Also==<br />
===Client object events===<br />
{{Client_object_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=OnClientObjectMoveStart&diff=68367
OnClientObjectMoveStart
2021-01-21T22:26:12Z
<p>Cleopatradev: </p>
<hr />
<div>__NOTOC__<br />
{{Client event}}<br />
This event is triggered when an object moves.<br />
==Source==<br />
The source of this event is the object which was moved.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
local obj = createObject(5239, -2417.22339, -606.70374, 132.56250)<br />
moveObject(obj, 3000, -2417.22339, -606.70374, 137.56250)<br />
<br />
addEventHandler("onClientObjectMoveStart", obj,<br />
function()<br />
outputChatBox("started moving object")<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.8-rc20811|}}<br />
<br />
==See Also==<br />
===Client object events===<br />
{{Client_object_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=OnClientObjectMoveStop&diff=68366
OnClientObjectMoveStop
2021-01-21T22:23:27Z
<p>Cleopatradev: Created page with "__NOTOC__ {{Client event}} This event is triggered when an object moves stop. ==Parameters== <syntaxhighlight lang="lua"> </syntaxhighlight> ==Source== The source of this ev..."</p>
<hr />
<div>__NOTOC__<br />
{{Client event}}<br />
This event is triggered when an object moves stop.<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
<br />
</syntaxhighlight><br />
<br />
==Source==<br />
The source of this event is the object which was moved.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
local obj = createObject(5239, -2417.22339, -606.70374, 132.56250)<br />
moveObject(obj, 3000, -2417.22339, -606.70374, 137.56250)<br />
<br />
addEventHandler("onClientObjectMoveStop", obj,<br />
function()<br />
outputChatBox("stopping moving object")<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.8-rc20811|}}<br />
<br />
==See Also==<br />
===Client object events===<br />
{{Client_object_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=OnClientObjectMoveStart&diff=68365
OnClientObjectMoveStart
2021-01-21T22:22:45Z
<p>Cleopatradev: Created page with "__NOTOC__ {{Client event}} This event is triggered when an object moves. ==Parameters== <syntaxhighlight lang="lua"> </syntaxhighlight> ==Source== The source of this event i..."</p>
<hr />
<div>__NOTOC__<br />
{{Client event}}<br />
This event is triggered when an object moves.<br />
==Parameters==<br />
<syntaxhighlight lang="lua"><br />
<br />
</syntaxhighlight><br />
<br />
==Source==<br />
The source of this event is the object which was moved.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
local obj = createObject(5239, -2417.22339, -606.70374, 132.56250)<br />
moveObject(obj, 3000, -2417.22339, -606.70374, 137.56250)<br />
<br />
addEventHandler("onClientObjectMoveStart", obj,<br />
function()<br />
outputChatBox("started moving object")<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==Requirements==<br />
{{Requirements|n/a|1.5.8-rc20811|}}<br />
<br />
==See Also==<br />
===Client object events===<br />
{{Client_object_events}}<br />
===Client event functions===<br />
{{Client_event_functions}}</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=IsBrowserRenderingPaused&diff=68246
IsBrowserRenderingPaused
2021-01-14T15:42:58Z
<p>Cleopatradev: Created page with "__NOTOC__ {{Client function}} {{New feature/item|3.0150|1.5|| This function gets the rendering state of a browser. }} ==Syntax== <syntaxhighlight lang="lua"> bool isBrowserRe..."</p>
<hr />
<div>__NOTOC__<br />
{{Client function}}<br />
{{New feature/item|3.0150|1.5||<br />
This function gets the rendering state of a browser.<br />
}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool isBrowserRenderingPaused ( browser webBrowser )<br />
</syntaxhighlight><br />
{{OOP|As of MTA: SA {{Current Version|master}} the counterpart is not implemented yet.|[[browser]]:isRenderingPaused|renderingPaused|setBrowserRenderingPaused}}<br />
<br />
===Required Arguments===<br />
*'''webBrowser:''' The browser<br />
<br />
===Returns===<br />
Returns the browser rendering paused state.<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
--In order to render the browser on the full screen, we need to know the dimensions.<br />
local screenWidth, screenHeight = guiGetScreenSize()<br />
<br />
--Let's create a new browser in remote mode.<br />
local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false)<br />
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window)<br />
<br />
-- The event onClientBrowserCreated will be triggered, after the browser has been initialized.<br />
-- After this event has been triggered, we will be able to load our URL<br />
local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser<br />
addEventHandler("onClientBrowserCreated", theBrowser, <br />
function()<br />
-- After the browser has been initialized, we can load www.youtube.com<br />
loadBrowserURL(source, "http://www.youtube.com")<br />
end<br />
)<br />
<br />
<br />
addCommandHandler ("pause", -- Add command named 'pause'<br />
function (player, command)<br />
if isBrowserRenderingPaused(theBrowser) then<br />
setBrowserRenderingPaused (theBrowser, false)<br />
else<br />
setBrowserRenderingPaused (theBrowser, true)<br />
end<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==See also==<br />
{{CEF_functions}}<br />
<br />
[[hu:setBrowserRenderingPaused]]<br />
[[RO:setBrowserRenderingPaused]]</div>
Cleopatradev
https://wiki.multitheftauto.com/index.php?title=SetBrowserRenderingPaused&diff=68245
SetBrowserRenderingPaused
2021-01-14T15:38:49Z
<p>Cleopatradev: /* Example */</p>
<hr />
<div>__NOTOC__<br />
{{Client function}}<br />
{{New feature/item|3.0150|1.5||<br />
This function sets the rendering state of a browser.<br />
}}<br />
{{MessageBox|bordercolorhex=FFB2B2|bgcolorhex=FFE5E5|image=File:Dialog-warning.png|title=Warning:|message=May cause issues with browser rendering on PC with low Ram [https://github.com/multitheftauto/mtasa-blue/issues/1567 #1567]. It's might be better to completely release browser, instead of pausing it, when its not needed.}}<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool setBrowserRenderingPaused ( browser webBrowser, bool paused )<br />
</syntaxhighlight><br />
{{OOP|As of MTA: SA {{Current Version|master}} the counterpart is not implemented yet.|[[browser]]:setRenderingPaused|renderingPaused|isBrowserRenderingPaused}}<br />
<br />
===Required Arguments===<br />
*'''webBrowser:''' The browser<br />
*'''paused:''' ''true'' to pause rendering, ''false'' to continue<br />
<br />
===Returns===<br />
Returns ''true'' if the state was successfully changed<br />
<br />
==Example==<br />
<syntaxhighlight lang="lua"><br />
--In order to render the browser on the full screen, we need to know the dimensions.<br />
local screenWidth, screenHeight = guiGetScreenSize()<br />
<br />
--Let's create a new browser in remote mode.<br />
local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false)<br />
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window)<br />
<br />
-- The event onClientBrowserCreated will be triggered, after the browser has been initialized.<br />
-- After this event has been triggered, we will be able to load our URL<br />
local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser<br />
addEventHandler("onClientBrowserCreated", theBrowser, <br />
function()<br />
-- After the browser has been initialized, we can load www.youtube.com<br />
loadBrowserURL(source, "http://www.youtube.com")<br />
end<br />
)<br />
<br />
<br />
addCommandHandler ("pause", -- Add command named 'pause'<br />
function (player, command, value)<br />
setBrowserRenderingPaused (theBrowser, value)<br />
end<br />
)<br />
</syntaxhighlight><br />
<br />
==See also==<br />
{{CEF_functions}}<br />
<br />
[[hu:setBrowserRenderingPaused]]<br />
[[RO:setBrowserRenderingPaused]]</div>
Cleopatradev