# carF
$enddrive = {
	if cardrive = 1:gt 'street'
	if cardrive = 2:gt 'down'
	if cardrive = 3:gt 'Nord'
	if cardrive = 4:gt 'lake', 'start'
	if cardrive = 5:gt 'park', 'start'
	if cardrive = 6:gt 'zaprF', 'start'
	if cardrive = 7:gt 'autoservisF', 'start'
	if cardrive = 8:gt 'autosalonF', 'start'
	if cardrive = 9:gt 'autotraidF', 'start'
	if cardrive = 10:gt 'park', 'whore'
	if cardrive = 11:gt 'sauna'
	if cardrive = 12:gt 'obekt'
	if cardrive = 13:gt 'dachi'	
	if cardrive = 18:gt 'youplace'
	if cardrive = 19:gt'vokzal'
	if cardrive = 20:gt 'pavResidential'
	if cardrive = 21:gt'zaprF','start'
	if cardrive = 22:gt'road'
	if cardrive = 23:gt'Gaddvor'
	if cardrive = 24:gt'pavCommercial'
}

if $ARGS[0] = 'start':
	$metka = $ARGS[0]
	$loc = $CURLOC
	CLOSE ALL
	cla
	clr
	*clr
	minut += 1
	gs 'stat'
	fcolor = rgb(0, 0, 0)
	bcolor = rgb(255, 255, 255)
	lcolor = rgb(106, 90, 205)
	'<center><b><<$car>></b></center>'
	'<center><img src="images/picar/car<<car>>.jpg"></center>'

	act 'Move away from the machine':dynamic $enddrive

	if kanistra > 0:
		'In the trunk <<kanistra>> pc. five-liter jerry cans of gasoline.'

		if benz <= 35:
			act 'Pour canister into the tank':
				cla
				benz += 5
				kanistra -= 1
				'You filled canister of gasoline in the tank.'

				act 'Move away':gt 'carF', 'start'
			end
		end
	end

	act 'Get in the car':gt 'carF', 'salon'
end

