Jump to content

GridList Help


Dannz0r

Recommended Posts

Hello, I would need some help with a GridList, well I created the list and column, but I dont know how to make the column add rows with teams from the scoreboard, here is what I done until now:

--[[Panel created by: [FOTL]Danny]]-- 
--[[On 17th August 2011]]-- 
  
teamsList = guiCreateGridList(48,172,186,255,false ) 
column = guiGridListAddColumn( teamsList, "Teams", 0.85 ) 
                         
    guiWindowSetMovable ( teamsList, false ) 
    guiWindowSetSizable ( teamsList, false ) 
  
send = guiCreateButton(90,430,100,25, "Select" ,false) 
     
showCursor(true) 
guiSetVisible(JobsWin, true) 

And if possible to make this, when player selected a team and hit the button to set him on that team, thank you.

Link to comment
addEventHandler ( "onClientGUIClick", root, 
function ( button ) 
if button == "left" then 
if source == send then 
local row, col = guiGridListGetSelectedItem ( teamsList ) 
local teamName = guiGridListGetItemText ( teamsList, row, col ) 
triggerServerEvent ( "onPlayerChooseTeam", getLocalPlayer(), teamName ) 
end 
end 
end) 

server:

addEvent ( "onPlayerChooseTeam" , true ) 
addEventHandler ( "onPlayerChooseTeam" , root , 
function ( teamName ) 
local team = getTeamFromName ( teamName ) 
setPlayerTeam ( source , team ) 
end ) 

Link to comment

Umm, you need a table with the teams and the coordinates.

here:

local teamsTable = { 
[ "teamName1" ] = { spawnX , spawnY , spawnZ } , 
[ "teamName2" ] = { spawnX , spawnY , spawnZ } , 
[ "teamName3" ] = { spawnX , spawnY , spawnZ } 
} 
  
addEvent ( "onPlayerChooseTeam" , true ) 
addEventHandler ( "onPlayerChooseTeam" , root , 
function ( teamName ) 
local team = getTeamFromName ( teamName ) 
setPlayerTeam ( source , team ) 
local spawnX , spawnY , spawnZ = unpack ( teamsTable [ teamName ] ) 
spawnPlayer ( source , spawnX , spawnY , spawnZ ) 
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...