<%@ Template Language="C#" TargetLanguage="gta2mis" Description="Generates BC High Land." %>    	
<%@ 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" %>
<%@ Property Name="Base" Type="System.String" Default="any" Category="Options" Description="base file name without extension" %>
<%@ Property Name="Mode" Type="System.String" Default="any" Category="Options" Description="the game mode" %>

//{ //Header
// <%=Mapname%>
// script and map by <%=Author%>
// for details look at <%=Base%>_readme.txt 
// <%=Base%>.mis Compiled by <%=Author%> on <%= DateTime.Now.ToLongDateString() %> with codesmith

// addons:
//#region header
//#endregion 
//}

//{ //Declares
//{ //PlayerDefines
<% int p = 1; %>
<% if (PlayerCount>=1) { %>PLAYER_PED p<%=p++%> = (251.5, 85.0, 255.0) 5 60  <% } %>
<% if (PlayerCount>=2) { %>PLAYER_PED p<%=p++%> = (253.5, 86.0, 255.0) 7 240 <% } %>
<% if (PlayerCount>=3) { %>PLAYER_PED p<%=p++%> = (251.5, 86.0, 255.0) 8 120 <% } %>
<% if (PlayerCount>=4) { %>PLAYER_PED p<%=p++%> = (253.5, 85.0, 255.0) 11 300<% } %>
<% if (PlayerCount>=5) { %>PLAYER_PED p<%=p++%> = (252.5, 86.5, 255.0) 13 180<% } %>
<% if (PlayerCount>=6) { %>PLAYER_PED p<%=p++%> = (252.5, 84.5, 255.0) 10 0  <% } %>
//}

//{ //PlayerDeclares
<% for(int i=1;i<=PlayerCount;i++){%>
    //{ //Player<%=i%>
    //#region player_declare
	//#endregion
	
    //}

<% } %>
//}

//#region declare
//#endregion

//{ //Collectibles


//}

//{ //Towers
<% for(int i=0;i<=9;i+=3){%>
OBJ_DATA tower<%=i%>1 = (243.5, <%=80+i%>.5, 6.1) 0 TOWER
OBJ_DATA tower<%=i%>2 = (242.5, <%=81+i%>.5, 6.1) 0 TOWER
OBJ_DATA tower<%=i%>3 = (243.5, <%=81+i%>.5, 6.1) 0 TOWER
OBJ_DATA tower<%=i%>4 = (244.5, <%=81+i%>.5, 6.1) 0 TOWER
OBJ_DATA tower<%=i%>5 = (243.5, <%=82+i%>.5, 6.1) 0 TOWER

<% } %>
//}

COUNTER control = 1
COUNTER psum = 0
COUNTER dsum = 0
COUNTER osum = 0
COUNTER tsum = 0

ONSCREEN_COUNTER dummy_osc

COUNTER loop = 1
//}

LEVELSTART

//{ //Init
//#region init
//#endregion

//ADD_ONSCREEN_COUNTER  (   dummy_osc  ,  tsum )


//}

WHILE_EXEC ( loop = 1 )

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

	GIVE_WEAPON (  p<%=i%> , rocket_launcher, 99 )
	
	//{ //Controls ON/OFF
	IF (control=1)
		SET_ALL_CONTROLS_STATUS (p<%=i%>, ON)
	ENDIF
	IF (control=0)
		SET_ALL_CONTROLS_STATUS (p<%=i%>, OFF)
	ENDIF
	//}
	
	//{ //Death routines
	SET psum = (psum+1)
	IF(HAS_CHARACTER_DIED(p<%=i%>))
		SET dsum = (dsum+1)
	ENDIF
	IF <% if (Mode!="online"){%>(( (NOT ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 127.0, 127.0, 5.0, 256.0, 256.0) )) AND (NOT ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 127.0, 127.0, 6.0, 256.0, 256.0) )))AND <% } %>(NOT ( LOCATE_CHARACTER_ANY_MEANS ( p<%=i%>, 127.0, 127.0, 7.0, 256.0, 256.0) )) <% if (Mode!="online"){%>)<% } %>
		IF (CHECK_CHARACTER_HEALTH(p<%=i%>, 1))
			KILL_CHAR (p<%=i%>)
		ENDIF
		SET dsum = (dsum+1)
	ENDIF
	//}
ENDIF   

<% } %>
//}

//#region loop
//#endregion 

//{ //Player Freeze Control
SET tsum = (psum-dsum)
IF ((tsum>=2) OR (psum=1))
	SET control=1
ELSE
	SET control=1 //switched it off
ENDIF
SET psum=0
SET dsum=0
SET tsum=0
//}
	
ENDWHILE

LEVELEND