;Bloodfever Epidemic - Per-user infection tick

infectedUser = #PARAM1

chanceToInfect = 3
if GetUserFlag(infectedUser,55) = 3
	chanceToInfect = 1
endif


mapID = GetUserMap(infectedUser)

userID = GetNextMapUser(0, mapID)
while userID > 0
	if userID <> infectedUser
		if GetUserFlag(userID, 55) = 0
			if GetUserAccess(userID) < 6
				if Random(0, chanceToInfect) = 0
					SendMessageToAll(GetUserName(userID)+" has been infected with Bloodfever by "+GetUserName(infectedUser)+"!",#MSG_CRITICAL)
					SetUserFlag(userID,55,2)
					SetUserFlag(0,57,GetUserFlag(0,57)+1)
					SetUserFlag(infectedUser,57,GetUserFlag(infectedUser,57)+1)
					SendMessageToAll(GetUserName(infectedUser)+" has infected "+GetUserFlag(infectedUser,57)+" people!",#MSG_CRITICAL)
				endif
			endIf
		endIf
	endif
	userID = GetNextMapUser(userID, mapID)
wend

Continue = 1