Jump to content

Problem


FuriouZ

Recommended Posts

Heya!

I can't understand how to fix it, tryed many ways, but then i got more errors :shock:

Debug says

line:8 'end' expected (to close 'if' at line 3) near 'elseif'

client

function() 
        local g_Me = getLocalPlayer() 
        if ( getElementData(g_Me,"Arena" ) == "Freeroam" ) then 
            setSkyGradient(60, 100, 196, 136, 170, 212) 
        else 
            resetSkyGradient() 
        elseif ( getElementData(g_Me,"Arena" ) == "Stuntage" ) then 
            setPedCanBeKnockedOffBike(g_Me, false) 
        else 
            setPedCanBeKnockedOffBike(g_Me, true)    
        elseif ( getElementData(g_Me,"Arena" ) == "DayZ" ) then 
            showPlayerHudComponent("crosshair",true) 
            showPlayerHudComponent("radar",true) 
                setWeather(8) 
                setRainLevel(0) 
        else 
            setWeather(0) 
            resetRainLevel() 
        end          
    end 
end 

Link to comment
  
function() 
        local g_Me = getLocalPlayer() 
        if ( getElementData(g_Me,"Arena" ) == "Freeroam" ) then 
            setSkyGradient(60, 100, 196, 136, 170, 212) 
        else 
            resetSkyGradient() 
        elseif ( getElementData(g_Me,"Arena" ) == "Stuntage" ) then 
            setPedCanBeKnockedOffBike(g_Me, false) 
        else 
            setPedCanBeKnockedOffBike(g_Me, true)    
        elseif ( getElementData(g_Me,"Arena" ) == "DayZ" ) then 
            showPlayerHudComponent("crosshair",true) 
            showPlayerHudComponent("radar",true) 
                setWeather(8) 
                setRainLevel(0) 
        else 
            setWeather(0) 
            resetRainLevel() 
             end 
        end         
    end 
end 
  

Link to comment

Still the same error

Full code:

addEvent("setArenaProperties",true) 
addEventHandler("setArenaProperties",root, 
    function() 
        local g_Me = getLocalPlayer() 
        if ( getElementData(g_Me,"Arena" ) == "Freeroam" ) then 
            setSkyGradient(60, 100, 196, 136, 170, 212) 
        else 
            resetSkyGradient() 
        elseif ( getElementData(g_Me,"Arena" ) == "Stuntage" ) then 
            setPedCanBeKnockedOffBike(g_Me, false) 
        else 
            setPedCanBeKnockedOffBike(g_Me, true)    
        elseif ( getElementData(g_Me,"Arena" ) == "DayZ" ) then 
            showPlayerHudComponent("crosshair",true) 
            showPlayerHudComponent("radar",true) 
                setWeather(8) 
                setRainLevel(0) 
        else 
            setWeather(0) 
            resetRainLevel() 
        end          
    end 
end 
) 

Link to comment
    addEvent("setArenaProperties",true) 
    addEventHandler("setArenaProperties",root, 
        function() 
            local g_Me = getLocalPlayer() 
            if ( getElementData(g_Me,"Arena" ) == "Freeroam" ) then 
                setSkyGradient(60, 100, 196, 136, 170, 212) 
            else 
                resetSkyGradient() 
            elseif ( getElementData(g_Me,"Arena" ) == "Stuntage" ) then 
                setPedCanBeKnockedOffBike(g_Me, false) 
            else 
                setPedCanBeKnockedOffBike(g_Me, true)    
            elseif ( getElementData(g_Me,"Arena" ) == "DayZ" ) then 
                showPlayerHudComponent("crosshair",true) 
                showPlayerHudComponent("radar",true) 
                    setWeather(8) 
                    setRainLevel(0) 
            else 
                setWeather(0) 
                resetRainLevel() 
            end         
        end 
    ) 

Link to comment
Lol. Add one more end simple.

It's not that simple

Okay, i added, but nothing changed, added one more, still nothing

I don't know, debug says:

line 9: 'end' expected (to close 'if' at line 5) near 'elseif'

But i can't close there, because then function doesn't resetSkyGradient() or what ?

