Jump to content

[Tables]


Max+

Recommended Posts

Making a table isn't that hard, all I know is that a table is the same as an array. The most usefull thing to do is in your situation is to create a double array (array in an array).

  
skins = { { "skinid", "skin desc" } , { "skinid","skin desc" } }; 
  

Then use a loop to get all the skins, and a math.rand to start off with. After that, just bind the left and right button/arrow keys to make it go to the next index of the array. :)

Link to comment

i dont mean skins table i mean how to make Spawn Manger with Buttons ,

if resource start show 3 buttons < -- Go -- >

if be press -- > then +1 skin

if < -- then -1 skin

go = spawn in spawn points ,

Just like Sa:Mp skin selector ,

Link to comment

Yes you can do that like this :

local ID = {  
[1] = {x,y,width,height,"Test[1]"}, 
[2] = {x,y,width,height,"Test[2]"} 
} 
  
for _,v in ipairs ( ID ) do 
        Button = guiCreateButton(v[1],v[2],v[3],v[4],v[5],false) 
    end 

Remember "relative" or not "true > false"

Link to comment

This is My Buttons it debug of mta script edtor i tryed close the tabel but i cant,

local ID = { 
[1] = [1.30,1.22,5,20,"<<<-"] 
[2] = [2.90,1.22,5,20,"->>>"] 
[3] = [1.80,1.22,5,20,"Ready!"] 

Now My GameMode it's 60% Tabels , it's Better,

Edited by Guest
Link to comment
localID = { 
{1.30,1.22,5,20,"<<<-"}, 
{2.90,1.22,5,20,"->>>"}, 
{1.80,1.22,5,20,"Ready!"} 
} 

You have to put a "," after a row of a table. Anyway you must use {} to define a table with multiple values, as you can get it with double table pointer:

  
for i, value in ipairs(localID) do 
        guiCreateButton(localID[value][1], localID[value][2], localID[value][3], localID[value][4], localID[value][5], false)  -- I copied Mr.Pres[T]ege's post values, but you can edit them 
end 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...