Jump to content

Boolen


manve1

Recommended Posts

Posted

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

Posted

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.

Posted

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 ) 

CiTLh.png
Posted

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/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...