addEvent("setArenaProperties",true) 
addEventHandler("setArenaProperties",root, 
    function() 
        local g_Me = getLocalPlayer() 
        if ( getElementData(g_Me,"Arena" ) == "Freeroam" ) then 
            setSkyGradient(60, 100, 196, 136, 170, 212) 
        else 
            resetSkyGradient() 
        elseif ( getElementData(g_Me,"Arena" ) == "Stuntage" ) then 
            setPedCanBeKnockedOffBike(g_Me, false) 
        else 
            setPedCanBeKnockedOffBike(g_Me, true)    
        elseif ( getElementData(g_Me,"Arena" ) == "DayZ" ) then 
            showPlayerHudComponent("crosshair",true) 
            showPlayerHudComponent("radar",true) 
                setWeather(8) 
                setRainLevel(0) 
        else 
            setWeather(0) 
            resetRainLevel() 
        end         
    end 
end 
end 
) 

WhoAmI your's doesn't work either

Link to comment
    addEvent("setArenaProperties",true) 
    addEventHandler("setArenaProperties",root, 
        function() 
            local g_Me = getLocalPlayer() 
            if ( getElementData(g_Me,"Arena" ) == "Freeroam" ) then 
                setSkyGradient(60, 100, 196, 136, 170, 212) 
            else 
                resetSkyGradient() 
            end 
            if ( getElementData(g_Me,"Arena" ) == "Stuntage" ) then 
                setPedCanBeKnockedOffBike(g_Me, false) 
            else 
                setPedCanBeKnockedOffBike(g_Me, true)   
            end 
            if ( getElementData(g_Me,"Arena" ) == "DayZ" ) then 
                showPlayerHudComponent("crosshair",true) 
                showPlayerHudComponent("radar",true) 
                    setWeather(8) 
                    setRainLevel(0) 
            else 
                setWeather(0) 
                resetRainLevel() 
            end         
        end 
    ) 

Check this out.

Link to comment
    addEvent("setArenaProperties",true) 
    addEventHandler("setArenaProperties",root, 
        function() 
            local g_Me = getLocalPlayer() 
            if ( getElementData(g_Me,"Arena" ) == "Freeroam" ) then 
                setSkyGradient(60, 100, 196, 136, 170, 212) 
            else 
                resetSkyGradient() 
            end 
            if ( getElementData(g_Me,"Arena" ) == "Stuntage" ) then 
                setPedCanBeKnockedOffBike(g_Me, false) 
            else 
                setPedCanBeKnockedOffBike(g_Me, true)   
            end 
            if ( getElementData(g_Me,"Arena" ) == "DayZ" ) then 
                showPlayerHudComponent("crosshair",true) 
                showPlayerHudComponent("radar",true) 
                    setWeather(8) 
                    setRainLevel(0) 
            else 
                setWeather(0) 
                resetRainLevel() 
            end         
        end 
    ) 

Check this out.

This is what i tought, yeah, now it works, but after else nothing doesn't work

i mean

                resetSkyGradient()

                setPedCanBeKnockedOffBike(g_Me, true)  

                setWeather(0)

                resetRainLevel()

No any errors in debug

Link to comment

Well, doesn't this seem right ? :P

addEvent("setArenaProperties",true) 
    addEventHandler("setArenaProperties",root, 
        function() 
            local g_Me = getLocalPlayer() 
            if ( getElementData(g_Me,"Arena" ) == "Freeroam" ) then 
                setSkyGradient(60, 100, 196, 136, 170, 212) 
                setPedCanBeKnockedOffBike(g_Me, true)   
                setWeather(0) 
                resetRainLevel() 
            elseif ( getElementData(g_Me,"Arena" ) == "Stuntage" ) then 
               setPedCanBeKnockedOffBike(g_Me, false) 
               resetSkyGradient() 
               setWeather(0) 
               resetRainLevel() 
            elseif  ( getElementData(g_Me,"Arena" ) == "DayZ" ) then 
               showPlayerHudComponent("crosshair",true) 
               showPlayerHudComponent("radar",true) 
               setWeather(8) 
               setRainLevel(0) 
               resetSkyGradient 
               setPedCanBeKnockedOffBike(g_Me, true)   
            end         
        end) 

Link to comment
  • Moderators
This is what i tought, yeah, now it works, but after else nothing doesn't work

i mean

                resetSkyGradient()

                setPedCanBeKnockedOffBike(g_Me, true)  

                setWeather(0)

                resetRainLevel()

No any errors in debug

They will work only if you aren't in the arena of the corresponding if statement. This code is totally fine.

Well, doesn't this seem right ? :P

No it's worst because it's more dirty (duplicating code).

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