manve1 Posted September 17, 2012 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 ) Looking for tutorials or information? check out: www.simpleask.co.uk
robhol Posted September 17, 2012 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. Do NOT PM ME for help unless invited. - New MTA Script Editor Scripting help "etiquette": understandable language, relevant code (ALL code if unsure), [Lua] tags, error messages with line numbers. Super simple stuff.
TAPL Posted September 17, 2012 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 )
Jaysds1 Posted September 17, 2012 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 ) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Anderl Posted September 17, 2012 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 "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
Jaysds1 Posted September 17, 2012 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 My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
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