here is a weather script i made a long time ago.
note how both these scripts use @ to keep server and client running in sync.
;delay while mission starts
~60
#init
timetochange=0
calmb4storm=0
weather=0
stormready=false
forcast=0
#forecast
~timetochange
;skip making weather if client
?(!local server):goto "changeweather"
;watch a variable used for turning weather off in mission. I.E. radio 0-0-1
?(resetweather):goto "end"
forecast=random 20
weather=(forecast/10)-1
?(weather<0):weather=0
?(weather>1):weather=1
;use big delays to make weather change slower, more realistic
timetochange=(random 600)+600
;use this to make a storm stay around awhile before changing weather again.
calmb4storm=(random 600)+600
;hint format["Calm B4 Storm %2 secs\nForcasted Weather %1\nStorm Duration %3", weather, calmb4storm, timetochange]
;send settings to clients
publicvariable "timetochange";publicvariable "weather";publicvariable "calmb4storm"
#getreadytorumble
;makes server wait random time before starting the storm
~calmb4storm
;tell clients to start the storm now
stormready=1
publicvariable "stormready"
;check if weather was turned off
?(resetweather):goto "end"
#changeweather
;this wait is used to make sure server and client start storm at same time.
@(stormready==1)
;once a system has started a storm, set to 0 so it will wait till server makes a new one
stormready=0
?(resetweather):goto "end"
;hint "storm"
;set storm on all systems
timetochange setovercast weather
?(!local server):goto "changeweather"
goto "forecast"
#end
;if weather was shut off, tell all system to exit script
stormready=1;publicvariable "stormready"
;reset weather to clear skies
20 setovercast 0
resetweather=false
weatheron=false
titletext[format ["Weather is now off (you may enable with radio again now)"], "Plain down"]
exit