;Bloodfever Epidemic

timerIncre = 0
userID = GetNextOnlineUser(0)
while userID > 0
	timerIncre = timerIncre + 1
	if GetUserFlag(userID, 55) > 0
		Timer(851,1000*timerIncre, userID, 0, 0)
	endIf
	
	userID = GetNextOnlineUser(userID)
wend

flag = GetUserFlag(0, 56)
flag = flag - 1
if flag < 0
	flag = random(10,50)
endif
SetUserFlag(0, 56, flag)

tick = #PARAM1+1
if tick > 10
	tick = 0
	
	timerIncre = 0
	infectedUserCount = 0
	userID = GetNextOnlineUser(0)
	while userID > 0
		timerIncre = timerIncre + 1
		if GetUserFlag(userID, 55) > 1
			Timer(852,1000*timerIncre, userID, 0, 0)
			infectedUserCount = infectedUserCount + 1
		endIf
		
		userID = GetNextOnlineUser(userID)
	wend
	
	if infectedUserCount > 0
		SendMessageToAll("There are "+infectedUserCount+" infected players running around...",#MSG_CRITICAL)
		SendMessageToAll(GetUserFlag(0,57)+" players have been infected by the Bloodfever epidemic, "+GetUserFlag(0,55)+" have died because of it.",#MSG_CRITICAL)
	else
		infectyID = GetNextOnlineUser(GetNextOnlineUser(GetNextOnlineUser(0)))
		if infectyID > 0
			SetUserFlag(infectyID,55,2)
			SendMessageToUser(infectyID,"You contracted Bloodfever. You are contagious.",#MSG_CRITICAL)
			SetUserFlag(0,57,GetUserFlag(0,57)+1)
		endif
	endif
endIf

Timer(850,20000,tick,0,0)

Continue = 1