Jump to content

Search the Community

Showing results for tags 'index'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 3 results

  1. redditing

    Table

    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'
  2. 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 all index to +1, so the new message will get the first index end end end addEventHandler ("onClientRender", root, drawChat)
  3. Hi guys, I made a chatbox script myself and all is working perfectly with no errors or warnings in /debugscript 3. I am using a table to save the messages that will be displayed in the chatbox. This is how a part of it looks like: local chatBox = {} function drawChat() for i,v in ipairs (chatBox) do if i < 15 then dxDrawBorderedText(v, 27, 229 - 15*i, 582, 230, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "top", false, false, false, false, false) end end end addEventHandler("onClientRender", root, drawChat) I have no problems to display the first 14 messages, but now I want the last ( first message) to disappear when there comes a new 15th message. But I have no idea how to script it. So it could be nice if someone could help me.
×
×
  • Create New...