A3kri Posted July 20, 2012 Share Posted July 20, 2012 hello, I'm using a team selection + loginpanel that I found in the community and I managed to remove the login panel cuz I need the team selection only in the team selection there is select and close I removed the close button I want when the player clicks on select it puts him on the team ( which it does ) then close the gui of the team selection this is the select button code 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) Link to comment
Tete omar Posted July 20, 2012 Share Posted July 20, 2012 Show the full code please because i'm not sure of yours. Link to comment
A3kri Posted July 20, 2012 Author Share Posted July 20, 2012 Ook, sorry my fault --[[Panel created by: [FOTL]Danny]]-- --[[On 17th August 2011]]-- x,y = guiGetScreenSize() JobsWin = guiCreateWindow(x/3 - 170,y/3 - 20,200,320,"لوحة إختيار الفريق",false) teamsList = guiCreateGridList(0,22,186,255,false,JobsWin) column = guiGridListAddColumn( teamsList, "Teams", 0.85 ) for id, team in ipairs(getElementsByType("team")) do local row = guiGridListAddRow ( teamsList ) guiGridListSetItemText ( teamsList, row, 1, getTeamName ( team ), false, false ) guiGridListSetItemColor ( teamsList, row, 1, getTeamColor ( team ) ) end guiWindowSetMovable ( teamsList, false ) guiWindowSetMovable ( JobsWin, false ) guiWindowSetSizable ( teamsList, false ) guiWindowSetSizable ( JobsWin, false ) send = guiCreateButton(0,285,90,25,"Select",false,JobsWin) guiSetVisible(JobsWin, true) showCursor(true) setTimer ( showingTeams, 1000, 1) 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) addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), close) Link to comment
Tete omar Posted July 20, 2012 Share Posted July 20, 2012 try this --[[Panel created by: [FOTL]Danny]]-- --[[On 17th August 2011]]-- x,y = guiGetScreenSize() JobsWin = guiCreateWindow(x/3 - 170,y/3 - 20,200,320,"لوحة إختيار الفريق",false) teamsList = guiCreateGridList(0,22,186,255,false,JobsWin) column = guiGridListAddColumn( teamsList, "Teams", 0.85 ) for id, team in ipairs(getElementsByType("team")) do local row = guiGridListAddRow ( teamsList ) guiGridListSetItemText ( teamsList, row, 1, getTeamName ( team ), false, false ) guiGridListSetItemColor ( teamsList, row, 1, getTeamColor ( team ) ) end guiWindowSetMovable ( teamsList, false ) guiWindowSetMovable ( JobsWin, false ) guiWindowSetSizable ( teamsList, false ) guiWindowSetSizable ( JobsWin, false ) send = guiCreateButton(0,285,90,25,"Select",false,JobsWin) guiSetVisible(JobsWin, true) showCursor(true) setTimer ( showingTeams, 1000, 1) 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 ) guiSetVisible ( JobsWin , false ) guiSetInputEnabled ( false ) showCursor ( false ) end end end) addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), close) Link to comment
A3kri Posted July 20, 2012 Author Share Posted July 20, 2012 (edited) thanks you very much, it's working great. I have another problem if u could help me please ... the function of when u get killed is this function spawnWasted(player) repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 180, math.random(19,25) ) fadeCamera(player, true) setCameraTarget(player, player) setPlayerTeam (player, nil) takePlayerMoney ( player, 500 ) end I want when u get killed the gui of choosing a team reopens ( the gui in the last post u solved ) ---- I have another problem ( sorry for taking ur time ) my spawning file is this local teamsTable = { [ "Police" ] = { 1577 , -1694 , 6 } , [ "Destructive" ] = { 2498 , -1684 , 13 } , [ "Rebel" ] = { 1474 , -2247 , 13 } , } 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 ) I want to spawn with a specified skin .. I added the skin after the coordinates but it doesn't work [ "Police" ] = { 1577 , -1694 , 6, 280 } , Edited July 20, 2012 by Guest Link to comment
Castillo Posted July 20, 2012 Share Posted July 20, 2012 To show the GUI again, you must use triggerClientEvent. Link to comment
A3kri Posted July 20, 2012 Author Share Posted July 20, 2012 To show the GUI again, you must use triggerClientEvent. ty, but it didnt work this is my killed function spawnWasted(player) triggerClientEvent ( "Teams", getRootElement(), "Choose your new teams !" ) takePlayerMoney ( player, 500 ) end and this is my gui 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 ) addEvent( "Teams", true ) addEventHandler( "Teams", getRootElement(), greetingHandler ) guiSetVisible ( JobsWin , false ) guiSetInputEnabled ( false ) showCursor ( false ) end end end) and the whole gui file --[[Panel created by: [FOTL]Danny]]-- --[[On 17th August 2011]]-- x,y = guiGetScreenSize() JobsWin = guiCreateWindow(x/3 - 170,y/3 - 20,200,320,"لوحة إختيار الفريق",false) teamsList = guiCreateGridList(0,22,186,255,false,JobsWin) column = guiGridListAddColumn( teamsList, "Teams", 0.85 ) for id, team in ipairs(getElementsByType("team")) do local row = guiGridListAddRow ( teamsList ) guiGridListSetItemText ( teamsList, row, 1, getTeamName ( team ), false, false ) guiGridListSetItemColor ( teamsList, row, 1, getTeamColor ( team ) ) end guiWindowSetMovable ( teamsList, false ) guiWindowSetMovable ( JobsWin, false ) guiWindowSetSizable ( teamsList, false ) guiWindowSetSizable ( JobsWin, false ) send = guiCreateButton(0,280,190,25,"Select - إختيار",false,JobsWin) guiSetVisible(JobsWin, true) showCursor(true) setTimer ( showingTeams, 1000, 1) 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 ) addEvent( "Teams", true ) addEventHandler( "Teams", getRootElement(), greetingHandler ) guiSetVisible ( JobsWin , false ) guiSetInputEnabled ( false ) showCursor ( false ) end end end) addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), close) what is wrong ? help please Link to comment
Tete omar Posted July 20, 2012 Share Posted July 20, 2012 All, it makes no sense. yes A3kri that's right. Link to comment
A3kri Posted July 20, 2012 Author Share Posted July 20, 2012 (edited) u didn't understand me I mean, I read the wiki and made what is written but no result this is the gui file .lua --[[Panel created by: [FOTL]Danny]]-- --[[On 17th August 2011]]-- x,y = guiGetScreenSize() JobsWin = guiCreateWindow(x/3 - 170,y/3 - 20,200,320,"teams panel",false) teamsList = guiCreateGridList(0,22,186,255,false,JobsWin) column = guiGridListAddColumn( teamsList, "Teams", 0.85 ) for id, team in ipairs(getElementsByType("team")) do local row = guiGridListAddRow ( teamsList ) guiGridListSetItemText ( teamsList, row, 1, getTeamName ( team ), false, false ) guiGridListSetItemColor ( teamsList, row, 1, getTeamColor ( team ) ) end guiWindowSetMovable ( teamsList, false ) guiWindowSetMovable ( JobsWin, false ) guiWindowSetSizable ( teamsList, false ) guiWindowSetSizable ( JobsWin, false ) send = guiCreateButton(0,280,190,25,"Select - إختيار",false,JobsWin) guiSetVisible(JobsWin, true) showCursor(true) setTimer ( showingTeams, 1000, 1) 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 ) addEvent( "Teams", true ) addEventHandler( "Teams", getRootElement(), greetingHandler ) guiSetVisible ( JobsWin , false ) guiSetInputEnabled ( false ) showCursor ( false ) end end end) addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), close) and this is the function of death function spawnWasted(player) triggerClientEvent ( "Teams", getRootElement(), "Choose your new teams !" ) takePlayerMoney ( player, 500 ) end notice the triggerClientEvent ( "Teams", getRootElement(), "Choose your new teams !" ) and the addEvent( "Teams", true ) addEventHandler( "Teams", getRootElement(), greetingHandler ) this is what I've done , and it's not working Edited July 20, 2012 by Guest Link to comment
Castillo Posted July 20, 2012 Share Posted July 20, 2012 As I said, that is a mess, go back to the wiki and read how to do it properly. Link to comment
A3kri Posted July 20, 2012 Author Share Posted July 20, 2012 As I said, that is a mess, go back to the wiki and read how to do it properly. so depressing, anyway thanks =) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now