FuriouZ Posted March 9, 2014 Share Posted March 9, 2014 Heya! I can't understand how to fix it, tryed many ways, but then i got more errors 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
Anubhav Posted March 9, 2014 Share Posted March 9, 2014 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
FuriouZ Posted March 9, 2014 Author Share Posted March 9, 2014 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
Anubhav Posted March 9, 2014 Share Posted March 9, 2014 Lol. Add one more end simple. Link to comment
WhoAmI Posted March 9, 2014 Share Posted March 9, 2014 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
FuriouZ Posted March 9, 2014 Author Share Posted March 9, 2014 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
WhoAmI Posted March 9, 2014 Share Posted March 9, 2014 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
FuriouZ Posted March 9, 2014 Author Share Posted March 9, 2014 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
NeO_DUFFMAN Posted March 9, 2014 Share Posted March 9, 2014 Well, doesn't this seem right ? 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 Citizen Posted March 9, 2014 Moderators Share Posted March 9, 2014 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 ? No it's worst because it's more dirty (duplicating code). 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