Jump to content

Weapon gridlist


Recommended Posts

Why this dont show me weapons on gridlist?

local weaponsTable = { {"Sniper",10,1200} } 
                     
function setweps () 
    for index, weapon in pairs(weaponsTable) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1])     
        guiGridListSetItemText (GUIEditor_Grid[1], row, 1, tostring(weapon[1]), false, true) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, 2, tostring(weapon[2]), false, true) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, 3, tostring(weapon[3]), false, true) 
    end 
end 
addEventHandler ( "onClientResourceStart", getThisResource(), setweps ) 
  

Link to comment

I cant see a the gridlist you made but if you are showing a part of your code then.

for index, weapon in pairs(weaponsTable) do  

Returns table then you should use this.

  
local weaponsTable = { {"Sniper",10,1200} } 
  
                     
  
function setweps () 
for k, v in pairs(weaponsTable) do 
    for index, weapon in pairs(v) do 
  
        local row = guiGridListAddRow(GUIEditor_Grid[1])     
  
        guiGridListSetItemText (GUIEditor_Grid[1], row, 1, tostring(weapon[1]), false, true) 
  
        guiGridListSetItemText (GUIEditor_Grid[1], row, 2, tostring(weapon[2]), false, true) 
  
        guiGridListSetItemText (GUIEditor_Grid[1], row, 3, tostring(weapon[3]), false, true) 
  
    end 
 end 
end 
  
addEventHandler ( "onClientResourceStart", getThisResource(), setweps ) 

Link to comment
I cant see a the gridlist you made but if you are showing a part of your code then.
for index, weapon in pairs(weaponsTable) do  

Returns table then you should use this.

  
local weaponsTable = { {"Sniper",10,1200} } 
  
                     
  
function setweps () 
for k, v in pairs(weaponsTable) do 
    for index, weapon in pairs(v) do 
  
        local row = guiGridListAddRow(GUIEditor_Grid[1])     
  
        guiGridListSetItemText (GUIEditor_Grid[1], row, 1, tostring(weapon[1]), false, true) 
  
        guiGridListSetItemText (GUIEditor_Grid[1], row, 2, tostring(weapon[2]), false, true) 
  
        guiGridListSetItemText (GUIEditor_Grid[1], row, 3, tostring(weapon[3]), false, true) 
  
    end 
 end 
end 
  
addEventHandler ( "onClientResourceStart", getThisResource(), setweps ) 

Nothing happens.

Link to comment
GUIEditor_Window = {} 
  
GUIEditor_TabPanel = {} 
  
GUIEditor_Tab = {} 
  
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Column = {} 
  
  
GUIEditor_Window[1] = guiCreateWindow(311,117,490,467,"SACR Weapon shop",false) 
guiSetVisible(GUIEditor_Window[1], false) 
GUIEditor_Grid[1] = guiCreateGridList(10,29,469,393,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
GUIEditor_Column[1] = guiGridListAddColumn(GUIEditor_Grid[1],"Weapon name:",0.6) 
GUIEditor_Column[2] = guiGridListAddColumn(GUIEditor_Grid[1],"Slot:",0.2) 
GUIEditor_Column[3] = guiGridListAddColumn(GUIEditor_Grid[1],"Price:",0.2) 
GUIEditor_Button[1] = guiCreateButton(9,430,228,27,"Buy",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(248,430,228,27,"Close",false,GUIEditor_Window[1]) 
GUIEditor_Window[2] = guiCreateWindow(350,223,376,205,"SACR Weapon licence",false) 
  
guiSetVisible(GUIEditor_Window[2], false) 
GUIEditor_Label[1] = guiCreateLabel(9,22,352,129,"If you want buy weapons,you must have licence!Licence price:$25.000.",false,GUIEditor_Window[2]) 
  
GUIEditor_Button[3] = guiCreateButton(16,165,152,29,"Buy licence",false,GUIEditor_Window[2]) 
  
GUIEditor_Button[4] = guiCreateButton(196,165,152,29,"Close",false,GUIEditor_Window[2]) 
  
local weaponsTable = { {"Sniper",10,1200} }                
  
function setweps () 
for k, v in pairs(weaponsTable) do 
    for index, weapon in pairs(v) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1])     
        guiGridListSetItemText (GUIEditor_Grid[1], row, 1, tostring(weapon[1]), false, true) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, 2, tostring(weapon[2]), false, true) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, 3, tostring(weapon[3]), false, true) 
    end 
 end 
end 
  
addEventHandler ( "onClientResourceStart", getThisResource(), setweps ) 

Link to comment

Try this

local weaponsTable = { {"Sniper",10,1200} }               
  
function setweps () 
    for index, weapon in pairs(weaponsTable) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1])     
        guiGridListSetItemText (GUIEditor_Grid[1], row, 1, weapon[1], false, true) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, 2, weapon[2], false, true) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, 3, weapon[3], false, true) 
    end 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, setweps ) 

Link to comment
Try this
local weaponsTable = { {"Sniper",10,1200} }               
  
function setweps () 
    for index, weapon in pairs(weaponsTable) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1])     
        guiGridListSetItemText (GUIEditor_Grid[1], row, 1, weapon[1], false, true) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, 2, weapon[2], false, true) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, 3, weapon[3], false, true) 
    end 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, setweps ) 

Working,but when I click on "Sniper" then just "Sniper" is marked.mta-screen2013-03-0310-3.png

GUIEditor_Window = {} 
  
GUIEditor_TabPanel = {} 
  
GUIEditor_Tab = {} 
  
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Column = {} 
  
  
GUIEditor_Window[1] = guiCreateWindow(311,117,490,467,"SACR Weapon shop",false) 
guiSetVisible(GUIEditor_Window[1], false) 
GUIEditor_Grid[1] = guiCreateGridList(10,29,469,393,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
GUIEditor_Column[1] = guiGridListAddColumn(GUIEditor_Grid[1],"Weapon name:",0.6) 
GUIEditor_Column[2] = guiGridListAddColumn(GUIEditor_Grid[1],"Slot:",0.2) 
GUIEditor_Column[3] = guiGridListAddColumn(GUIEditor_Grid[1],"Price:",0.2) 
GUIEditor_Button[1] = guiCreateButton(9,430,228,27,"Buy",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(248,430,228,27,"Close",false,GUIEditor_Window[1]) 
GUIEditor_Window[2] = guiCreateWindow(350,223,376,205,"SACR Weapon licence",false) 
guiSetVisible(GUIEditor_Window[2], false) 
GUIEditor_Label[1] = guiCreateLabel(9,22,352,129,"If you want buy weapons,you must have licence!Licence price:$25.000.",false,GUIEditor_Window[2]) 
GUIEditor_Button[3] = guiCreateButton(16,165,152,29,"Buy licence",false,GUIEditor_Window[2]) 
GUIEditor_Button[4] = guiCreateButton(196,165,152,29,"Close",false,GUIEditor_Window[2]) 
  
local weaponsTable = { {"Sniper",10,1200} }               
  
function setweps () 
    for index, weapon in pairs(weaponsTable) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1])     
        guiGridListSetItemText (GUIEditor_Grid[1], row, GUIEditor_Column[1], weapon[1], false, true) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, GUIEditor_Column[2], weapon[2], false, true) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, GUIEditor_Column[3], weapon[3], false, true) 
    end 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, setweps ) 

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