{$CLEO .cs}

//-------------MAIN---------------
thread 'CopCarVgWA' 
0000: NOP 

:start0
wait 0 
if
   Actor.DrivingVehicleType($PLAYER_ACTOR, #COPCARVG)
else_jump @start0 
0@ = Actor.CurrentCar($PLAYER_ACTOR)
20@ = 0

//---------------------------------

:start1
wait 0 
if
   Actor.DrivingVehicleType($PLAYER_ACTOR, #COPCARVG)
else_jump @reset
wait 0 
if
00E1:   player 0 pressed_key 3 // special control up/down
else_jump @start1

0A30: repair_car 0@
wait 500
01F0: set_max_wanted_level_to 0 // 0-6
02AC: set_car 0@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
053F: set_car 0@ tires_vulnerability 0
03F3: get_car 0@ primary_color_to 26@ secondary_color_to 27@
0A12: get_car 0@ tertiary_color_to 24@ quaternary_color_to 25@
wait 500
06ED: set_car 0@ paintjob 0
wait 500
0229: set_car 0@ primary_color_to 26@ secondary_color_to 27@
0A11: set_car 0@ tertiary_color_to 24@ quaternary_color_to 25@

//---------------------------------

:start2
wait 0 
if
00E1:   player 0 pressed_key 11 // YES.
else_jump @start2b
jump @shot 

:start2b
wait 0
if and
00E1:   player 0 pressed_key 10 // NO.
0039:   20@ == 0
else_jump @start2c
09E9: car 0@ add_single_nitro
20@ = 1

:start2c
wait 0 
if
   Actor.DrivingVehicleType($PLAYER_ACTOR, #COPCARVG)
else_jump @reset
wait 0
if
00E1:   player 0 pressed_key 3 // special control up/down
else_jump @start2

01F0: set_max_wanted_level_to 6 // 0-6
02AC: set_car 0@ immunities BP 0 FP 0 EP 0 CP 0 MP 0
053F: set_car 0@ tires_vulnerability 1
03F3: get_car 0@ primary_color_to 26@ secondary_color_to 27@
0A12: get_car 0@ tertiary_color_to 24@ quaternary_color_to 25@
wait 500
06ED: set_car 0@ paintjob -1
wait 500
0229: set_car 0@ primary_color_to 26@ secondary_color_to 27@
0A11: set_car 0@ tertiary_color_to 24@ quaternary_color_to 25@
jump @start1

:shot
0208: 7@ = random_float_in_ranges -1.5 1.5 
0208: 8@ = random_float_in_ranges -1.5 1.5
0208: 17@ = random_float_in_ranges -1.5 1.5 
0208: 18@ = random_float_in_ranges -1.5 1.5
0407: store_coords_to 1@ 2@ 3@ from_car 0@ with_offset 7@ 100.0 8@
0407: store_coords_to 11@ 12@ 13@ from_car 0@ with_offset 17@ 100.0 18@
0407: store_coords_to 4@ 5@ 6@ from_car 0@ with_offset 0.75 2.40 0.27
0407: store_coords_to 14@ 15@ 16@ from_car 0@ with_offset -0.75 2.40 0.27
06BC: create_M4_shoot_from 4@ 5@ 6@ target 1@ 2@ 3@ energy 3000 
06BC: create_M4_shoot_from 14@ 15@ 16@ target 11@ 12@ 13@ energy 3000 
09F1: play_audio_at_actor $PLAYER_ACTOR event 1157 
066C: 9@ = attach_particle "GUNFLASH" to_car 0@ with_offset 0.75 2.44 0.27  rotation 0.0 90.0 0.0 type 1 
066C: 19@ = attach_particle "GUNFLASH" to_car 0@ with_offset -0.75 2.43 0.27  rotation 0.0 90.0 0.0 type 1 
064C: make_particle 9@ visible 
064C: make_particle 19@ visible 
wait 100 
064F: remove_references_to_particle 9@
064F: remove_references_to_particle 19@
jump @start2

//----------------------------------

:reset
Car.RemoveReferences(0@)
jump @start0
0A93: end_custom_thread