Jump to content

help


golanu21

Recommended Posts

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

Link to comment

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 ) 

Link to comment

@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.

Link to comment
@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 :D

Link to comment

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.

Link to comment

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 ) 

Link to comment

@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.

Link to comment
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..

Link to comment
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)

Link to comment

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 ?...

Link to comment

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...