Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Weather simulation resource by vovo4ka
- -- ver 1.0
- -- e-mail: zolotayapipka@gmail.com
- --
- -- server side script
- -- cyclone sync
- cyclones = {{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}}
- --blips = {} --debug
- function cyc_init()
- math.randomseed(getTickCount()/2)
- for i, cyc in pairs(cyclones) do
- cyclones[i][1]=math.random(4000)-2000 --posX
- cyclones[i][2]=math.random(4000)-2000 --posY
- cyclones[i][4]=math.random(60)-30 -- trend dx
- cyclones[i][5]=math.random(60)-30 -- dy
- cyclones[i][3]=math.random(1000)+100 -- radius of cyclone
- --blips[i]=createBlip ( cyclones[i][1], cyclones[i][2], 0, 41, 2)
- end
- end
- cyc_init()
- function cyc_process()
- for i, cyc in pairs(cyclones) do
- -- movin cyclones
- cyclones[i][1] = cyclones[i][1] + math.random(30)-15+cyclones[i][4]
- cyclones[i][2] = cyclones[i][2] + math.random(30)-15+cyclones[i][5]
- cyclones[i][3] = cyclones[i][3] - math.random(60)
- --destroyElement(blips[i]) --debug
- if (cyclones[i][3]<=200) then -- new cyclone
- cyclones[i][1]=math.random(4000)-2000
- cyclones[i][2]=math.random(4000)-2000
- cyclones[i][3]=math.random(1000)+100
- cyclones[i][4]=math.random(60)-30 -- dx
- cyclones[i][5]=math.random(60)-30 -- dy
- end
- end
- -- sync with all players
- triggerClientEvent ( "AcceptCyclones", getRootElement(), cyclones[1][1], cyclones[1][2], cyclones[1][3],cyclones[2][1], cyclones[2][2], cyclones[2][3],cyclones[3][1], cyclones[3][2], cyclones[3][3])
- end
- setTimer ( cyc_process, 5000, 0, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement