golanu21 Posted July 22, 2013 Posted July 22, 2013 function greetingHandler ( ) guiProgressBarSetProgress ( progressBar, ( guiProgressBarGetProgress ( progressBar ) + 50 ) ) local mu = guiProgressBarGetProgress (progressBar) if mu >= 100 then guiSetText(nivlab, "1") guiProgressBarSetProgress(progressBar, 0) if mu >= 100 *2 then guiSetText(nivlab, "2") end end end addEvent ( "gret", true ) addEventHandler ( "gret", getRootElement(), greetingHandler ) how i make when progressBar, has ben 100% 2 times the text to be 2
Alen141 Posted July 22, 2013 Posted July 22, 2013 I never used progressbar, but here try this : function greetingHandler ( ) guiProgressBarSetProgress ( progressBar, ( guiProgressBarGetProgress ( progressBar ) + 50 ) ) local mu = guiProgressBarGetProgress (progressBar) if mu >= 100 then guiSetText(nivlab, "1") guiProgressBarSetProgress(progressBar, 0) if mu >= 200 then guiSetText(nivlab, "2") end end end addEvent ( "gret", true ) addEventHandler ( "gret", getRootElement(), greetingHandler )
50p Posted July 22, 2013 Posted July 22, 2013 @golanu21, DO NOT DOUBLE POST, PLEASE. Define a variable that will hold how many times the progress bar reached 100%. Check if the progress bar reached 100% (which you do at line 4), then add 1 to the variable and set the text of nivlab to whatever the variable holds.
golanu21 Posted July 22, 2013 Author Posted July 22, 2013 @golanu21,DO NOT DOUBLE POST, PLEASE. sorry for that.. Define a variable that will hold how many times the progress bar reached 100%. Check if the progress bar reached 100% (which you do at line 4), then add 1 to the variable and set the text of nivlab to whatever the variable holds. how i make that ?, please tell me because i am begginer and i don't know how
johny46 Posted July 22, 2013 Posted July 22, 2013 Define a variable at the start of script like howManyProgressBarReached100 = 0 Then check it's value and if it's 1 then it means that the progressbar reached 100% one time. You have to increase that counter whenever your function ends working.
golanu21 Posted July 22, 2013 Author Posted July 22, 2013 ERROR: Infinite/too long execution (coie) function greetingHandler ( ) Reached100 = 0 guiProgressBarSetProgress ( progressBar, ( guiProgressBarGetProgress ( progressBar ) + 50 ) ) local mu = guiProgressBarGetProgress (progressBar) while mu >= 100 do local Reached100 = Reached100 +1 print(Reached100) if Reached100 == 1 then guiProgressBarGetProgress(progressBar, 0) guiSetText(nivlab, "1") end end end addEvent ( "gret", true ) addEventHandler ( "gret", getRootElement(), greetingHandler )
Alen141 Posted July 22, 2013 Posted July 22, 2013 (edited) ..... EDIT: Code was wrong ... Edited July 22, 2013 by Guest
50p Posted July 22, 2013 Posted July 22, 2013 @golanu, nobody asked you to do a "while loop". Your old code was more or less correct, you just need a global variable. Replace the "while" with "if". Line 6, there is no need for "local". @Alen141, Do not post the code that will not work. Your code will bring up a syntax error (line 6). Even if you fix that, at line 3 the variable will be 0 every time the greetingHandler function will be called.
golanu21 Posted July 22, 2013 Author Posted July 22, 2013 function greetingHandler ( ) Reached100 = 0 guiProgressBarSetProgress ( progressBar, ( guiProgressBarGetProgress ( progressBar ) + 50 ) ) local mu = guiProgressBarGetProgress (progressBar) if mu >= 100 then guiProgressBarSetProgress(progressBar, 0) Reached100 = Reached100 +1 print(Reached100) if Reached100 == 1 then guiSetText(nivlab, "1") if Reached100 == 2 then guiSetText(nivlab, "2") end end end end addEvent ( "gret", true ) addEventHandler ( "gret", getRootElement(), greetingHandler ) don't work, Text "1" appear but when ProgressBar reach again 100% do nothing..
50p Posted July 22, 2013 Posted July 22, 2013 Remove line 9 and 14. Read it to yourself and think like the computer going from top to bottom. Learn to debug your script. https://wiki.multitheftauto.com/wiki/Debugging
Baseplate Posted July 22, 2013 Posted July 22, 2013 hi man,how i make the account-system on valhalla ?to register in game ? Interesting how he sent me a PM about helping him with valhalla.
golanu21 Posted July 23, 2013 Author Posted July 23, 2013 hi man,how i make the account-system on valhalla ?to register in game ? Interesting how he sent me a PM about helping him with valhalla. there is not valhalla script , for what i need in valhalla exp_system man ?... i make my own gamemode ok .. there is a PRIVATE MESAJE not a PUBLIC MESSAGE (kid)
Baseplate Posted July 23, 2013 Posted July 23, 2013 Ahah, I'm lying? http://puu.sh/3JN16.jpg This picture is lying too.
golanu21 Posted July 24, 2013 Author Posted July 24, 2013 i am not say you lying , i just say that sentence in PRIVATE MEASSGE not in PUBLIC MESAGE, for what you make it public? Don't worry i am not angry for you .... what i want to creeate in this moment has nothing to do with scripts of valhalla ok ?...
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