Scripting Posted April 17, 2012 Share Posted April 17, 2012 Hi all, I have a bug if i do this: client-side: name1 = guiCreateLabel(50,10,410,20,"test1",true) name2 = guiCreateLabel(50,25,410,20,"test2",true) money1 = guiCreateLabel(300,10,410,20,"20000",true) money2 = guiCreateLabel(300,25,410,20,"17000",true) function show () local playerMoney = getPlayerMoney(getLocalPlayer()) local name = getPlayerName(getLocalPlayer()) if ( playerMoney >= tonumber (guiGetText(money1)) ) then guiSetText(name2,guiGetText(name1)) guiSetText(name1,"The Name: ".. name) guiSetText(money2,guiGetText(money1)) guiSetText(money1,"The Money: ".. PlayerMoney) [This Change] end end addEventHandler("onClientRender", getRootElement(), show) The Code work Correctly 100%; and if I change this Code Argument : guiSetText(money1,"The Money: ".. PlayerMoney) The Code work a bug: The Label(money1,mney2) change text to (playerMoney) and the Label(name1,name2) change text to (name). Pls fix this bug set The Code work Correctly: client-side: name1 = guiCreateLabel(50,10,410,20,"test1",true) name2 = guiCreateLabel(50,25,410,20,"test2",true) money1 = guiCreateLabel(300,10,410,20,"20000",true) money2 = guiCreateLabel(300,25,410,20,"17000",true) function show () local playerMoney = getPlayerMoney(getLocalPlayer()) local name = getPlayerName(getLocalPlayer()) if ( playerMoney >= tonumber (guiGetText(money1)) ) then guiSetText(name2,guiGetText(name1)) guiSetText(name1,"The Name: ".. name) guiSetText(money2,guiGetText(money1)) guiSetText(money1,playerMoney) [This The Change Arguments ] end end addEventHandler("onClientRender", getRootElement(), show) Link to comment
Castillo Posted April 17, 2012 Share Posted April 17, 2012 I don't really understand what are you trying to achieve. Link to comment
Scripting Posted April 17, 2012 Author Share Posted April 17, 2012 The Code work correctly if i do the Client-side 1 and if I change The Argument of this guiSetText(money1,"The Money: ".. PlayerMoney) to guiSetText(money1, PlayerMoney) The code work a bug All Label set Text to (playerMoney) Do that and you look Link to comment
Michael# Posted April 17, 2012 Share Posted April 17, 2012 getPlayerMoney client-side don't has any arguments. Link to comment
Castillo Posted April 17, 2012 Share Posted April 17, 2012 name1 = guiCreateLabel(50,10,410,20,"test1",false) name2 = guiCreateLabel(50,25,410,20,"test2",false) money1 = guiCreateLabel(300,10,410,20,"20000",false) money2 = guiCreateLabel(300,25,410,20,"17000",false) function show ( ) local playerMoney = getPlayerMoney ( ) local name = getPlayerName ( localPlayer ) if ( playerMoney >= tonumber ( guiGetText ( money1 ) ) ) then guiSetText ( name2, guiGetText ( name1 ) ) guiSetText ( name1, "The Name: ".. name ) guiSetText ( money2, guiGetText ( money1 ) ) guiSetText ( money1, tostring ( playerMoney ) ) end end addEventHandler ( "onClientRender", getRootElement(), show ) You had to convert the number to a string. Link to comment
Scripting Posted April 17, 2012 Author Share Posted April 17, 2012 Work the Bug! Come to my server and look it ip:196.217.53.10 ^port:22003 pass:123456 Link to comment
Castillo Posted April 17, 2012 Share Posted April 17, 2012 I can't help you if you don't give me the full code. Link to comment
Scripting Posted April 17, 2012 Author Share Posted April 17, 2012 Yea yoou can t ,You will come to my server before see the bug tomorrow i tell you Link to comment
Absence2 Posted April 18, 2012 Share Posted April 18, 2012 Please, read thru the code this time. I saw you aldready had a topic about this, no idea why you would make another one. name1 = guiCreateLabel(50,10,410,20,"",false) name2 = guiCreateLabel(50,25,410,20,"",false) money1 = guiCreateLabel(300,10,410,20,"",false) money2 = guiCreateLabel(300,25,410,20,"",false) function show ( ) -- p stands for player in this case local pMoney = getPlayerMoney ( localPlayer ) local pName = getPlayerName ( localPlayer ) guiSetText ( money1, "The Money: "..pMoney ) -- Additional text guiSetText ( money2, pMoney ) guiSetText ( name1, "The Name: "..pName ) -- Additional text guiSetText ( name2, pName ) end addEventHandler ( "onClientRender", getRootElement(), show ) also, why would you need if ( playerMoney >= tonumber ( guiGetText ( money1 ) ) ) then Link to comment
Michael# Posted April 18, 2012 Share Posted April 18, 2012 uName1 = guiCreateLabel ( 50, 10, 410, 20, '', false ); uName2 = guiCreateLabel ( 50, 25, 410, 20, '', false ); uMoney1 = guiCreateLabel ( 300, 10, 410, 20, '', false ); uMoney2 = guiCreateLabel ( 300, 25, 410, 20, '', false ); addEventHandler ( 'onClientRender', root, function ( ) local pMoney = getPlayerMoney ( ); local pName = getPlayerName ( localPlayer ); guiSetText ( uMoney1, 'The Money: ' .. tonumber ( pMoney ) ); guiSetText ( uMoney2, tonumber ( pMoney ) ); guiSetText ( uName1, 'The Name: ' .. tostring ( pName ) ); guiSetText ( uName2, tostring ( pName ) ); end ) Try this. Sorry if is something wrong, I haven't tested it 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