Spice Posted April 12, 2015 Share Posted April 12, 2015 (edited) function OpenWin () if ( guiGetVisible ( Window ) == true ) then guiSetVisible (Window, false) guiSetVisible (Addwindow, false) toggleAllControls ( true ) toggleControl ( "chatbox", true ) showCursor ( false ) else guiSetVisible (Window, true) toggleAllControls ( false ) toggleControl ( "chatbox", true ) showCursor ( true ) end end function nook ( ) guiSetVisible (Addwindow, true) guiSetVisible (Window, false) toggleAllControls ( false ) end function okno ( ) guiSetVisible (Window, false) showCursor ( false ) toggleAllControls ( true ) end function ops ( ) guiSetVisible (Addwindow, false) showCursor ( false ) toggleAllControls ( true ) end function ham ( ) guiGridListSetItemText(ADVERTISING,guiGridListInsertRowAfter(ADVERTISING,guiGridListGetRowCount(ADVERTISING)),advert,guiGetText (Write),false,false) guiGridListSetItemText(ADVERTISING,guiGridListInsertRowAfter(ADVERTISING,guiGridListGetRowCount(ADVERTISING)),player,getPlayerName(localPlayer),false,false) guiSetVisible (Addwindow, false) guiSetVisible (Window, true) end Window = guiCreateWindow(271, 208, 489, 284, "Advertisment Window", false) guiWindowSetSizable(Window, false) guiSetAlpha(Window, 1.00) ADVERTISING = guiCreateGridList(16, 32, 456, 211, false, Window) player = guiGridListAddColumn(ADVERTISING, "Player", 0.5) advert = guiGridListAddColumn(ADVERTISING, "Advert", 0.5) Add = guiCreateButton(26, 253, 95, 18, "Add Advert", false, Window) guiSetProperty(Add, "NormalTextColour", "FFAAAAAA") addEventHandler ( "onClientGUIClick", Add, nook, false ) Close = guiCreateButton(367, 253, 95, 18, "Close", false, Window) guiSetProperty(Close, "NormalTextColour", "FFAAAAAA") addEventHandler ( "onClientGUIClick", Close, okno, false ) Addwindow = guiCreateWindow(302, 276, 410, 208, "Add Advertise", false) guiWindowSetSizable(Addwindow, false) Write = guiCreateMemo(10, 37, 390, 117, "", false, Addwindow) FAddB = guiCreateButton(10, 168, 150, 30, "Add Advert", false, Addwindow) guiSetProperty(FAddB, "NormalTextColour", "FFAAAAAA") addEventHandler ( "onClientGUIClick", FAddB, ham, false ) ABC = guiCreateButton(255, 170, 145, 28, "Close", false, Addwindow) guiSetProperty(ABC, "NormalTextColour", "FFAAAAAA") addEventHandler ( "onClientGUIClick", ABC, ops, false ) guiSetVisible ( Window, false ) guiSetVisible ( Addwindow, false ) bindKey("F10", "down", OpenWin) Why when i add row is becomes like that not on the same line/row . Edited April 12, 2015 by Guest Link to comment
xXMADEXx Posted April 12, 2015 Share Posted April 12, 2015 Because you're inserting two different rows. Try changing your ham function to this: function ham ( ) local row = guiGridListInsertRowAfter(ADVERTISING,guiGridListGetRowCount(ADVERTISING)); guiGridListSetItemText(ADVERTISING, row,advert,guiGetText (Write),false,false) guiGridListSetItemText(ADVERTISING, row,player,getPlayerName(localPlayer),false,false) guiSetVisible (Addwindow, false) guiSetVisible (Window, true) end Link to comment
Spice Posted April 12, 2015 Author Share Posted April 12, 2015 Because you're inserting two different rows.Try changing your ham function to this: function ham ( ) local row = guiGridListInsertRowAfter(ADVERTISING,guiGridListGetRowCount(ADVERTISING)); guiGridListSetItemText(ADVERTISING, row,advert,guiGetText (Write),false,false) guiGridListSetItemText(ADVERTISING, row,player,getPlayerName(localPlayer),false,false) guiSetVisible (Addwindow, false) guiSetVisible (Window, true) end Working now but can you tell me what have you did ? @xXMADEXx Link to comment
xXMADEXx Posted April 12, 2015 Share Posted April 12, 2015 guiGridListInsertRowAfter returns an integer representing the row ID, so any time you call the function it's going to return a different ID. Therefore, you have to make a variable setting it to the function, and use that variable so your rows will have the same ID. (Sorry for the weird wording, wasn't really sure how to word it.) Link to comment
Spice Posted April 12, 2015 Author Share Posted April 12, 2015 guiGridListInsertRowAfter returns an integer representing the row ID, so any time you call the function it's going to return a different ID. Therefore, you have to make a variable setting it to the function, and use that variable so your rows will have the same ID. (Sorry for the weird wording, wasn't really sure how to word it.) Thanks ! Can you tell me how to make GUI button appear only for Team or ACL group using CLIENT function ? Link to comment
xXMADEXx Posted April 12, 2015 Share Posted April 12, 2015 guiGridListInsertRowAfter returns an integer representing the row ID, so any time you call the function it's going to return a different ID. Therefore, you have to make a variable setting it to the function, and use that variable so your rows will have the same ID. (Sorry for the weird wording, wasn't really sure how to word it.) Thanks ! Can you tell me how to make GUI button appear only for Team or ACL group using CLIENT function ? Just use: getTeamName(getPlayerTeam(localPlayer)) and check to see if theyre on a certain team, and if they then create the button. if ( getTeamName ( getPlayerTeam ( localPlayer ) ) == "Criminals" ) then button = guiCreateButton ( ... ) end Link to comment
Spice Posted April 12, 2015 Author Share Posted April 12, 2015 I 've added that if ( getTeamName(getPlayerTeam(localPlayer)) == "Admin" ) then Del = guiCreateButton(200, 253, 95, 18, "Del Advert", false, Window) guiSetProperty(Del, "NormalTextColour", "FFAAAAAA") end But debug says : Bad argument @ getTeamName [Exepected team at argument 1 , got boolean] Link to comment
Anubhav Posted April 13, 2015 Share Posted April 13, 2015 if ( getPlayerTeam( localPlayer ) and getTeamName(getPlayerTeam(localPlayer)) == "Admin" ) then Del = guiCreateButton(200, 253, 95, 18, "Del Advert", false, Window) guiSetProperty(Del, "NormalTextColour", "FFAAAAAA") end 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