Jump to content

Gridlist Help


Recommended Posts

ammunation = {{"Brass Knuckle","1","15",1},{"Knife","1","250",4},{"Golf Club","1","20",2},{"Chainsaw","1","500",9},{"Pistol","51","100",22},{"Silenced","51","125",23},{"Deagle","77","300",24},{"Shotgun","10","100",25},{"Sawn-Off","20","100",26},{"SPAZ-12","70","500",27},{"UZI","100","125",28},{"MP5","120","300",29},{"Tec-9","100","100",31},{"AK-47","60","200",30},{"M4","50","200",31},{"Sniper","10","150",34},{"Country Sniper","10","100",33},{"Rocket","1","1000",35},{"Apple x1","1","15",16},{"Apple","10","125",16},{"Gas x1","1","25",17},{"Gas","10","200",17},{"Flowers","1","1",14}} 
  
addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()), 
function() 
  theAmmuNationWindow = guiCreateWindow(0.0012,0.5633,0.2738,0.435,"Ammu Nation",true) 
  guiSetVisible (theAmmuNationWindow,false) 
  guiWindowSetMovable(theAmmuNationWindow,false) 
  guiWindowSetSizable(theAmmuNationWindow,false) 
  theAmmuNationGridlist = guiCreateGridList(9,28,197,128,false,theAmmuNationWindow) 
  guiGridListSetSelectionMode(theAmmuNationGridlist,0) 
  theAmmuNationGridlistCol1 = guiGridListAddColumn(theAmmuNationGridlist,"Weapon Name",0.45) 
  theAmmuNationGridlistCol2 = guiGridListAddColumn(theAmmuNationGridlist,"Ammo",0.15) 
  theAmmuNationGridlistCol3 = guiGridListAddColumn(theAmmuNationGridlist,"$",0.2) 
  theAmmuNationBuyButton = guiCreateButton(9,162,198,40,"Buy!",false,theAmmuNationWindow) 
  theAmmuNationCloseButton = guiCreateButton(9,208,198,40,"Close",false,theAmmuNationWindow) 
  end 
  for i,v in ipairs (ammunation) do 
    local row = guiGridListAddRow (theAmmuNationGridlist) 
    guiGridListSetItemText (theAmmuNationGridlist,row,theAmmuNationGridlistCol1,v[1],false,false) 
    guiGridListSetItemText (theAmmuNationGridlist,row,theAmmuNationGridlistCol2,v[2],false,false) 
    guiGridListSetItemText (theAmmuNationGridlist,row,theAmmuNationGridlistCol3,v[3] .. "$",false,true) 
  end 
  ammuNationMarker = createMarker (295.91,-38.09,1000.51,"cylinder",1,0,255,255,127) 
  setElementInterior (ammuNationMarker,1) 
  setElementDimension (ammuNationMarker,1) 
   end 
   

[2011-04-21 20:41:47] SCRIPT ERROR: LosAngeles\gui.lua:17: ')' expected (to close '(' at line 3) near 'for'

[2011-04-21 20:41:47] WARNING: Loading script failed: LosAngeles\gui.lua:17: ')' expected (to close '(' at line 3) near 'for'

[2011-04-21 20:41:48] start: Resource 'LosAngeles' started

Link to comment
ammunation = {{"Brass Knuckle","1","15"},{"Knife","1","250"},{"Golf Club","1","20"},{"Chainsaw","1","500"},{"Pistol","51","100"},{"Silenced","51","125"},{"Deagle","77","300"},{"Shotgun","10","100"},{"Sawn-Off","20","100"},{"SPAZ-12","70","500"},{"UZI","100","125"},{"MP5","120","300"},{"Tec-9","100","100"},{"AK-47","60","200"},{"M4","50","200"},{"Sniper","10","150"},{"Country Sniper","10","100"},{"Rocket","1","1000"},{"Apple x1","1","15"},{"Apple","10","125"},{"Gas x1","1","25"},{"Gas","10","200"},{"Flowers","1","1"}} 
  
addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()), 
function() 
  theAmmuNationWindow = guiCreateWindow(0.0012,0.5633,0.2738,0.435,"Ammu Nation",true) 
  guiSetVisible (theAmmuNationWindow,false) 
  guiWindowSetMovable(theAmmuNationWindow,false) 
  guiWindowSetSizable(theAmmuNationWindow,false) 
  theAmmuNationGridlist = guiCreateGridList(9,28,197,128,false,theAmmuNationWindow) 
  guiGridListSetSelectionMode(theAmmuNationGridlist,0) 
  theAmmuNationGridlistCol1 = guiGridListAddColumn(theAmmuNationGridlist,"Weapon Name",0.45) 
  theAmmuNationGridlistCol2 = guiGridListAddColumn(theAmmuNationGridlist,"Ammo",0.15) 
  theAmmuNationGridlistCol3 = guiGridListAddColumn(theAmmuNationGridlist,"$",0.2) 
  theAmmuNationBuyButton = guiCreateButton(9,162,198,40,"Buy!",false,theAmmuNationWindow) 
  theAmmuNationCloseButton = guiCreateButton(9,208,198,40,"Close",false,theAmmuNationWindow) 
  for i,v in ipairs (ammunation) do 
    local row = guiGridListAddRow (theAmmuNationGridlist) 
    guiGridListSetItemText (theAmmuNationGridlist,row,theAmmuNationGridlistCol1,v[1],false,false) 
    guiGridListSetItemText (theAmmuNationGridlist,row,theAmmuNationGridlistCol2,v[2],false,false) 
    guiGridListSetItemText (theAmmuNationGridlist,row,theAmmuNationGridlistCol3,v[3] .. "$",false,true) 
  end 
  ammuNationMarker = createMarker (295.91,-38.09,1000.51,"cylinder",1,0,255,255,127) 
  setElementInterior (ammuNationMarker,1) 
  setElementDimension (ammuNationMarker,1) 
end 
) 
  

1. You goted in tabel unneeded arguemtns, even without " and ".

2. For that error, you ended function to early, one end was unneeded ( replaced with ")" ) [ To finish the addEventHandler ]

This isnt tested, but should work :P

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