09-03-2007, 12:34 AM
AddChar
Find and Remove:
Weather
This is not so much of a bug fix, but it's useless code unless you add a weather system to your game. So do not remove this if you have or going to add a weather system.
Server Side
Find and Remove:
Find and Remove:
Find and Remove:
Find and Remove:
Find and Remove:
Client Side
Find and Remove:
Find and Remove:
Find and Remove:
Thats all useless code unless you add a weather system.
Find and Remove:
Code:
' Prevent being me
If LCase(Trim(Name)) = "consty" Then
Call AlertMsg(Index, "Lets get one thing straight, you are not me, ok? :)")
Exit Sub
End If
Weather
This is not so much of a bug fix, but it's useless code unless you add a weather system to your game. So do not remove this if you have or going to add a weather system.
Server Side
Find and Remove:
Code:
'WeatherSeconds = WeatherSeconds + 1
'TimeSeconds = TimeSeconds + 1
' Lets change the weather if its time to
If WeatherSeconds >= 60 Then
i = Int(Rnd * 3)
If i GameWeather Then
GameWeather = i
Call SendWeatherToAll
End If
WeatherSeconds = 0
End If
' Check if we need to switch from day to night or night to day
If TimeSeconds >= 60 Then
If GameTime = TIME_DAY Then
GameTime = TIME_NIGHT
Else
GameTime = TIME_DAY
End If
Call SendTimeToAll
TimeSeconds = 0
End If
Code:
' Used for weather effects
Public GameWeather As Long
Public WeatherSeconds As Long
Public GameTime As Long
Public TimeSeconds As Long
Code:
' Init atmosphere
GameWeather = WEATHER_NONE
WeatherSeconds = 0
GameTime = TIME_DAY
TimeSeconds = 0
Code:
' Weather constants
Public Const WEATHER_NONE = 0
Public Const WEATHER_RAINING = 1
Public Const WEATHER_SNOWING = 2
' Time constants
Public Const TIME_DAY = 0
Public Const TIME_NIGHT = 1
Code:
Sub SendWeatherTo(ByVal Index As Long)
Dim Packet As String
Packet = "WEATHER" & SEP_CHAR & GameWeather & SEP_CHAR & END_CHAR
Call SendDataTo(Index, Packet)
End Sub
Sub SendWeatherToAll()
Dim i As Long
For i = 1 To MAX_PLAYERS
If IsPlaying(i) Then
Call SendWeatherTo(i)
End If
Next i
End Sub
Sub SendTimeTo(ByVal Index As Long)
Dim Packet As String
Packet = "TIME" & SEP_CHAR & GameTime & SEP_CHAR & END_CHAR
Call SendDataTo(Index, Packet)
End Sub
Sub SendTimeToAll()
Dim i As Long
For i = 1 To MAX_PLAYERS
If IsPlaying(i) Then
Call SendTimeTo(i)
End If
Next i
End Sub
Client Side
Find and Remove:
Code:
' Weather constants
Public Const WEATHER_NONE = 0
Public Const WEATHER_RAINING = 1
Public Const WEATHER_SNOWING = 2
' Time constants
Public Const TIME_DAY = 0
Public Const TIME_NIGHT = 1
Code:
' Used for atmosphere
Public GameWeather As Long
Public GameTime As Long
Code:
' ::::::::::::::::::::
' :: Weather packet ::
' ::::::::::::::::::::
If (LCase(Parse(0)) = "weather") Then
GameWeather = Val(Parse(1))
End If
' :::::::::::::::::
' :: Time packet ::
' :::::::::::::::::
If (LCase(Parse(0)) = "time") Then
GameTime = Val(Parse(1))
End If