Jump to content

[Tables]


Max+

Recommended Posts

Posted

Hello Guys

Iam not Good in Tables,

i want to make a selection of skins and then spawn

Just like Sa:mp selection skin then spawn ? with buttons Right - Left - Spawn .

can some one show me an example ?

Posted

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. :)

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

Skin id is a numeric value not a string. Use local variables.

Posted

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 ,

Posted
No problem if you have problem with anything post it here and we will help you .

I really appreciate your help,

Posted

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"

Posted

I dont think that you can do it because it's something hard i dont think that i can do it but also i dont think any one can do it ._. because it's a Variables "Button" how can any one do it ._.? i dkn .

Posted (edited)

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
Posted

I mean the Buttons Table i show you

in the debug i must close the Table

go to mta script edtor and paste my Buttons Table and see the debug,

Posted

Maybe you can do some thing like :

local xxx = guiGetText(Button) 
          if xxx == "Test[1]" then 
                         -- do some fuck 
end; 
Posted
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 
  

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...