Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. Kenix

    cleo

    No. Only lua + mta functional.
  2. 1) Вернёт тебе строку ( см аргументы функции ) 2) То что ты делаешь мне не ясно. Мб ты имел ввиду добавить индекс со значением в таблицу? a = { } a[ 'булочек' ] = 5 a[ 5 ] = 'булочек' a[ 0xFFFFFF ] = 0xFFFFFF a[ 'print' ] = print a[ a ] = a; print( a[ 5 ] ) -- булочек print( a[ 'булочек' ] ) -- 5 print( a[ 'print' ]( 'print' ) ) -- print print( a[ 0xFFFFFF ] ) -- 16777215 -- Рекурсия print( a[ a ][ a ][ a ][ a ][ a ][ a ][ a ][ a ][ a ][ a ][ a ] ) -- table: 0x18bb3b0
  3. Да. Через цикл прошарь массив. local aMarkers = { [1] = { [1] = 1212.222, [2] = -1932.142, [3] = 1242.963, [4] = { [1] = "TEXT1", [2] = "LOOL", [3] = "GL&HF", [4] = "trolol", [5] = "zzz" } }; [2] = { [1] = 1212.222, [2] = -1932.142, [3] = 1242.963, [4] = { [1] = "TEXT2", [2] = "LOL", [3] = "GLHF" } }; } for n, s in ipairs( aMarkers[1][4] ) do if s == 'zzz' then print( 'found = ', n, ' (index)' ) -- found = 5 (index) end end
  4. Vincent правильный код написал. local aMarkers = { [1] = { [1] = 1212.222, [2] = -1932.142, [3] = 1242.963, [4] = { [1] = "TEXT1", [2] = "LOOL", [3] = "GL&HF", [4] = "trolol", [5] = "zzz" } }; [2] = { [1] = 1212.222, [2] = -1932.142, [3] = 1242.963, [4] = { [1] = "TEXT2", [2] = "LOL", [3] = "GLHF" } }; } local nIndex = math.random( #aMarkers[1][4] -- Получаем кол-во индексов в массиве. В данном случае это 5 ) -- берём случайное число с 1 до кол-ва индексов в массиве. В данном случае это 5 print( aMarkers[1][4][ nIndex ] ) Добавил индексы. ( чтобы понятнее было )
  5. Kenix

    bindKey Joypad

    https://wiki.multitheftauto.com/wiki/OnClientKey ?
  6. trigger to server -> trigger to client -> triggerServerEvent triggerClientEvent
  7. Kenix

    problem

    addEventHandler( 'onClientMouseEnter', ButtonPlay, function( ) playSound 'beep.mp3' end , false ) Try use getPropagated to false https://wiki.multitheftauto.com/wiki/AddEventHandler
  8. Anybody not help you with stolen script.
  9. 1) Compiler How to install? Download "lua5_1_4_(YOUR OS)_bin.(zip_OR_tar.gz)" hence http://luabinaries.sourceforge.net/download.html Extract this file in folder C:\Program Files\Lua (this path will be used) Next hit F5 and in window enter this command "C:\Program Files\Lua\luac5.1.exe" -s -o "$(FULL_CURRENT_PATH)c" -- "$(FULL_CURRENT_PATH)" If you want use combination keys for compile. Click on button "Save". 2) Syntax checker (by Talidan) Original topic 3) Highlighting by Fro How to install? Copy files to directory: plugins\MTALua.dll and plugins\FunctionList.dll in folder PROGRAM_FOLDER\plugins\ plugins\config in folder PROGRAM_FOLDER\Notepad++\plugins\config\ How do I run it? Select Language -> MTALua Download 4) Auto-Completion by Buffalo (Updated by JR10) How to install? Save file lua.xml in PROGRAM_FOLDER\plugins\APIs How do I run it? Select Language -> Lua. Please Don't forget restart notepad++ ! Download 5) Highlighting by Fro with auto-completion by Buffalo. How to install? plugins\MTALua.dll and plugins\FunctionList.dll in folder PROGRAM_FOLDER\plugins\ plugins\config\ in folder PROGRAM_FOLDER\Notepad++\plugins\config\ plugins\APIs\ in folder PROGRAM_FOLDER\Notepad++\plugins\APIs\ How do I run it? Select Language -> MTA Lua. Please Don't forget restart notepad++ ! Download
  10. Kenix

    Real Time

    Client side local nX, nY = guiGetScreenSize( ) addEventHandler( 'onClientRender', root, function( ) dxDrawText( string.format( '%s %s', getRealTime( ).hour, getRealTime( ).minute ), 0.9 * nX, 0.1 * nY ) end ) ? Updated.
  11. Есть проблема. Метод AutoSize в лейблах работает тока с ansi кодировкой. Т.е если я напишу текст по русски, то размер не будет автоматом установлен.
  12. Это не верный код. После таблиц должно быть ',' или ';' local aMarkers = { { 1212.222, -1932.142, 1242.963, 'TEXT' }; { 1212.222, -1932.142, 1242.963, 'TEXT2' }; } function GetTextFromMarkerData( pMarker ) if isElement( pMarker ) and getElementType( pMarker ) == 'marker' then local nData = getElementData( pMarker, 'Marker:ID' ) if type( nData ) == 'number' then return aMarkers[ nData ][ 4 ] -- получаем текст из массива aMarkers. aMarkers[ номер индекса который вернёт дата Marker:ID ][ 4 ] end return false end return false end function OnMarkerHit( pElement ) if isElement( pElement ) and getElementType( pElement ) == 'player' and not isPedInVehicle( pElement ) then outputChatBox( 'ID) ' .. tostring( getElementData( source, 'Marker:ID' ) ) .. ' ,Text = ' .. tostring( GetTextFromMarkerData( source ) ) ) end end for n, a in ipairs( aMarkers ) do -- лупим массив aMarkers local pMarker = createMarker( a[1], a[2], a[3] ) -- создаём маркер setElementData( pMarker, 'Marker:ID', n ) -- задаём дату ида маркера ( из цикла получаем номер индекса ) addEventHandler( 'onMarkerHit', pMarker, OnMarkerHit ) -- добавляем обработчик end ?
  13. https://wiki.multitheftauto.com/wiki/DxDrawText https://wiki.multitheftauto.com/wiki/GuiCreateLabel
  14. В meta.xml ресурса zombies. Выстави значение параметра StreamMethod на 2. <setting name="*StreamMethod" value="[2]" />
  15. Try this addEvent ( 'onVisibleButtons', true ) local iRotation = 0 local nScreenX, nScreenY = guiGetScreenSize( ) local pPed aLocations = { 'Los Santos'; 'San Fierro'; 'Las Venturas'; } aGUI = { guiCreateButton ( 0.3688, 0.84, 0.0625, 0.055, '<', true ); guiCreateButton ( 0.5013, 0.84, 0.0625, 0.055, '>', true ); guiCreateButton ( 0.4013, 0.9067, 0.1287, 0.065, 'Empezar a Jugar', true ); guiCreateEdit ( 0.4412, 0.8367, 0.05, 0.0567, '', true ); } guiEditSetReadOnly ( aGUI[4], true ) for _, pGui in pairs ( aGUI ) do guiSetVisible ( pGui, false ) end function drawText ( ) local nCount = getTickCount( ) if nCount - getTickCount( ) == dxDrawText ( tostring ( aLocations[1] ), 0.433 * nScreenX, 0.539 * nScreenY, 0.641 * nScreenX, 0.585 * nScreenY, tocolor ( 255, 255, 255, 255 ), 3, 'default', 'left', 'top', false, false, true ) cCity = aLocations[1] end function drawTextTwo ( ) dxDrawText ( tostring ( aLocations[2] ), 0.433 * nScreenX, 0.539 * nScreenY, 0.641 * nScreenX, 0.585 * nScreenY, tocolor ( 255, 255, 255, 255 ), 3, 'default', 'left', 'top', false, false, true ) cCity = aLocations[2] end function drawTextThree ( ) dxDrawText ( tostring ( aLocations[3] ), 0.433 * nScreenX, 0.539 * nScreenY, 0.641 * nScreenX, 0.585 * nScreenY, tocolor ( 255, 255, 255, 255 ), 3, 'default', 'left','top', false, false, true ) cCity = aLocations[3] end function btnSource ( ) if ( source == aGUI[3] ) then for _, guiElement in pairs ( aGUI ) do guiSetVisible ( guiElement, false ) end showCursor ( false ) setCameraTarget ( localPlayer ) destroyElement ( pPed ) unbindKey ( 'space' ) removeEventHandler ( 'onClientRender', root, drawText ) setElementPosition ( localPlayer, 731.21276855469, -1276.6033935547, 17.6484375 ) elseif ( source == aGUI[1] ) then if ( getElementModel ( pPed ) == 0 ) then setElementModel ( pPed, 288 ) else setElementModel ( pPed, getElementModel ( pPed ) - 1 ) end guiSetText ( aGUI[4], getElementModel ( pPed ) ) elseif ( source == aGUI[2] ) then if ( getElementModel ( pPed ) == 288 ) then setElementModel ( pPed, 0 ) else setElementModel ( pPed, getElementModel ( pPed ) + 1 ) end guiSetText ( aUI[4], getElementModel ( pPed ) ) end end function rotatePed ( ) if ( not isElement ( pPed ) ) then return end iRotation = iRotation + 1 if iRotation == 360 then iRotation = 0 end setPedRotation ( pPed, iRotation ) end function changeLoc ( ) if ( cCity == aLocations[1] ) then removeEventHandler ( 'onClientRender', root, drawTextOne ) addEventHandler ( 'onClientRender', root, drawTextTwo ) elseif ( cCity == aLocations[2] ) then removeEventHandler ( 'onClientRender', root, drawTextTwo ) addEventHandler ( 'onClientRender', root, drawTextThree ) elseif ( cCity == aLocations[3] ) then removeEventHandler ( 'onClientRender', root, drawTextThree ) addEventHandler ( 'onClientRender', root, drawTextOne ) end end addEventHandler ( 'onVisibleButtons', localPlayer, function ( ) for _, pGui in pairs ( aGUI ) do guiSetVisible ( pGui, true ) end showCursor ( true ) addEventHandler ( 'onClientRender', root, drawTextOne ) addEventHandler ( 'onClientRender', root, rotatePed ) addEventHandler ( 'onClientGUIClick', guiRoot, btnSource ) bindKey ( 'space', 'down', changeLoc ) pPed = createPed ( 0, 756.03051757813, -1239.4184570313, 13.552116394043 ) end )
  16. Kenix

    Need help with algorithm

    No, he moving and if ped see wall he will turn right or left.
  17. Kenix

    Need help with algorithm

    Yes i did make this via processLineOfSight.
  18. I started make script zombies, but i found a problem. Example Click for see I need know when zombie need turn left/right without waypoints and reach to player.
×
×
  • Create New...