<%@ Template Language="C#" TargetLanguage="gta2mis" Description="Generates Tiny Face Off Army." %>
<%@ Property Name="PlayerCount" Type="System.Int32" Default="6" Category="Options" Description="This is the amount of players that this script should support." %>
<%@ Property Name="Author" Type="System.String" Default="anybody" Category="Options" Description="Author" %>
<%@ Property Name="Mapname" Type="System.String" Default="anymap" Category="Options" Description="Map name" %>
<% System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); %>
<script runat="template">
const int PU_NONE = -1;
const int PU_OBJECT = 0;
const int PU_INSTANT = 1;
const int PU_EVER = 2;

public struct pos{
	public pos(double x,double y,double z){
        this.x = x;
		this.y = y;
		this.z = z;
	}
	public double x;
	public double y;
	public double z;
	public override string ToString(){
		return(string.Format(" {0:0.00}, {1:0.00} , {2:0.00} ", x, y, z));
	}
}
public struct respawn_vehicle{
   public respawn_vehicle( string name, pos pos, int rotation, string model, int remap){
	   this.name = name;
	   this.pos = pos;
	   this.rotation = rotation;
	   this.model = model;
	   this.remap = remap;
   }
   public string name;
   public pos pos;
   public int rotation;
   public string model;
   public int remap;
}
</script>


//{ //Header
//Block Fort MEME
//Based on Block Fort Nyan by Sektor GTAMP.com
//Based on Block Fort Wipe Out by Sektor GTAMP.com
//Based on Block Fort Tag by Wario5
//thanks to gustavob for helping to fix the gang bug

//	        N=180
//W=270--------|---------E=90
//            S=0

//formated and enhanced by Elypter
//bff-meme.mis Compiled by <%=Author%> on <%= DateTime.Now.ToLongDateString() %> with codesmith
//}

//{ //Declares

//{ //PlayerDefines
PLAYER_PED p1 = (108.0, 124.0, 1.0) 0 90
PLAYER_PED p2 = (108.0, 124.5, 1.0) 0 90
PLAYER_PED p3 = (108.0, 125.0, 1.0) 0 90
PLAYER_PED p4 = (108.0, 125.5, 1.0) 0 90
PLAYER_PED p5 = (108.0, 126.0, 1.0) 0 90
PLAYER_PED p6 = (108.0, 126.5, 1.0) 0 90
//}

//{ //Player Declares <% for(int i=1;i<=PlayerCount;i++){%>

//{ //Player<%=i%>
	//#region player_declare
	//#endregion
	COUNTER p<%=i%>stopped = 0
	COUNTER p<%=i%>_trg_ic = 1
	COUNTER p<%=i%>_incar = 0
	COUNTER p<%=i%>_trg_ph = 1
	COUNTER p<%=i%>_phorn = 0
	CAR_DATA p<%=i%>_v
	CAR_DATA p<%=i%>_turret
	CHAR_DATA p<%=i%>_gunman
	CHAR_DATA p<%=i%>_gunhelper
	CHAR_DATA p<%=i%>_gangbot1
	CHAR_DATA p<%=i%>_gangbot2
	CHAR_DATA p<%=i%>_gangbot3
	CHAR_DATA p<%=i%>_gangbot4
	COUNTER p<%=i%>_exit_c = 0
//}

<% } %> //}

//{ //gangs and zones

//thanks to gustavob here for helping to fix the gang bug

//XXXXgang must exist in GMP file or crash and it has to have a name like in that form or gangs wont show up):
//redngang must have that name for 2 hair color peds to work
//SET_GANG_INFO (nullgang, 12, PISTOL, PISTOL, PISTOL, 0, 128.5, 128.5, 2.0, 5, ICECREAM, -1) //causes respectometer graphic bug
SET_GANG_INFO (einsgang, 52, PISTOL, PISTOL, PISTOL, 1, 128.5, 128.5, 2.0, 5, ISETTA, 26) //Loonies, Pinky Pie
SET_GANG_INFO (zweigang, 13, PISTOL, PISTOL, PISTOL, 2, 128.5, 128.5, 2.0, 5, MIURA, 14) //Yakuza, Luna
SET_GANG_INFO (dreigang, 12, PISTOL, SILENCED_MACHINE_GUN, ROCKET_LAUNCHER, 3, 128.5, 129.5, 2.0, 5, VTYPE, 34) //Zaibatsu, Rarity
SET_GANG_INFO (redngang, 9, PISTOL, MACHINE_GUN, MOLOTOV, 4, 129.5, 128.5, 2.0, 5, PICKUP, 10) //Rednecks, Apple Jack
SET_GANG_INFO (funfgang, 19, PISTOL, MACHINE_GUN, FLAME_THROWER, 5, 128.5, 130.5, 2.0, 5, STRATOS, 3) //SRS Scientists, Rainbow Dash
SET_GANG_INFO (sechgang, 45, PISTOL, MOLOTOV, FLAME_THROWER, 6, 130.5, 128.5, 2.0, 5, KRSNABUS, -1) //Hare Krishna, Fluttershy
SET_GANG_INFO (siebgang, 18, PISTOL, SHOTGUN, MACHINE_GUN, 7, 128.5, 131.5, 2.0, 5, BUICK, 27) //Russian Mafia, Twilight Sparkle

MAP_ZONE cityinfo = ( 800 , 550, 0, 0 , 1000 , 0 , 0 , 300, 700 , 0, 450 )
//}

//{ //Conveyor,Crusher,Destructor,Cranes,Trains,Gangs,Shops
CONVEYOR con1 = (135.0, 160.0) (5.0, 25.0) 0 -7

// SHOPS
OBJ_DATA srpayshop01 = (122.0, 115.0, 2.0) 0 CAR_SHOP 2 // black bottom right
OBJ_DATA sprayshop02 = (103.0, 115.0, 2.0) 0 CAR_SHOP 5 // green bottom left
OBJ_DATA sprayshop03 = (103.0, 97.0, 2.0) 0 CAR_SHOP 10 // yellow top left
OBJ_DATA sprayshop04 = (122.0, 97.0, 2.0) 0 CAR_SHOP 33 // white top right
//}

