Jump to content

Search the Community

Showing results for tags 'table'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



About Me





Found 25 results

  1. Hey. After around a 2 years of scripting i've decided to share a bit of my knowledge which i've learnt - thanks to very special person which is @IIYAMA, without him i couldn't make this tutorial, greets! When it comes to synchronising data you have two ways: a) Element data b) Tables Which of course have own pros and cons. This tutorial is focused on tables. And covers such topics as: - Basic details about tables & element data - Data validation - Usage of helper functions to create data system based on tables - Usage of buffer to reduce trigger calls
  2. table = {} function table.contains(table, element) for _, value in pairs(table) do if value == element then return true end end return false end function tablefind(tab,el) for index, value in pairs(tab) do if value == el then return index end end end function OnClientGuiButton() if not table.contains(BedwarsEQ, "P1") then table.insert(table, "P1") -- Insert to a table string "P1" (Player1) end if tablefind(table, "P1")==1 then -- check index, if is Item in index(1) then == true AdxItem1 = 255 -- dxDrawImage, drawing image to effect SLOT1 = SLOT1 + 1
  3. redditing


    I wanted to ask if there is a way to check what index the value in the table is for example, t = {} table.insert(t,"Hello") table.insert(t,"HELLO") table.insert(t,"HI") if index==1 and value=="HI" then -- false --do something elseif index==0 and value=="HELLO" then --false --do something elseif index==2 and value=="HI" then --true --do something else --etc. --do something end --If someone does not distinguish the index from the value then the index is for example [0,1,2,3 ...] and the value is an element for example print(t[1]) -------------> 'HELLO'
  4. I have this: -- 2 points on each city. local spawnCoords = { {1125, -2036, 69.89, -90}, {2504, -1686, 13.55, 45}, {-1972, 643, 46.57, -45}, {-2720, -317, 7.85, 45}, {2023, 1008, 10.83, -90}, {1298, 2084, 12.83, -90}, } -- all skins. local validSkins = {0, 1, 2, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 9
  5. Iae rapaziada, seguinte fiz um code simples só para aprender melhor tabela, até agora estava tudo normal criando as markers, a mensagem na tela e tudo mais.... porém agora estou com o seguinte problema: São 3 markers cada uma tem uma cadeira do lado. O que tenho em mente é que quando o player hitar uma das markers binde a tecla E, ao pressiona-la ele é colocado sobre a cadeira em que ele esta próximo. Mas no sistema atual o problema é que ele não reconhece qual cadeira é! Quero saber como eu posso fazer uma verificação para saber se a marker é da cadeira [1], [2] ou [3]. Code: l
  6. local table = { {"1", "2", "3", "4"}, } function asdasdsdasdd() table.insert(table,"5","6","7","8") end What wrong? No errors and warnings in debugscript 3...
  7. for i, markers in pairs(Entregas_Gases) do Markers_M = createMarker( markers[1], markers[2], markers[3]-1, "cylinder", 3, 255, 255, 255, 20) end for i, blipsMarkers in pairs(Entregas_Gases) do blipsM = createBlip(blipsMarkers[1], blipsMarkers[2], blipsMarkers[3], 41) end function teste1(source) msg.default("vc pisou no marker", source) end addEventHandler("onMarkerHit", Markers_M, teste1) Seguinte, quando eu coloco essas linhas de
  8. Boa noite rapaziada, bom eu to fazendo um painel login e adicionei 3 musicas que tocam aleatoriamente em uma tabela nomeada (Tab_Musicas), no entanto ao player entrar na tela de login eu gostaria que aparecesse o nome da musica a qual esta tocando! E é ai que entra minha duvida. Como eu poderia estar especificando em um dxDrawText qual musica esta tocando no momento? Linhas de código abaixo: Tabela: local Tab_Musicas = {"musicas/musica1.mp3", "musicas/musica2.mp3", "musicas/musica3.mp3"} Momento em que a musica se inicia: function onClientResourceStart() fadeCamera(tr
  9. I created a scoreboard system, but when i make a team, the team does not show in scoreboard.. how can i add this after playerlist?
  10. client: local Admins = {} addEvent("updateAdmins",true) addEventHandler("updateAdmins",root, function(t) Admins = t end) function isPlayerAdmin(player) if(Admins[player]) then return true end return false end function asdi() for k,v in ipairs(Admins) do outputChatBox(k) end end addCommandHandler("asd",asdi) server: local Admins = {} function isPlayerAdmin(player) if(Admins[player]) then return true end return false end addEventHandler("onPlayerLogin",root, function() if isObjectInACLGroup ( "user." ..
  11. if i create a table, and i insert datas with table.insert, the datas are deleted when i reconnect.. why? how to save datas? sorry for my terrible english :ss
  12. local vehicles = {} addEventHandler("cmdHandler",getRootElement(), function(thePlayer, command) if(command == "/dveh") then for i, v in ipairs (vehicles) do local player, veh = unpack(v) if (player == thePlayer) then destroyElement (veh) table.remove (vehicles, i) return end end end end ) Hi, I want the script to delete all vehicles and rows, but it only deletes the last one, why ?
  13. Why the table disappears after the cycle? Never this was not. shel = {} local shelPlaces = { [1] = { [1] = {x=0,y=0,z=0}, [2] = {x=0,y=0,z=0}, [3] = {x=0,y=0,z=0}, }, } function createShelters(gameId, players) local gameId = tonumber(gameId) shel[gameId] = {} for i=1,#shelPlaces do --outputDebugString("table "..shel[gameId]) shel[gameId][i] = { ["places"] = { [1] = {x=shelPlaces[i][1].x,y=shelPlaces[i][1].y,z=shelPlaces[i][1].z,["object"]="craftTable"}, }, } outputChatBox(shel[1][1]["places"][1]["object"]) -- WORKING for pI=2,#shelPlaces[i] do shel[gameId
  14. Hello, I am scripting a new chat and the stuff I scripted is working. But now I have a problem. In my chat I am printing the first 13 messages in dxDraw. But now I want all indexes to +1, so if there come a 14th message it gets visible. local offset = 14 function drawChat() for i, v in ipairs (chatbox) do if (i < offset) then exports.login:dxDrawBorderedText(v, 36, (210 - ((offset-i)*15)), 411, 210, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) elseif (i == 14) then --what to add ? I want
  15. Hello, I have been writing gamemode for a long time, everything that is important (information about the vehicle, player, object) is stored on the server side in the table. My question is: what is safer and more optimal? Variables saved on the server side in the table and called to the client by events or elementData?
  16. I want create a script, which create a marker with random position, from a table. How to make this?
  17. Hello. As you can see, in my script i attached 2 weapons to a vehicle. I set a bind for shooting one of the gun. My problem is that when i start the function called "fire_gun_c" then both of the weapons will be fired. So my question is how can i only shoot the weapon "gun1" by using getAttachedElements? client function attach() local gun1 = createWeapon(31, 0,0,0) local gun2 = createWeapon(31, 0,0,0) attachElements ( gun1, veh, 0, 1, 0) attachElements ( gun1, veh, 0, -1, 0) end function fire_gun_c(veh) local attachedElements = getAttachedElements(veh) for ElementKey
  18. Hey, I have a problem this code working player in server. But no working when player quit. exitLobby = function(self) local previousLobby = getElementData(localPlayer, "player:selectedLobby") if previousLobby then if self.lobbies[previousLobby] then for k,v in ipairs(self.lobbies[previousLobby].players) do if v == localPlayer then table.remove(self.lobbies[previousLobby].players, k) end end end end setElementData(resourceRoot, "root:lobbies", self.lobbies) setElementData(localPlayer, "player:selectedLobby", false) exports["br_notifi
  19. Hello everyone! I am beginner in all of this. I am a hobby scripter, because I have interest in scripting. BUT I have problem. I want to make a skill system(like you shoot a leg you get 1points for that), and I found a free resource that varies your skill up to 999 in server side and I found another one that do this client side.(also I won't use it like my scripts in a server) OK I have problems with client AND server side too. I can't connect and update the variable. I created a table for the UZI skill (uzi_skill) to try it, but I can't get working. Original source: https://community.multi
  20. Hello, I am creating a PIN system on my server and wanted to ask you for help in my code. When I send the client to the server a trigger wanted to validate if the pin sent from the client to the server is an element of my table if yes setElementData will work and the Pin used will be unable to use again but in my script when it uses a pin all The others are disabled, can you help me? Note: I'm Brazilian, I'm sorry for English. local pins15k = {"UAIFKAJDKEFC15K", "KYJFKAJDEFKC15K", "BESFKSLLKEFC15K"} function PinEdit(Pin) if validatePin(Pin) then if getElementData(source, "Diam
  21. Hello again. I have problem with table.insert. I have vehicle shop that saves data to tables and tables to element data. Always when you buy new vehicle, it should add sub-table to main-table and fill sub-table with data that i want to save. I also have panel where you can control your vehicles. Instead of showing data, the gridlist shows only number 1 in first column. Part of my code: [Server] local data = getElementData(client, "wangcars.data") if not data then setElementData(client, "wangcars.data", {}) end local data = getElementData(client, "
  22. --[[ -- Resource Name: Information. -- Author: Om (RipeMangoes69) -- Date: 4/12/2016 -- File: client.lua ]]-- -- GUI GUIEditor = { window = {}, label = {}, memo = {} } function createInfoObjects() local markers = { {area = "Los Santos Airport", x = 1582.45, y = -2286.32, z = 12}, {area = "Las Vegas Airport", x = 1674.30859375, y = 1444.9501953125, z = 9.2} } for _, m in ipairs(markers) do local marker = createMarker(m.x, m.y, m.z, "cylinder", 1, 255, 255, 255, 100) GUIEditor.window[1] = guiCreateWindow(645, 250, 266, 378, "Information: " .. m.area, false) guiWindowS
  23. Buenas, estoy creando un sistema de nametags cliente y estoy usando tablas, para que así cuando se loguee/desloguee, se muestre o no el texto en cuestión (el nametag). Todo va correcto, el problema que tengo es a la hora de usar table.insert, que sigue renderizando el nombre local nametags = { } local font = dxCreateFont( "fuente.ttf" ) addEvent( "nmtgs:onPlayerLogin", true ) addEvent( "nmtgs:onPlayerQuit", true ) addEventHandler( "onClientRender", root, function( ) if #nametags > 0 then for i=1, #nametags do local player = nametags[i] local px, py, pz = getElementPosit
  24. Hello everyone I currently have this function that develops, and some time and I wanted to make a change most do not know it as good is simple. local positions = { { 371, -2040, 8 }, { 2274, -1036, 52 }, { -2245, -1723, 482 }, { -155, -2889, 428 }, } function DisappearPlayer (NamePlayer, Admin) local azar = math.random ( #positions ) local veh = getPedOccupiedVehicle(NamePlayer) if (veh) then setElementPosition(veh, unpack ( positions [ azar ] ) ) else setElementPosition(NamePlayer, unpack ( positions [ azar ] ) ) end end addEvent("ran
  25. Good'm creating a tuning shop for my RPG server. most did not want to use files files to decrease the MB script ... so I had the idea of creating music using random using playSound3D URL .. but I have two errors. ERROR 1 = Table does not work. ERROR 2 = He is not changing the interior or the size of the element. can anyone point me a correct direction or point out the error in my script? Client Sid local URLMusics = { {'https://albireo1.sscdn.co/palcomp3/2/a/b/9/equipeinsanos-tribo-da-periferia-mussoumano-convida-6ec60699.mp3'}, {'https://japeto.ssc
  • Create New...