Jump to content

Weather changes ClientSide for ALL PLAYERS (why)


Recommended Posts

Hello Guys! I have a new Question about setting Weather/SkyGradient clientsided. The script below is the CLIENT part of my disco club and the problem is: If anyone hits the entrance arrow marker the Weather and SkyGradient is set for EVERYONE. YES. But the script works Client sided so i just dont understand why everyone is getting a new weather!!!

If anyone has a solution or is able to explain me that issue please write^^

  
disco = createMarker( 2722.5, -2071, 2064, "corona", 100, 0, 0, 0, 0 ) 
discoausgang = createMarker( 2740.48, -2082.05, 2069.88, "arrow", 1.3, 0, 255, 0, 200 ) 
discoeingang = createMarker ( 62.88, -211.5, 1.5, "arrow", 1.5, 255, 255, 0, 200 ) 
standeingang = createMarker( 2738.32, -2082.05, 2069.88, "arrow", 1.3, 0, 0, 255, 200 ) 
drinnen = false 
  
function onResourceStart1() 
        discosoundHIGH = playSound3D("techno.mp3", 2735, -2071.1, 2100, true) 
        discosoundHIGH2 = playSound3D("techno.mp3", 2730.93, -2071.5, 2100, true) 
        setSoundVolume(discosoundHIGH, 5.0) 
        setSoundMaxDistance(discosoundHIGH, 200) 
        setSoundVolume(discosoundHIGH2, 5.0) 
        setSoundMaxDistance(discosoundHIGH2, 200) 
        setSoundMinDistance(discosoundHIGH2, 190) 
        setSoundMinDistance(discosoundHIGH, 190) 
    setSkyGradient( 155, 155, 255, 155, 155, 155 ) 
    setWeather(9) 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onResourceStart1) 
  
  
function indisco(hitPlayer) 
    if getElementType(hitPlayer) == "player" then -- in dem Discomarker 
        drinnen = true 
        setWeather ( 0 ) 
        toggleControl("fire", false) 
    end 
end 
addEventHandler("onClientMarkerHit", disco, indisco) 
  
  
function ausgang(hitPlayer) 
    if getElementType(hitPlayer) == "player" then 
    setTimer ( setElementPosition, 1000, 1, hitPlayer, 68, -211, 1.6 ) 
    setTimer ( setElementRotation, 1100, 1, hitPlayer, 0, 0, 0 ) 
        -- Fade the camera to make it look nicer 
    fadeCamera ( hitPlayer, false, 1, 0, 0, 0 ) 
        -- Fade it back once it's all complete! 
    setTimer ( fadeCamera, 1100, 1, hitPlayer, true, 1 )    -- aus der Disco rausteleportieren 
    drinnen = false 
    setSkyGradient( 155, 155, 255, 155, 155, 155 ) 
    setWeather(9) 
    toggleControl("fire", true) 
    end 
end 
addEventHandler("onClientMarkerHit", discoausgang, ausgang) 
  
function eingang(hitPlayer) 
    if getElementType(hitPlayer) == "player" then    -- in die Disco reinteleportieren 
    setTimer ( setElementPosition, 1000, 1, hitPlayer, 2740.54, -2079.37, 2069.97 ) 
    setTimer ( setElementPosition, 3000, 1, hitPlayer, 2740.54, -2079.37, 2069.97 ) 
    setTimer ( setElementRotation, 3100, 1, hitPlayer, 0, 0, 0 ) 
        -- Fade the camera to make it look nicer 
    fadeCamera ( hitPlayer, false, 1, 0, 0, 0 ) 
        -- Fade it back once it's all complete! 
    setTimer ( fadeCamera, 1100, 1, hitPlayer, true, 1 ) 
    setTimer (disco, 2000, true) 
    end 
end 
addEventHandler("onClientMarkerHit", discoeingang, eingang) 
  
function disco() 
    if drinnen == true then 
    r = math.random(50,200) 
    g = math.random(50,200) 
    b = math.random(50,200) 
    setSkyGradient(r,g,b,r,g,b) --Himmelfarbe 
    setTimer(disco, 1500, 1) 
    end 
end 
  

Link to comment

It seems that setWeather affects all the players, because there's no player argument for it server-side.

It does make sense actually, because weather conditions change the physics of elements a bit (I think) and would cause some weird effects for other players to see.

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