villr Posted September 1, 2010 Share Posted September 1, 2010 Hi Im having a trobule with my spawning gui and its when a player tex. click police and when you click "trucker" its dosent change text Here is code spawnmenu = guiCreateWindow(573,383,220,213,"Spawn Menu",false) spawnmenugrid = guiCreateGridList(0.1273,0.1174,0.7545,0.6677,true,spawnmenu) guiGridListSetSelectionMode(spawnmenugrid,2) guiGridListAddColumn(spawnmenugrid,"Spawn Team",0.9) spawnmenubutton = guiCreateButton(0.1636,0.7887,0.7136,0.1174,"Spawn",true,spawnmenu) spawnmenumemo = guiCreateMemo(187,484,362,99,"",false) guiSetText ( spawnmenumemo, "Pick a team!!" ) guiMemoSetCaretIndex(spawnmenumemo,true) showCursor ( true ) spawnteams= {{"Mechanics"},{"Taxi"},{"Police"},{"Hippie"},{"Limo Driver"},{"Medic"},{"Maffia"},{"Truckers"}} for i,v in ipairs (spawnteams) do local row = guiGridListAddRow (spawnmenugrid) guiGridListSetItemText (spawnmenugrid, row, 1, v[1], false, true) guiGridListSetItemText (spawnmenugrid, row, 2, v[2], false, true) end function guiClick (button, state, absoluteX, absoluteY) if (source == spawnmenubutton) then if not (guiGridListGetSelectedItem (spawnmenugrid) == false) then local row,col = guiGridListGetSelectedItem (spawnmenugrid) local spawnteamname = guiGridListGetItemText (spawnmenugrid, row, 1) outputChatBox ( "." ..spawnteamname ) else outputChatBox ("First select your location please.", 255, 0, 0, true) end end end addEventHandler ("onClientGUIClick", getRootElement(), guiClick) function gridClick ( state, absoluteX, absoluteY) if not (guiGridListGetSelectedItem (spawnmenugrid) == false) then local row,col = guiGridListGetSelectedItem (spawnmenugrid) if ( guiGridListGetSelectedItem (spawnmenugrid) ~= "Hippie" )then guiSetText ( spawnmenumemo, "baaaaaaarrrrskkkkkkk...") if ( guiGridListGetSelectedItem (spawnmenugrid) ~= "Police" )then guiSetText ( spawnmenumemo, "Police will blablalbla") else outputChatBox ("...." ) end end end end addEventHandler ("onClientGUIClick", spawnmenugrid, gridClick) Its in the line 37-39 that text is And here is pic of the gui and where the text pop up http://img294.imageshack.us/img294/5396/namnlsyw.png I hope you guys know how to help me Link to comment
Castillo Posted September 1, 2010 Share Posted September 1, 2010 this should do the job, spawnmenu = guiCreateWindow(573,383,220,213,"Spawn Menu",false) spawnmenugrid = guiCreateGridList(0.1273,0.1174,0.7545,0.6677,true,spawnmenu) guiGridListSetSelectionMode(spawnmenugrid,2) guiGridListAddColumn(spawnmenugrid,"Spawn Team",0.9) spawnmenubutton = guiCreateButton(0.1636,0.7887,0.7136,0.1174,"Spawn",true,spawnmenu) spawnmenumemo = guiCreateMemo(187,484,362,99,"",false) guiSetText ( spawnmenumemo, "Pick a team!!" ) guiMemoSetCaretIndex(spawnmenumemo,true) showCursor ( true ) spawnteams= {{"Mechanics"},{"Taxi"},{"Police"},{"Hippie"},{"Limo Driver"},{"Medic"},{"Maffia"},{"Truckers"}} for i,v in ipairs (spawnteams) do local row = guiGridListAddRow (spawnmenugrid) guiGridListSetItemText (spawnmenugrid, row, 1, v[1], false, true) guiGridListSetItemText (spawnmenugrid, row, 2, v[2], false, true) end function guiClick (button, state, absoluteX, absoluteY) if (source == spawnmenubutton) then if not (guiGridListGetSelectedItem (spawnmenugrid) == false) then local row,col = guiGridListGetSelectedItem (spawnmenugrid) local spawnteamname = guiGridListGetItemText (spawnmenugrid, row, 1) outputChatBox ( "." ..spawnteamname ) else outputChatBox ("First select your location please.", 255, 0, 0, true) end end end addEventHandler ("onClientGUIClick", getRootElement(), guiClick) function gridClick ( state, absoluteX, absoluteY) local campos = guiGridListGetItemText ( spawnmenugrid, guiGridListGetSelectedItem ( spawnmenugrid ), 1 ) if campos == "Hippie" then guiSetText ( spawnmenumemo, "baaaaaaarrrrskkkkkkk...") end if campos == "Police" then guiSetText ( spawnmenumemo, "Police will blablalbla") else outputChatBox ("...." ) end end addEventHandler ("onClientGUIClick", spawnmenugrid, gridClick) 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