undefined Posted June 3, 2014 Share Posted June 3, 2014 (edited) Hi Guys! I have a problem. I use the edit box. I use this code: if type (moneyBox) == "number" then Im write the number on editbox but it's say "Yukariya lutfen sadece sayi giriniz..!". Where is the mistake? Code Removed Edited June 3, 2014 by Guest Link to comment
Den. Posted June 3, 2014 Share Posted June 3, 2014 Where is editBox defined in the script? Link to comment
undefined Posted June 3, 2014 Author Share Posted June 3, 2014 editBox = guiCreateEdit(182, 55, 102, 23, "0", false, kumarWindow) guiEditSetMaxLength(editBox, 2) Link to comment
Mr_Moose Posted June 3, 2014 Share Posted June 3, 2014 editBox = guiCreateEdit(182, 55, 102, 23, "0", false, kumarWindow) guiEditSetMaxLength(editBox, 2) And you are sure you added those lines above the guiGetText function? If not, the pointer will be undefined (nil). Link to comment
undefined Posted June 3, 2014 Author Share Posted June 3, 2014 (edited) All Code Code Removed Edited June 3, 2014 by Guest Link to comment
Mr_Moose Posted June 3, 2014 Share Posted June 3, 2014 Ok the problem is as I suspected: local moneyBox = guiGetText ( editBox ) local para = getPlayerMoney(source) Are executed before: editBox = guiCreateEdit(182, 55, 102, 23, "0", false, kumarWindow) guiEditSetMaxLength(editBox, 2) To solve this replace line 39 and 40 with this block: editBox = guiCreateEdit(182, 55, 102, 23, "0", false, kumarWindow) guiEditSetMaxLength(editBox, 2) moneyBox = guiGetText ( editBox ) para = getPlayerMoney(source) The script will execute from up and then downwards, after that it will run the event triggers including "onClientResourceStart", anything that isn't inside an event handler function will be executed before the resource or player join events. Link to comment
undefined Posted June 3, 2014 Author Share Posted June 3, 2014 This problem is solved. And i have a problem. if type (moneyBox) == "number" then Im write the number on the moneyBox but it's say "Yukariya lutfen sadece sayi giriniz..!". Where is the problem? Link to comment
Den. Posted June 3, 2014 Share Posted June 3, 2014 Use this instead: moneyBox = tonumber(guiGetText( editBox )) guiGetText returns a string, not a number. Link to comment
undefined Posted June 3, 2014 Author Share Posted June 3, 2014 Oh thank you Den. and MrBrutus. It's solved! Link to comment
undefined Posted June 3, 2014 Author Share Posted June 3, 2014 Oh sry. It's not say "Yukariya lutfen sadece sayi giriniz..!" when i write the character on the editBox. 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