manve1 Posted September 17, 2012 Share Posted September 17, 2012 i get a boolen value with my script, i don't really get why it should get boolen. player_name = guiCreateLabel( 0.325, 0.1, 0.2, 0.2, "PlayerName: ", true, Wnd ) player_name2 = guiCreateLabel( 0.325, 0.1, 0.2, 0.2, "PlayerName: ".. getPlayerName(source), true, Wnd ) function change_name() local row = guiGridListGetSelectedItem ( Grid ) if ( row ~= -1 ) then guiSetText( player_name, player_name2 ) end end addEventHandler ( "onClientGUIClick", Grid, change_name, false ) Link to comment
robhol Posted September 17, 2012 Share Posted September 17, 2012 How hard is it to highlight the proper line and at least give the right error message? Something is a BOOLEAN value (true or false) and it's not expected. Link to comment
TAPL Posted September 17, 2012 Share Posted September 17, 2012 guiCreateLabel return element not string. Should be: guiSetText( player_name, guiGetText(player_name2) ) here source is not defined, use localPlayer instead of source. player_name2 = guiCreateLabel( 0.325, 0.1, 0.2, 0.2, "PlayerName: ".. getPlayerName(source), true, Wnd ) Link to comment
Jaysds1 Posted September 17, 2012 Share Posted September 17, 2012 I fixed it on one of my posts: player_name = guiCreateLabel( 0.325, 0.1, 0.5, 0.2, "PlayerName: ", true, Wnd ) --label is created first player_name2 = "PlayerName: "..getPlayerName ( localPlayer ):gsub ( "#%x%x%x%x%x%x", "" ) function change_name() local row = guiGridListGetSelectedItem ( Grid ) if row == -1 then guiSetText(player_name,player_name2) else guiSetText( player_name,guiGridListGetItemText(Grid,row,1)) end end addEventHandler ( "onClientGUIClick", Grid, change_name, false ) Link to comment
Anderl Posted September 17, 2012 Share Posted September 17, 2012 I fixed it on one of my posts:player_name = guiCreateLabel( 0.325, 0.1, 0.5, 0.2, "PlayerName: ", true, Wnd ) --label is created first player_name2 = "PlayerName: "..getPlayerName ( localPlayer ):gsub ( "#%x%x%x%x%x%x", "" ) function change_name() local row = guiGridListGetSelectedItem ( Grid ) if row == -1 then guiSetText(player_name,player_name2) else guiSetText( player_name,guiGridListGetItemText(Grid,row,1)) end end addEventHandler ( "onClientGUIClick", Grid, change_name, false ) if row == -1 then Should be: if (row ~= -1) then Link to comment
Jaysds1 Posted September 17, 2012 Share Posted September 17, 2012 i actually did that on purpose, so if the player doesn't select any row, then the label would be changed to the players name 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