//{ //Collectibles
// HEALTH
GENERATOR HEALTH01 = (83.5, 106.5) 0 COLLECT_30 0 0 20 // left
GENERATOR HEALTH02 = (141.5, 106.5) 0 COLLECT_30 0 0 20 // right
GENERATOR HEALTH03 = (112.5, 67.5) 0 COLLECT_30 0 0 20 // top
GENERATOR HEALTH04 = (112.5, 144.5) 0 COLLECT_30 0 0 20 // bottom
GENERATOR HEALTH05 = (112.5, 106.5) 0 COLLECT_30 0 0 20 // center

// INSTANT GANGS
GENERATOR GANG01 = (87.5, 71.5) 0 COLLECT_40 0 0 20
GENERATOR GANG02 = (137.5, 71.5) 0 COLLECT_40 0 0 20
GENERATOR GANG03 = (137.5, 140.5) 0 COLLECT_40 0 0 20
GENERATOR GANG04 = (87.5, 140.5) 0 COLLECT_40 0 0 20

// EXPLOSIVES
GENERATOR MOLI01 = (122.5, 92.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI02 = (122.5, 120.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI03 = (102.5, 120.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI04 = (102.5, 92.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI05 = (112.5, 84.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI06 = (125.0, 101.0) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI07 = (112.5, 97.0) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI08 = (112.5, 115.0) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI09 = (112.5, 131.0) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI10 = (112.5, 81.0) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI11 = (84.5, 125.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI12 = (137.5, 106.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI13 = (108.5, 103.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI14 = (98.0, 73.0) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI15 = (122.5, 144.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI16 = (137.5, 91.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI17 = (122.0, 106.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI18 = (103.0, 106.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI19 = (87.5, 106.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI20 = (122.5, 139.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI21 = (95.0, 106.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI22 = (130.0, 106.5) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI23 = (125.0, 111.0) 0 COLLECT_04 2500 2500 10
GENERATOR MOLI24 = (127.0, 73.0) 0 COLLECT_04 2500 2500 10

GENERATOR GREN01 = (133.5, 134.5) 0 COLLECT_05 2500 2500 15
GENERATOR GREN02 = (91.5, 134.5) 0 COLLECT_05 2500 2500 15
GENERATOR GREN03 = (91.5, 77.5) 0 COLLECT_05 2500 2500 15
GENERATOR GREN04 = (133.5, 77.5) 0 COLLECT_05 2500 2500 15

GENERATOR ELECTRO = (112.5, 72.5) 0 COLLECT_03 0 0 99

GENERATOR ZAP01 = (83.0, 56.0, 2.0) 0 COLLECT_03 0 0 99
GENERATOR ZAP02 = (86.0, 56.0, 2.0) 0 COLLECT_03 0 0 99
GENERATOR INSTANTBOMB = (134.5, 169.5, 2.0) 0 COLLECT_23 0 0 99

GENERATOR INVULV = (112.5, 139.5) 0 COLLECT_34 100 100 99
GENERATOR DOUBLEDAMAGE_SE1 = (127.5, 115.5) 0 COLLECT_35 100 300 99
GENERATOR DOUBLEDAMAGE_SE2 = (130.5, 131.5) 0 COLLECT_35 300 300 99
GENERATOR DOUBLEDAMAGE_SE3 = (126.5, 127.5) 0 COLLECT_35 300 300 99

GENERATOR DOUBLEDAMAGE_NE1 = (97.5, 115.5) 0 COLLECT_35 300 300 99
GENERATOR DOUBLEDAMAGE_NE2 = (94.5, 131.5) 0 COLLECT_35 300 300 99
GENERATOR DOUBLEDAMAGE_NE3 = (98.5, 127.5) 0 COLLECT_35 300 300 99

GENERATOR DOUBLEDAMAGE_NW1 = (97.5, 96.5) 0 COLLECT_35 300 300 99
GENERATOR DOUBLEDAMAGE_NW2 = (98.5, 84.5) 0 COLLECT_35 300 300 99
GENERATOR DOUBLEDAMAGE_NW3 = (94.5, 80.5) 0 COLLECT_35 300 300 99

GENERATOR DOUBLEDAMAGE_SW1 = (127.5, 96.5) 0 COLLECT_35 300 300 99
GENERATOR DOUBLEDAMAGE_SW2 = (126.5, 84.5) 0 COLLECT_35 300 300 99
GENERATOR DOUBLEDAMAGE_SW3 = (130.5, 80.5) 0 COLLECT_35 300 300 99

GENERATOR ARMOR1 = (105.0, 113.0) 0 COLLECT_31 0 0 99
GENERATOR ARMOR2 = (105.0, 99.0) 0 COLLECT_31 0 0 99
GENERATOR ARMOR3 = (119.9, 113.1) 0 COLLECT_31 0 0 99
GENERATOR ARMOR4 = (120.0, 99.0) 0 COLLECT_31 0 0 99
//}

//{ //Scripting


//car01 = CREATE_CAR (94.5, 80.5) 2 45 ISETTA END
//car02 = CREATE_CAR (98.5, 84.5) 2 225 ISETTA END
//car03 = CREATE_CAR (130.5, 80.5) 2 315 PICKUP END
//car04 = CREATE_CAR (126.5, 84.5) 2 135 PICKUP END
//car05 = CREATE_CAR (127.5, 96.5) 2 270 KRSNABUS END
//car06 = CREATE_CAR (127.5, 115.5) 2 270 KRSNABUS END
//car07 = CREATE_CAR (130.5, 131.5) 2 225 VTYPE END
//car08 = CREATE_CAR (126.5, 127.5) 2 45 VTYPE END
//car09 = CREATE_CAR (94.5, 131.5) 2 135 MIURA END
//car10 = CREATE_CAR (98.5, 127.5) 2 315 MIURA END
//car11 = CREATE_CAR (97.5, 115.5) 2 90 STRATOS END
//car12 = CREATE_CAR (97.5, 96.5) 2 90 STRATOS END

//car13 = CREATE_CAR (112.5, 68.5) 2 0 EDSEL END


<% 
respawn_vehicle[] rvs = { 
new respawn_vehicle( "car01", new pos( 94.5, 80.5, 255.0 ), 45, "ISETTA", 26 ),
new respawn_vehicle( "car02", new pos( 98.5, 84.5, 255.0 ), 225, "ISETTA", 26 ),
new respawn_vehicle( "car03", new pos( 130.5, 80.5, 255.0 ), 315, "PICKUP", 10 ),
new respawn_vehicle( "car04", new pos( 126.5, 84.5, 255.0 ), 135, "PICKUP", 10 ),
new respawn_vehicle( "car05", new pos( 127.5, 96.5, 255.0 ), 270, "KRSNABUS", -1 ),
new respawn_vehicle( "car06", new pos( 127.5, 115.5, 255.0 ), 270, "KRSNABUS", -1 ),
new respawn_vehicle( "car07", new pos( 130.5, 131.5, 255.0 ), 225, "VTYPE", 34 ),
new respawn_vehicle( "car08", new pos( 126.5, 127.5, 255.0 ), 45 , "VTYPE", 34 ),
new respawn_vehicle( "car09", new pos( 94.5, 131.5, 255.0 ), 135, "MIURA", 14 ),
new respawn_vehicle( "car10", new pos( 98.5, 127.5, 255.0 ), 315, "MIURA", 14 ),
new respawn_vehicle( "car11", new pos( 97.5, 115.5, 255.0 ), 90, "STRATOS", 3 ),
new respawn_vehicle( "car12", new pos( 97.5, 96.5, 255.0 ), 90, "STRATOS", 3 ),
new respawn_vehicle( "car13", new pos( 112.5, 145.3, 255.0 ), 270, "ICECREAM", -1 )
};
%>

<% foreach(respawn_vehicle rv in rvs){ %>
//<%=rv.name%> = CREATE_CAR (<%=rv.pos%>) <%=rv.remap%> <%=rv.rotation%> <%=rv.model%> END
CAR_DATA <%=rv.name%>
<% } %>


// gang cars:
CAR_DATA gang_car0
CAR_DATA gang_car1
CAR_DATA gang_car2
CAR_DATA gang_car3
CAR_DATA gang_car4
CAR_DATA gang_car5
CAR_DATA gang_car6
CAR_DATA gang_car7

// car respawning
PARKED_CAR_DATA trailer = (1.0, 1.0) 19 90 TRUKTRNS
CAR_DATA mount
CAR_DATA decal

OBJ_DATA itarget = (112.5, 106.5) 0 INVISIBLE_TARGET

OBJ_DATA del_mine
OBJ_DATA del_oil
COUNTER mineoil_tmr =0
COUNTER mineoil_max = 10

COUNTER ambient=1
COUNTER wait = 0
COUNTER mainloop = 1
COUNTER firstrun=1
//}

//{ //Staic Cars

//PARKED CARS
PARKED_CAR_DATA parked01 = (141.0, 144.5) 2 270 EDSEL
PARKED_CAR_DATA parked02 = (93.0, 115.5) 2 270 EDSEL
PARKED_CAR_DATA parked03 = (93.0, 96.5) 2 270 EDSEL
PARKED_CAR_DATA parked04 = (123.5, 98.1) 2 0 EDSEL
PARKED_CAR_DATA parked05 = (129.5, 79.0) 2 270 EDSEL
PARKED_CAR_DATA parked06 = (97.0, 91.5) 2 270 EDSEL
PARKED_CAR_DATA parked07 = (126.5, 129.5) 2 270 EDSEL
PARKED_CAR_DATA parked08 = (95.5, 133.0) 2 90 EDSEL
PARKED_CAR_DATA parked09 = (132.0, 96.5) 2 90 EDSEL
PARKED_CAR_DATA parked10 = (96.5, 139.5) 2 90 EDSEL
PARKED_CAR_DATA parked11 = (90.5, 145.5) 2 90 EDSEL
PARKED_CAR_DATA parked12 = (129.5, 133.0) 2 270 EDSEL
PARKED_CAR_DATA parked13 = (127.0, 145.0) 2 90 EDSEL
PARKED_CAR_DATA parked14 = (141.5, 122.0) 2 180 EDSEL
PARKED_CAR_DATA parked15 = (141.5, 84.5) 2 180 EDSEL
PARKED_CAR_DATA parked16 = (129.5, 68.0) 2 0 EDSEL
PARKED_CAR_DATA parked17 = (122.5, 68.0) 2 0 EDSEL
PARKED_CAR_DATA parked18 = (85.0, 67.0) 2 0 EDSEL
PARKED_CAR_DATA parked19 = (98.1, 67.0) 2 0 EDSEL
PARKED_CAR_DATA parked20 = (93.0, 81.5) 2 0 EDSEL
PARKED_CAR_DATA parked21 = (84.1, 128.0) 2 0 EDSEL
PARKED_CAR_DATA parked22 = (96.5, 127.5) 2 180 EDSEL
PARKED_CAR_DATA parked23 = (98.5, 82.5) 2 90 EDSEL
PARKED_CAR_DATA parked24 = (126.5, 82.5) 2 270 EDSEL
PARKED_CAR_DATA parked25 = (111.0, 80.0) 2 100 BUS
PARKED_CAR_DATA parked26 = (113.5, 80.0) 2 90 BUS
PARKED_CAR_DATA parked27 = (116.0, 80.0) 2 260 BUS
PARKED_CAR_DATA parked28 = (111.0, 81.9) 2 80 BUS
PARKED_CAR_DATA parked29 = (113.5, 81.9) 2 90 BUS
PARKED_CAR_DATA parked30 = (116.0, 81.9) 2 280 BUS
PARKED_CAR_DATA parked31 = (111.0, 96.0) 2 100 BUS
PARKED_CAR_DATA parked32 = (113.5, 96.0) 2 90 BUS
PARKED_CAR_DATA parked33 = (116.0, 96.0) 2 260 BUS
PARKED_CAR_DATA parked34 = (111.0, 97.9) 2 80 BUS
PARKED_CAR_DATA parked35 = (113.5, 97.9) 2 90 BUS
PARKED_CAR_DATA parked36 = (116.0, 97.9) 2 280 BUS
PARKED_CAR_DATA parked37 = (111.0, 114.0) 2 95 BUS
PARKED_CAR_DATA parked38 = (113.5, 114.0) 2 90 BUS
PARKED_CAR_DATA parked39 = (116.0, 114.0) 2 260 BUS
PARKED_CAR_DATA parked40 = (111.0, 115.9) 2 85 BUS
PARKED_CAR_DATA parked41 = (113.5, 115.9) 2 90 BUS
PARKED_CAR_DATA parked42 = (116.0, 115.9) 2 280 BUS
PARKED_CAR_DATA parked43 = (111.0, 130.0) 2 100 BUS
PARKED_CAR_DATA parked44 = (113.5, 130.0) 2 90 BUS
PARKED_CAR_DATA parked45 = (116.0, 130.0) 2 80 BUS
PARKED_CAR_DATA parked46 = (111.0, 132.0, 6.0) 2 80 BUS
PARKED_CAR_DATA parked47 = (113.5, 131.9) 2 90 BUS
PARKED_CAR_DATA parked48 = (116.0, 131.9) 2 100 BUS
PARKED_CAR_DATA parked49 = (131.0, 106.5, 6.0) 2 0 BUS
PARKED_CAR_DATA parked50 = (94.0, 106.5) 2 0 BUS
PARKED_CAR_DATA parked51 = (129.3, 81.7) 2 225 EDSEL
PARKED_CAR_DATA parked52 = (97.3, 83.3) 2 135 EDSEL
PARKED_CAR_DATA parked53 = (98.5, 129.5) 2 90 EDSEL
PARKED_CAR_DATA parked54 = (124.9, 77.0) 2 270 EDSEL
PARKED_CAR_DATA parked55 = (99.8, 77.0) 2 120 EDSEL
PARKED_CAR_DATA parked56 = (102.0, 135.0) 2 45 EDSEL
PARKED_CAR_DATA parked57 = (132.0, 115.5) 2 90 EDSEL
PARKED_CAR_DATA parked58 = (132.1, 125.0) 2 270 EDSEL
PARKED_CAR_DATA parked59 = (128.3, 123.0) 2 270 EDSEL
PARKED_CAR_DATA parked60 = (127.7, 128.7) 2 315 EDSEL
PARKED_CAR_DATA parked61 = (97.1, 120.0) 2 270 EDSEL
PARKED_CAR_DATA parked62 = (101.9, 127.0) 2 300 EDSEL
PARKED_CAR_DATA parked63 = (127.7, 83.3) 2 45 EDSEL
PARKED_CAR_DATA parked64 = (93.0, 130.5) 2 180 EDSEL
PARKED_CAR_DATA parked65 = (132.0, 130.5) 2 180 EDSEL
PARKED_CAR_DATA parked66 = (132.0, 81.5) 2 0 EDSEL
PARKED_CAR_DATA parked67 = (96.5, 84.5) 2 0 EDSEL
PARKED_CAR_DATA parked68 = (97.2, 128.8) 2 225 EDSEL
PARKED_CAR_DATA parked69 = (128.5, 127.5) 2 180 EDSEL
PARKED_CAR_DATA parked70 = (128.2, 134.9) 2 0 EDSEL
PARKED_CAR_DATA parked71 = (123.0, 84.2) 2 180 EDSEL
PARKED_CAR_DATA parked72 = (95.5, 79.0) 2 90 EDSEL
PARKED_CAR_DATA parked73 = (134.2, 88.2) 2 0 EDSEL
PARKED_CAR_DATA parked74 = (90.6, 88.0) 2 335 EDSEL
PARKED_CAR_DATA parked75 = (91.3, 115.4) 2 180 EDSEL
PARKED_CAR_DATA parked76 = (90.4, 126.9) 2 0 EDSEL
PARKED_CAR_DATA parked77 = (85.5, 144.0) 2 90 EDSEL
PARKED_CAR_DATA parked78 = (97.5, 113.0) 2 270 EDSEL
PARKED_CAR_DATA parked79 = (131.9, 113.2) 2 270 EDSEL
PARKED_CAR_DATA parked80 = (136.0, 106.5) 2 270 EDSEL
PARKED_CAR_DATA parked81 = (133.8, 124.0) 2 180 EDSEL
PARKED_CAR_DATA parked82 = (133.8, 127.3) 2 5 EDSEL
PARKED_CAR_DATA parked83 = (96.5, 98.7) 2 270 EDSEL
PARKED_CAR_DATA parked84 = (88.5, 106.5) 2 90 EDSEL
PARKED_CAR_DATA parked85 = (91.1, 96.5) 2 0 EDSEL
PARKED_CAR_DATA parked86 = (101.7, 96.8) 2 0 EDSEL
PARKED_CAR_DATA parked87 = (133.6, 115.3) 2 0 EDSEL
PARKED_CAR_DATA parked88 = (133.8, 97.3) 2 5 EDSEL
//PARKED_CAR_DATA parked89 = (112.5, 145.3) 2 270 EDSEL
PARKED_CAR_DATA parked90 = (127.4, 120.3) 2 90 EDSEL
PARKED_CAR_DATA parked91 = (101.7, 84.2) 2 0 EDSEL
PARKED_CAR_DATA parked92 = (128.0, 94.5) 2 270 EDSEL
PARKED_CAR_DATA parked93 = (128.1, 98.6) 2 270 EDSEL
PARKED_CAR_DATA parked94 = (122.9, 133.1) 2 270 EDSEL
PARKED_CAR_DATA parked95 = (123.0, 128.3) 2 0 EDSEL
PARKED_CAR_DATA parked96 = (128.5, 84.5) 2 0 EDSEL
PARKED_CAR_DATA parked97 = (95.7, 81.7) 2 315 EDSEL
PARKED_CAR_DATA parked98 = (96.9, 135.1) 2 0 EDSEL
PARKED_CAR_DATA parked99 = (123.4, 114.9) 2 180 EDSEL
PARKED_CAR_DATA parked100 = (95.8, 130.2) 2 45 EDSEL
PARKED_CAR_DATA parked101 = (129.3, 130.3) 2 135 EDSEL
PARKED_CAR_DATA parked102 = (101.5, 115.0) 2 0 EDSEL
PARKED_CAR_DATA parked103 = (84.5, 164.0) 2 180 TANK
PARKED_CAR_DATA parked105 = (134.5, 169.5) 2 180 GT24640
PARKED_CAR_DATA parked106 = (131.0, 103.0, 6.0) 2 0 BUS
PARKED_CAR_DATA parked107 = (131.0, 110.0, 6.0) 2 0 BUS
PARKED_CAR_DATA parked108 = (94.0, 103.0) 2 0 BUS
PARKED_CAR_DATA parked109 = (94.0, 110.0) 2 0 BUS

PARKED_CAR_DATA parkedbus00 = (129.0, 106.5) 2 180 BUS
PARKED_CAR_DATA parkedbus01 = (129.0, 103.0) 2 180 BUS
PARKED_CAR_DATA parkedbus02 = (121.0, 105.5) 2 270 BUS
PARKED_CAR_DATA parkedbus03 = (121.0, 104.5) 2 270 BUS
PARKED_CAR_DATA parkedbus04 = (123.0, 108.5, 4.0) 2 90 BUS
PARKED_CAR_DATA parkedbus05 = (123.0, 107.5, 4.0) 2 90 BUS
PARKED_CAR_DATA parkedbus06 = (102.0, 105.5) 2 270 BUS
PARKED_CAR_DATA parkedbus07 = (102.0, 104.5) 2 270 BUS
PARKED_CAR_DATA parkedbus08 = (104.0, 108.5, 4.0) 2 90 BUS
PARKED_CAR_DATA parkedbus09 = (104.0, 107.5, 4.0) 2 90 BUS
PARKED_CAR_DATA parkedbus10 = (96.0, 103.0, 6.0) 2 180 BUS
PARKED_CAR_DATA parkedbus11 = (96.0, 110.0, 6.0) 2 180 BUS
PARKED_CAR_DATA parkedbus12 = (96.0, 106.5, 6.0) 2 180 BUS
PARKED_CAR_DATA parkedbus13 = (129.0, 110.0) 2 180 BUS

//}

//{ //Static Objects
// BARRICADES
OBJ_DATA BOLLARD1 = (131.5, 134.5, 4.0) 90 MINE
OBJ_DATA BOLLARD2 = (131.5, 135.5, 4.0) 90 MINE
OBJ_DATA BOLLARD3 = (133.5, 132.5, 4.0) 0 MINE
OBJ_DATA BOLLARD4 = (134.5, 132.5, 4.0) 0 MINE

OBJ_DATA BOLLARD5 = (90.5, 132.5, 4.0) 0 MINE
OBJ_DATA BOLLARD6 = (91.5, 132.5, 4.0) 0 MINE
OBJ_DATA BOLLARD7 = (93.5, 134.5, 4.0) 90 MINE
OBJ_DATA BOLLARD8 = (93.5, 135.5, 4.0) 90 MINE

OBJ_DATA BOLLARD9 = (90.5, 79.5, 4.0) 0 MINE
OBJ_DATA BOLLARD10 = (91.5, 79.5, 4.0) 0 MINE
OBJ_DATA BOLLARD11 = (93.5, 76.5, 4.0) 90 MINE
OBJ_DATA BOLLARD12 = (93.5, 77.5, 4.0) 90 MINE

OBJ_DATA BOLLARD13 = (131.5, 76.5, 4.0) 90 MINE
OBJ_DATA BOLLARD14 = (131.5, 77.5, 4.0) 90 MINE
OBJ_DATA BOLLARD15 = (133.5, 79.5, 4.0) 0 MINE
OBJ_DATA BOLLARD16 = (134.5, 79.5, 4.0) 0 MINE
OBJ_DATA BOLLARD17 = (84.5, 155.9, 1.0) 0 BOLLARD
OBJ_DATA BOLLARD18 = (84.5, 57.1, 1.0) 0 BOLLARD
//}

//}

LEVELSTART

SOUND teleportsnd

WHILE_EXEC ( mainloop = 1 )

//{ // respawning cars
<% foreach(respawn_vehicle rv in rvs){ %>
IF ((firstrun=1) OR (IS_CAR_WRECKED(<%=rv.name%>))) //IS_CAR_WRECKED(<%=rv.name%>)
 IF ((NOT (DELAY (100))) OR (firstrun=1)) // let explosion happen
  IF (NOT (IS_POINT_ONSCREEN(<%=rv.pos%>)))
   IF (( firstrun=0 ) AND (IS_CAR_IN_BLOCK(<%=rv.name%>, <%=rv.pos%>, 1.0, 1.0))) //firstrun=0
    // Wreck is blocking spawnpoint:
	PUT_CAR_ON_TRAILER (<%=rv.name%>, trailer)
	DELETE_ITEM (<%=rv.name%>)
   ENDIF
   // Spawnpoint is clear:
   <%=rv.name%> = CREATE_GANG_CAR (<%=rv.pos%>) <%=rv.remap%> <%=rv.rotation%> <%=rv.model%> END
   //not working because decals disappear after putting cars on a trailer
   //mount = CREATE_CAR (1.0, 1.0) 0 0 ISETTA MINI_CAR END
   //decal = CREATE_GANG_CAR (1.0, 1.0) <%=rv.remap%> 0 <%=rv.model%> END
   //PUT_CAR_ON_TRAILER (mount, <%=rv.name%>)
   //PUT_CAR_ON_TRAILER (decal, mount)
  ENDIF
 ENDIF
ENDIF

<% } %>
//}

IF (firstrun=1)

// gang cars:

//gang_car0 = CREATE_GANG_CAR (127.9, 93.6) -1 0 ICECREAM END
//gang_car1 = CREATE_GANG_CAR (122.3, 93.8) 26 0 ISETTA END
//gang_car2 = CREATE_GANG_CAR (123.0, 93.7) 14 0 MIURA END
//gang_car3 = CREATE_GANG_CAR (123.8, 93.7) 34 0 VTYPE END
//gang_car4 = CREATE_GANG_CAR (124.6, 93.7) 10 0 PICKUP END
//gang_car5 = CREATE_GANG_CAR (125.4, 93.7) 3 0 STRATOS END
//gang_car6 = CREATE_GANG_CAR (126.2, 93.5) -1 0 KRSNABUS END
//gang_car7 = CREATE_GANG_CAR (127.0, 93.7) 27 0 BUICK END

// Maximum brightness:
SET_AMBIENT_LEVEL  (1.0, 0)

// POLICE
DECLARE_POLICELEVEL (6)

//{ // Gangs
SET_GANG_KILL_REACTION (einsgang, einsgang, 1)
SET_GANG_KILL_REACTION (zweigang, zweigang, 1)
SET_GANG_KILL_REACTION (dreigang, dreigang, 1)
SET_GANG_KILL_REACTION (redngang, redngang, 1)
SET_GANG_KILL_REACTION (funfgang, funfgang, 1)
SET_GANG_KILL_REACTION (sechgang, sechgang, 1)
SET_GANG_KILL_REACTION (siebgang, siebgang, 1)
//}

GIVE_WEAPON ( parked105, CAR_BOMB_INSTANT )

DISPLAY_BRIEF_NOW (1001)

//{ //Cars

//}

//{ //Score
ADD_SCORE ( p1, 1000000 )
ADD_SCORE ( p2, 1000000 )
ADD_SCORE ( p3, 1000000 )
ADD_SCORE ( p4, 1000000 )
ADD_SCORE ( p5, 1000000 )
ADD_SCORE ( p6, 1000000 )
//}

//{ //Generators
SWITCH_GENERATOR ( HEALTH01 , ON )
SWITCH_GENERATOR ( HEALTH02 , ON )
SWITCH_GENERATOR ( HEALTH03 , ON )
SWITCH_GENERATOR ( HEALTH04 , ON )
SWITCH_GENERATOR ( HEALTH05 , ON )

SWITCH_GENERATOR ( GANG01 , ON )
SWITCH_GENERATOR ( GANG02 , ON )
SWITCH_GENERATOR ( GANG03 , ON )
SWITCH_GENERATOR ( GANG04 , ON )

SWITCH_GENERATOR ( MOLI01 , ON )
SWITCH_GENERATOR ( MOLI02 , ON )
SWITCH_GENERATOR ( MOLI03 , ON )
SWITCH_GENERATOR ( MOLI04 , ON )
SWITCH_GENERATOR ( MOLI05 , ON )
SWITCH_GENERATOR ( MOLI06 , ON )
SWITCH_GENERATOR ( MOLI07 , ON )
SWITCH_GENERATOR ( MOLI08 , ON )
SWITCH_GENERATOR ( MOLI09 , ON )
SWITCH_GENERATOR ( MOLI10 , ON )
SWITCH_GENERATOR ( MOLI11 , ON )
SWITCH_GENERATOR ( MOLI12 , ON )
SWITCH_GENERATOR ( MOLI13 , ON )
SWITCH_GENERATOR ( MOLI14 , ON )
SWITCH_GENERATOR ( MOLI15 , ON )
SWITCH_GENERATOR ( MOLI16 , ON )
SWITCH_GENERATOR ( MOLI17 , ON )
SWITCH_GENERATOR ( MOLI18 , ON )
SWITCH_GENERATOR ( MOLI19 , ON )
SWITCH_GENERATOR ( MOLI20 , ON )
SWITCH_GENERATOR ( MOLI21 , ON )
SWITCH_GENERATOR ( MOLI22 , ON )
SWITCH_GENERATOR ( MOLI23 , ON )
SWITCH_GENERATOR ( MOLI24 , ON )
SWITCH_GENERATOR ( GREN01 , ON )
SWITCH_GENERATOR ( GREN02 , ON )
SWITCH_GENERATOR ( GREN03 , ON )
SWITCH_GENERATOR ( GREN04 , ON )

SWITCH_GENERATOR ( ELECTRO , ON )

SWITCH_GENERATOR ( ZAP01 , ON )
SWITCH_GENERATOR ( ZAP02 , ON )

SWITCH_GENERATOR ( INSTANTBOMB , ON )

SWITCH_GENERATOR ( INVULV , ON )

SWITCH_GENERATOR ( DOUBLEDAMAGE_SE1 , ON )
SWITCH_GENERATOR ( DOUBLEDAMAGE_SE2 , ON )
SWITCH_GENERATOR ( DOUBLEDAMAGE_SE3 , ON )

SWITCH_GENERATOR ( DOUBLEDAMAGE_NE1 , ON )
SWITCH_GENERATOR ( DOUBLEDAMAGE_NE2 , ON )
SWITCH_GENERATOR ( DOUBLEDAMAGE_NE3 , ON )

SWITCH_GENERATOR ( DOUBLEDAMAGE_NW1 , ON )
SWITCH_GENERATOR ( DOUBLEDAMAGE_NW2 , ON )
SWITCH_GENERATOR ( DOUBLEDAMAGE_NW3 , ON )

SWITCH_GENERATOR ( DOUBLEDAMAGE_SW1 , ON )
SWITCH_GENERATOR ( DOUBLEDAMAGE_SW2 , ON )
SWITCH_GENERATOR ( DOUBLEDAMAGE_SW3 , ON )

SWITCH_GENERATOR ( ARMOR1 , ON )
SWITCH_GENERATOR ( ARMOR2 , ON )
SWITCH_GENERATOR ( ARMOR3 , ON )
SWITCH_GENERATOR ( ARMOR4 , ON )
//}

//{ //Playerchecks <% for(int i=1;i<=PlayerCount;i++){%>
IF (CHECK_CHARACTER_HEALTH (p<%=i%>,0))
	CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (einsgang, p<%=i%>, 5)
	CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (zweigang, p<%=i%>, 5)
	CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (dreigang, p<%=i%>, 5)
	CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (redngang, p<%=i%>, 5)
	CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (funfgang, p<%=i%>, 5)
	CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (sechgang, p<%=i%>, 5)
	CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (siebgang, p<%=i%>, 5)
	
	p<%=i%>_v =  CREATE_GANG_CAR (2.0, 2.0) -1 0 ICECREAM END //dummy car to prevent crash at start
ENDIF

<% } %> //}

SET firstrun=0
ENDIF

//{ // Player Checks <% for(int i=1;i<=PlayerCount;i++){%>
IF (CHECK_SCORE_GREATER (p<%=i%>,0))
	//#region player_loop
	//#endregion

	GIVE_WEAPON ( p<%=i%>, rocket_launcher , 99 )
	GIVE_WEAPON ( p<%=i%>, flame_thrower , 99 )

	
	IF ( LOCATE_CHARACTER_BY_CAR ( p<%=i%>, 127.5, 127.5, 1.0, 255.0, 255.0) ) //IF (HAS_CAR_JUST_SUNK (p<%=i%>_v))//NOT (IS_ITEM_ONSCREEN (p<%=i%>_v))
		IF (CHECK_CHARACTER_HEALTH (p<%=i%>_gunhelper,0))
			KILL_CHAR (p<%=i%>_gunhelper) //seems to be executed all the time but works to stop crashes
		ENDIF
	ENDIF
	//IF ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 84.5, 56.2, 1.0, 1.0, 0.1) )
	
	//{ // CARMODEL CHECK
	IF (IS_CHARACTER_IN_ANY_CAR  ( p<%=i%>  ) )
		IF (p<%=i%>_trg_ic=1)
			SET p<%=i%>_trg_ic=0
			SET p<%=i%>_exit_c=0
			IF (NOT(IS_CHARACTER_IN_CAR  (  p<%=i%>  ,  p<%=i%>_v  )))
				STORE_CAR_CHARACTER_IS_IN ( p<%=i%>  ,  p<%=i%>_v  )
				//#region entering_new_vehicle
				//#endregion

				IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  ISETTA ))
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (einsgang, p<%=i%>, 5)
					SET_CAR_FLAMEPROOF ( p<%=i%>_v, ON )
				ENDIF

				IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  MIURA ))
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (zweigang, p<%=i%>, 5)
					SET_CAR_ROCKETPROOF ( p<%=i%>_v, ON )
					//SET_CAR_BULLETPROOF ( p<%=i%>_v, ON ) //too strong
				ENDIF

				IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  VTYPE ))
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (dreigang, p<%=i%>, 5)
					p<%=i%>_turret = CREATE_CAR (1.0, 1.0, 1.0) 0 180 TANK MINI_CAR END
					PUT_CAR_ON_TRAILER  ( p<%=i%>_turret  ,  p<%=i%>_v )
					//not possible. game crashes if car wrecks and if you then get in a new car
					p<%=i%>_gunhelper = CREATE_CHAR_INSIDE_CAR ( p<%=i%>_turret ) 8 dummy END 
					ORDER_CHAR_TO_BACKDOOR (p<%=i%>_gunhelper, p<%=i%>_turret)
					p<%=i%>_gunman = CREATE_CHAR_INSIDE_CAR ( p<%=i%>_turret ) 8 tank_driver END
					//SET_CHAR_OBJECTIVE ( p<%=i%>_gunman , FIRE_AT_OBJECT_FROM_VEHICLE , itarget )
				ENDIF

				IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  PICKUP ))
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (redngang, p<%=i%>, 5)
					SET_CAR_BULLETPROOF ( p<%=i%>_v, ON )
				ENDIF
				
				IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  STRATOS ))
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (funfgang, p<%=i%>, 5)
				ENDIF
				
				IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  KRSNABUS ))
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (einsgang, p<%=i%>, 5)
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (zweigang, p<%=i%>, 5)
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (dreigang, p<%=i%>, 5)
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (redngang, p<%=i%>, 5)
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (funfgang, p<%=i%>, 5)
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (sechgang, p<%=i%>, 5)
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (siebgang, p<%=i%>, 5)
				ENDIF
				
				IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  BUICK ))
					CHANGE_GANG_CHAR_RESPECT_AND_UPDATE  (siebgang, p<%=i%>, 5)
				ENDIF
				
			ENDIF

			STORE_CAR_CHARACTER_IS_IN ( p<%=i%>  ,  p<%=i%>_v  )
			//#region entering_vehicle
			//#endregion

			IF (CHECK_CAR_MODEL (  p<%=i%>_v  ,  PICKUP ) )
				//DELAY_HERE(20)

				KILL_ALL_PASSENGERS  (  p<%=i%>_v  )
				DELETE_ITEM(p<%=i%>_gangbot1)
				DELETE_ITEM(p<%=i%>_gangbot2)
				DELETE_ITEM(p<%=i%>_gangbot3)
				DELETE_ITEM(p<%=i%>_gangbot4)
			ENDIF

		ENDIF
		DO_NOWT
	ELSE
		IF (p<%=i%>_trg_ic=0)
			//#region exiting_vehicle
			//#endregion

			IF (CHECK_CAR_MODEL (  p<%=i%>_v  ,  PICKUP ))
				p<%=i%>_gangbot1 = CREATE_CHAR_INSIDE_CAR ( p<%=i%>_v ) 5  PSYCHO END
				//SET_CHAR_THREAT_SEARCH ( p<%=i%>_gangbot1 , AREA_PLAYER_ONLY )
				ADD_GROUP_TO_CHARACTER ( p<%=i%>_gangbot1 , 0 )
				MAKE_NEW_LEADER_OF_GROUP ( p<%=i%>_gangbot1 , p<%=i%> )
				SET p<%=i%>_exit_c=1
			ENDIF

			IF (CHECK_CHARACTER_HEALTH (p<%=i%>_gunhelper,0))
				KILL_CHAR (p<%=i%>_gunhelper)
			ENDIF
			
			DO_NOWT

		ENDIF
		SET p<%=i%>_trg_ic=1
		SET p<%=i%>_incar = 0
	ENDIF

	IF ( p<%=i%>_exit_c = 2)
		p<%=i%>_gangbot2 = CREATE_CHAR_INSIDE_CAR ( p<%=i%>_v ) 6  PSYCHO END
		ADD_EXISTING_CHAR_TO_GROUP(p<%=i%>, p<%=i%>_gangbot2)
	ENDIF
	IF ( p<%=i%>_exit_c = 3)
		p<%=i%>_gangbot3 = CREATE_CHAR_INSIDE_CAR ( p<%=i%>_v ) 5  PSYCHO END
		ADD_EXISTING_CHAR_TO_GROUP(p<%=i%>, p<%=i%>_gangbot3)
	ENDIF
	IF ( p<%=i%>_exit_c = 4)
		p<%=i%>_gangbot4 = CREATE_CHAR_INSIDE_CAR ( p<%=i%>_v ) 6  PSYCHO END
		ADD_EXISTING_CHAR_TO_GROUP(p<%=i%>, p<%=i%>_gangbot4)
		GIVE_WEAPON (p<%=i%>_gangbot1, MACHINE_GUN )
		GIVE_WEAPON (p<%=i%>_gangbot2, SHOTGUN )
		GIVE_WEAPON (p<%=i%>_gangbot3, DUAL_PISTOL )
		GIVE_WEAPON (p<%=i%>_gangbot4, MOLOTOV ) //no weapon instead //have to because invincible puncher is too hardcore

		SET_CHAR_INVINCIBLE (p<%=i%>_gangbot1, ON)
		SET_CHAR_INVINCIBLE (p<%=i%>_gangbot2, ON)
		SET_CHAR_INVINCIBLE (p<%=i%>_gangbot3, ON)
		SET_CHAR_INVINCIBLE (p<%=i%>_gangbot4, ON)
		SET_CHAR_MAX_RUNSPEED  (  p<%=i%>_gangbot1  ,  0.04   )
		SET_CHAR_MAX_RUNSPEED  (  p<%=i%>_gangbot2  ,  0.04   )
		SET_CHAR_MAX_RUNSPEED  (  p<%=i%>_gangbot3  ,  0.04   )
		SET_CHAR_MAX_RUNSPEED  (  p<%=i%>_gangbot4  ,  0.04   )

	ENDIF
	IF ( p<%=i%>_exit_c > 0)
		++p<%=i%>_exit_c
	ENDIF

	IF (p<%=i%>_trg_ic=0)
		//#region while_in_vehicle
		//#endregion
		
		IF (NOT(CHECK_CAR_MODEL ( p<%=i%>_v  ,  ICECREAM )))
			GIVE_WEAPON ( p<%=i%>_v, car_machine_gun, 99 )
		ENDIF
		
		IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  KRSNABUS ))
			GIVE_WEAPON ( p<%=i%>_v, CAR_MINE , 99 )
			GIVE_WEAPON ( p<%=i%>_v, CAR_BOMB_INSTANT , 99 )
		ENDIF

		IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  BUICK ))
			GIVE_WEAPON ( p<%=i%>_v, CAR_BOMB , 99 )
		ENDIF

		IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  PICKUP ))
			GIVE_WEAPON ( p<%=i%>_v, CAR_OIL , 99 )
		ENDIF
		
		IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  VTYPE ))
			ALTER_WANTED_LEVEL(p<%=i%>, 0)
			//{ // Other Players <% for(int j=1;j<=PlayerCount;j++){ if(j!=i){ %>
			IF (CHECK_CHARACTER_HEALTH (p<%=j%>,0))
				ALTER_WANTED_LEVEL_NO_DROP (p<%=j%>, 4)
			ENDIF
			<% }} %> //}
		ENDIF
		
	ENDIF
	//}

	IF (IS_CHAR_PRESSING_HORN  ( p<%=i%> ) )
		IF (p<%=i%>_trg_ph=1)
			SET p<%=i%>_trg_ph=0
			//#region start_pressing_horn
			//#endregion

			IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  BUICK ))
				WARP_FROM_CAR_TO_POINT (p<%=i%>, 112.5, 106.5, 2.1, 0)
			ENDIF

			IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  VTYPE ))
				SET_CHAR_OBJECTIVE ( p<%=i%>_gunman , FIRE_AT_OBJECT_FROM_VEHICLE , itarget )
			ENDIF
			
			IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  MIURA ))
				IF (ambient=1)
					SET_AMBIENT_LEVEL  (0.1, 2)
					set ambient=0
				ELSE
					SET_AMBIENT_LEVEL  (1.0, 2)
					set ambient=1
				ENDIF
			ENDIF

		ENDIF
		DO_NOWT
	ELSE
		IF (p<%=i%>_trg_ph=0)
			//#region stop_pressing_horn
			//#endregion

			IF (CHECK_CAR_MODEL ( p<%=i%>_v  ,  VTYPE ))
				MAKE_CHAR_DO_NOTHING ( p<%=i%>_gunman )
				MAKE_CHAR_DO_NOTHING ( p<%=i%>_gunhelper )
			ENDIF

		ENDIF
		SET p<%=i%>_trg_ph=1
		SET p<%=i%>_phorn = 0
	ENDIF

	IF (p<%=i%>_trg_ph=0)
		//#region while_pressing_horn
		//#endregion

		DO_NOWT
	ENDIF

	
	//IF (CHECK_CHARACTER_HEALTH ( p<%=i%>_gunman , 0 ))
	//	IF (IS_CHAR_FIRING_ONSCREEN ( p<%=i%>_gunman ))
	//		MAKE_CHAR_DO_NOTHING ( p<%=i%>_gunman )
	//	ENDIF
	//ENDIF
	
    //Top left teleport tunnel
    IF ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 84.5, 56.2, 1.0, 1.0, 0.1) )
		teleportsnd = CREATE_SOUND (84.5, 56.2, 1.0) SCREAM PLAY_INSTANT END
		WARP_FROM_CAR_TO_POINT (p<%=i%>, 84.5, 156.1, 2.1, 180)
    ENDIF

    //Bottom left teleport tunnel
    IF ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 84.5, 156.8, 1.0, 1.0, 0.1) )
		teleportsnd = CREATE_SOUND (84.5, 156.8, 1.0) SCREAM PLAY_INSTANT END
		WARP_FROM_CAR_TO_POINT (p<%=i%>, 84.5, 56.8, 2.1, 0)
    ENDIF

    IF ( IS_CHAR_ON_FIRE ( p<%=i%> ) )
		IF ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 112.5, 144.5, 2.0, 1.0, 1.0 ))
			SET_CHAR_INVINCIBLE ( p<%=i%> ,  ON   )
		ENDIF
		IF ((( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 83.5 , 106.5, 2.0, 1.0, 1.0 )) OR ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 141.5 , 106.5, 2.0, 1.0, 1.0 )))
		OR (( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 112.5 , 67.5, 2.0, 1.0, 1.0 )) OR ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 112.5 , 106.5, 2.0, 1.0, 1.0 ))))
			SET_CHAR_INVINCIBLE ( p<%=i%> ,  ON   )
		ENDIF
    ELSE
		SET_CHAR_INVINCIBLE ( p<%=i%> ,OFF )
    ENDIF
ENDIF

<% } %> //}

//{ // cleanup
IF (mineoil_tmr > 0)
	SET mineoil_tmr = ( mineoil_tmr - 1)
ENDIF
IF (mineoil_tmr = 0)
	SET mineoil_tmr = (mineoil_max + 0)
	del_mine = CREATE_OBJ (1.0, 1.0, 1.0) 0 MINE END
	del_oil = CREATE_OBJ (1.0, 1.0, 1.0) 0 OIL END
ENDIF
//}


ENDWHILE

LEVELEND