if $ARGS[0] = 'salon':
	$metka = $ARGS[0]
	$loc = $CURLOC
	cla
	clr
	*clr
	minut += 1
	gs 'stat'
	'<center><b><<$car>></b></center>'
	'<center><img src="images/picar/salon<<car>>.jpg"></center>'
	'Gasoline - <<benz>> liters, fuel tank capacity of 40 liters.'

	if teh <= 0:teh = 0 & wrek = 1
	if teh <= 0 or wrek = 1:$teh = 'Car will not start, it needs repairs.'
	if teh >= tehcar * 75 / 100 and wrek = 0:$teh = 'Machine in excellent condition.'
	if teh < tehcar * 75 / 100 and teh >= tehcar * 50 / 100 and wrek = 0:$teh = 'When moving the machine you have any noises'
	if teh < tehcar * 50 / 100 and teh >= tehcar * 25 / 100 and wrek = 0:$teh = 'Car crash and barely rides.'
	if teh < tehcar * 25 / 100 and wrek = 0:$teh = 'As this bowl can still go, is a mystery even to the designers.'

	'<<$teh>>'

	if cardrive = 1:'Through the windshield you see the residential area.'
	if cardrive = 2:'Through the windshield you see downtown.'
	if cardrive = 3:'Through the windshield you see the northern region.'
	if cardrive = 4:'Through the windshield you see the lake.'
	if cardrive = 12:'Through the windshield you see a construction site.'
	if cardrive = 5:'Through the windshield, you can see the park.'
	if cardrive = 19:'Through the windshield you see Station.'
	if cardrive = 23:'Through the windshield you see huts of the village Gadyukino.'
	if cardrive = 24:'Through the windshield, you can see the Old Town.'

	if prava = 0:'You have no rights.'

	act 'Out of the car':dynamic $enddrive

	if benz > 0 and wrek = 0 and prava > 0:
		if teh >= tehcar * 75 / 100 and wrek = 0:
			wrekrand = rand(0, 1000)

			if wrekrand = 1000:wrek = 1
		elseif teh < tehcar * 75 / 100 and teh >= tehcar * 50/100 and wrek = 0:
			wrekrand = rand(0, 100)

			if wrekrand = 100:wrek = 1
		elseif teh < tehcar * 50 / 100 and teh >= tehcar * 25 / 100 and wrek = 0:
			wrekrand = rand(0, 100)

			if wrekrand >= 80:wrek = 1
		elseif teh < tehcar * 25 / 100 and wrek = 0:
			wrekrand = rand(0, 100)

			if wrekrand >= 40:wrek = 1
		elseif wrek = 1:
			'Something clattered loudly and the engine stalled.'

			act 'Fuck':gt 'carF', 'salon'
		end

		if alko > 0:
			dpsrand = rand(0, 100)

			if dpsrand <= alko:
				'Policeman stops you, he looks at your condition and requests to breath into a tube. You breathe and instrument panel lights red lamochka.'
				'Traffic police snorts and writes something in his cell, and then shows you. There is written sms with the number 50000'
				'Or let''s make the report. Now operates divestment forever for driving not sober.'

				if money >= 50000:
					act 'Give a bribe (50,000 <b>₽</b>)':
						cla
						money = money - 50000
						'You pay and the policeman warns you that you will not be riding in this state.'

						act 'In the salon':gt 'carF', 'salon'
					end
				end

				act 'Come on, all under the law':
					cla
					prava = 0
					'Disempower you, not for driving sober.'

					act 'In the salon':gt 'carF', 'salon'
				end

				exit
			end
		elseif alko >= 10:
			avarand = rand(0, 100)

			if avarand >= 50:
				teh /= 2
				wrek = 1
				'You with a drunk crashed into a tree, breaking the car into pieces.'

				act 'In the salon':gt 'carF', 'salon'

				exit
			end
		end

		if wrek = 0:
			if cardrive >= 20:
				if cardrive ! 3:
					act 'Go to town':
						cla
						minut += 75
						benz -= 1
						teh -= rand(3, 6)
						cardrive = 3
						'You are more than an hour drive on the highway that would get here before the city.'
						dynamic $enddrive
					end
				end

				if cardrive ! 21:
					act 'Go to the gas station':
						cla
						minut += 15
						benz -= 1
						teh -= rand(1, 3)
						cardrive = 21
						'You get 15 minutes to the destination.'
						dynamic $enddrive
					end
				end
			end

			if placeMansion > 0 and cardrive ! 18:
				act 'Go to your site':
					cla

					if cardrive >= 20:
						minut += 60
						benz -= 1
						teh -= rand(1, 3)
						cardrive = 18
					else
						minut += 15
						benz -= 1
						teh -= rand(1, 3)
						cardrive = 18
					end

					'You drive to the town.'
					dynamic $enddrive
				end
			end

			if cardrive ! 1 and cardrive < 20:
				act 'Go to the residential area':
					cla
					minut += 15
					benz -= 1
					teh -= rand(1, 3)
					cardrive = 1
					'You get 15 minutes to the destination.'
					dynamic $enddrive
				end
			end

			if cardrive ! 2 and cardrive < 20:
				act 'Go to city center':
					cla
					minut += 15
					benz -= 1
					teh -= rand(1, 3)
					cardrive = 2
					'You get 15 minutes to the destination.'
					dynamic $enddrive
				end
			end

			if cardrive ! 3 and cardrive < 20:
				act 'Go to the northern area':
					cla
					minut += 15
					benz -= 1
					teh -= rand(1, 3)
					cardrive = 3
					'You get 15 minutes to the destination.'
					dynamic $enddrive
				end
			end

			if cardrive ! 19 and cardrive < 20:
				act 'Go to the station':
					cla
					minut = minut + 15
					benz = benz - 1
					teh = teh - RAND(1,3)
					cardrive = 19

					'For you 15 minutes, get to your destination.'

					dynamic $enddrive
				end
			end

			if cardrive ! 4 and cardrive < 20:
				act 'Go to the lake':
					cla
					minut += 15
					benz -= 1
					teh -= rand(1, 3)
					cardrive = 4
					'You get 15 minutes to the destination.'
					dynamic $enddrive
				end
			end

			if cardrive ! 5 and cardrive < 20:
				act 'Go to the park':
					cla
					minut += 15
					benz -= 1
					teh -= rand(1, 3)
					cardrive = 5
					'You get 15 minutes to the destination.'
					dynamic $enddrive
				end
			end

			if cardrive ! 6 and cardrive < 20:
				act 'Go to the gas station':
					cla
					minut += 15
					benz -= 1
					teh -= rand(1, 3)
					cardrive = 6
					'You get 15 minutes to the destination.'
					dynamic $enddrive
				end
			end

			if cardrive ! 7 and cardrive < 20:
				act 'Go to the car wash':
					cla
					minut += 15
					benz -= 1
					teh -= rand(1, 3)
					cardrive = 7
					'You get 15 minutes to the destination.'
					dynamic $enddrive
				end
			end

			if cardrive ! 8 and cardrive < 20:
				act 'Go to a car dealership':
					cla
					minut += 15
					benz -= 1
					teh -= rand(1, 3)
					cardrive = 8
					'You get 15 minutes to the destination.'
					dynamic $enddrive
				end
			end

			if cardrive ! 9 and cardrive < 20:
				act 'Go to the car market':
					cla
					minut += 15
					benz -= 1
					teh -= rand(1, 3)
					cardrive = 9
					'You get 15 minutes to the destination.'
					dynamic $enddrive
				end
			end

			if cardrive ! 12:
				act 'Go to the construction site':
					cla
					if cardrive < 20:
						minut += 60
						'You get an hour to your destination.'
					else
						minut += 15
						'For you 15 minutes, get to your destination.'
					end
					benz -= 1
					teh -= rand(2, 5)
					cardrive = 12

					dynamic $enddrive
				end
			end

			if cardrive ! 13:
				act 'Go to the Suburban Cooperative':
					cla
					if cardrive >= 20:
						minut += 60
						'It takes an hour to get to your destination.'
					else
						minut += 15
						'15 minutes later, you arrive at your destination.'
					end
					benz -= 1
					teh -= rand(2, 5)
					cardrive = 13

					dynamic $enddrive
				end
			end

			if cardrive ! 20:
				act 'Go to pavResidential':
					cla
					benz -= 1
					teh -= rand(3, 6)
					cardrive = 20

					if cardrive < 20:
						minut += 75
						'You spend more than an hour on the highway going to Pavlovsk.'
					else
						minut += 15
						'15 minutes later, you reach your destination.'
					end

					dynamic $enddrive
				end
			end

			if cardrive ! 23:
				act 'To go to the countryside Gadyukino':
					cla
					benz = benz - 1
					teh = teh - RAND(3,6)
					cardrive = 23

					if cardrive < 20:
						minut += 75
						'You eat more than an hour on the highway in Pavlovsk.'
					else
						minut += 15
						'For you 15 minutes, get to your destination.'
					end

					dynamic $enddrive
				end
			end

			if cardrive ! 24:
				act 'Go to pavCommercial':
					cla
					benz -= 1
					teh -= rand(3, 6)
					cardrive = 24

					if cardrive < 20:
						minut += 75
						'You spend more than an hour on the highway going to Pavlovsk.'
					else
						minut += 15
						'15 minutes later, you reach your destination.'
					end

					dynamic $enddrive
				end
			end

			act 'Go around the track (1:00)':
				cla
				'You go on the road.'
				numberRoad = input("In which city will stop (from 0 to 20)")

				if numberRoad >= 0 and numberRoad <= 20:
					cardrive = 22
					nroad = numberRoad
					ncarroad = numberRoad
				end

				xgt 'carF', 'salon'
			end

			act 'To drive on the track (1:00)':
				cla
				minut += 60
				benz -= 4
				teh -= rand(2, 6)
				manna += 20
				wipo += 10
				'You go to the track and having fun Likhachev, then turn back.'

				act 'Finish':xgt 'carF', 'salon'
			end
		end
	end
end

--- carF ---------------------------------

