//Gouranga's Castle by Jones

PLAYER_PED p1 = (22.50, 23.50, 1.00) 10 0
PLAYER_PED p2 = (22.50, 24.50, 1.00) 9 0
PLAYER_PED p3 = (23.50, 24.50, 1.00) 8 0
PLAYER_PED p4 = (24.50, 24.50, 1.00) 7 0
PLAYER_PED p5 = (25.50, 24.50, 1.00) 6 0
PLAYER_PED p6 = (25.50, 23.50, 1.00) 1 0


COUNTER mainLoop=1

COUNTER current_player =1
COUNTER playerCount=1

COUNTER rand=0

COUNTER data=0

CHAR_DATA char

CHAR_DATA p

COUNTER p_data1=0

COUNTER p1_data1=0
COUNTER p2_data1=0
COUNTER p3_data1=0
COUNTER p4_data1=0
COUNTER p5_data1=0
COUNTER p6_data1=0

COUNTER p_data2=0

COUNTER p1_data2=0
COUNTER p2_data2=0
COUNTER p3_data2=0
COUNTER p4_data2=0
COUNTER p5_data2=0
COUNTER p6_data2=0


/* 0: p1 chooses next game 
   1: car rain
   2: King of the Hill
   3: Slap 'n Berry
   4: Football
   5: Revolt!
*/
COUNTER gameMode=0
 
MAP_ZONE goal1


GENERATOR health = ( 24.0, 23.6, 1.0) 0 COLLECT_30  1 1 -1

//------carRain------------
MAP_ZONE carRain = (1000,100,0,0,0,100,100,100,700,000, 450)

CONVEYOR carRain_conv1 = ( 60.00 , 22.5 ,1.00 ) ( 2.0 , 1.0 ) 0 2
CONVEYOR carRain_conv2 = ( 65.50 , 22.5 ,1.00 ) ( 1.0 , 1.0 ) 0 6
CONVEYOR carRain_conv3 = ( 73.00 , 21.5 ,1.00 ) ( 6.0 , 1.0 ) 0 8
CONVEYOR carRain_conv4 = ( 76.50 , 22.5 ,1.00 ) ( 1.0 , 1.0 ) -8 0
CONVEYOR carRain_conv5 = ( 74.50 , 25.0 ,1.00 ) ( 1.0 , 2.0 ) -8 0
CONVEYOR carRain_conv6 = ( 76.00 , 25.5 ,1.00 ) ( 2.0 , 1.0 ) 0 -8

// ------------  King of the Hill -----------------
COUNTER king=0

OBJ_DATA kingofHill_tower1  = (103.8, 24.8, 2.0) 0 TOWER
OBJ_DATA kingofHill_tower2  = (105.2, 24.8, 2.0) 0 TOWER
OBJ_DATA kingofHill_tower3  = (103.8, 26.2, 2.0) 0 TOWER
OBJ_DATA kingofHill_tower4  = (105.2, 26.2, 2.0) 0 TOWER


GENERATOR kingofHill_molov1 = (103.5, 23.5, 1.0) 0 COLLECT_04 100 400 5
GENERATOR kingofHill_molov2 = (105.5, 27.5, 1.0) 0 COLLECT_04 100 400 5

LIGHT kingLight = (104.5, 25.5, 2.0) 3.0 255 (0,0,0) 0 0 0

// ------------  Slap 'n Berry -----------------
CHAR_DATA berry1
CHAR_DATA berry2
CHAR_DATA berry3
CHAR_DATA berry4

CHAR_DATA berry1_slapper
CHAR_DATA berry2_slapper
CHAR_DATA berry3_slapper
CHAR_DATA berry4_slapper

// ------------  Football -----------------
OBJ_DATA footy
CHAR_DATA footMan1
CHAR_DATA footMan2

MAP_ZONE left
MAP_ZONE right
MAP_ZONE reset

COUNTER goals_team1=0
COUNTER goals_team2=0

OBJ_DATA resetBoolard  = (171.5, 20.9, 2.0) 0 BOLLARD
OBJ_DATA resetBoolard2  = (172.5, 20.9, 2.0) 0 BOLLARD//added by rick

CONVEYOR footRoll1 = ( 163.0, 27.0, 2.0 ) ( 2.0 , 2.0 ) -20 0
CONVEYOR footRoll2 = ( 181.0, 27.0, 2.0 ) ( 2.0 , 2.0 ) 20 0

// ------- Revolt! ------------
CAR_DATA fire1
CAR_DATA fire2
CAR_DATA fire3
CAR_DATA fire4
CAR_DATA fire5
CAR_DATA fire6

COUNTER wastedPlayers=0


ONSCREEN_COUNTER nagscreen
ONSCREEN_COUNTER screen1
ONSCREEN_COUNTER screen2

                                
FORWARD mission_timer:

THREAD_TRIGGER mission_trigger = THREAD_WAIT_FOR_CHAR_IN_AREA_ANY_MEANS(
                                p1, 22.50, 23.50, 1.00, 4.0,4.0, mission_timer:)

mission_timer:
     DELAY_HERE (60)
  ADD_ONSCREEN_COUNTER(nagscreen,gameMode)
  DELAY_HERE (60)
 CLEAR_ONSCREEN_COUNTER(nagscreen)
RETURN


LEVELSTART

DISPLAY_MESSAGE(1027)
DISPLAY_BRIEF(1028)

//determine player count
IF ( CHECK_CHARACTER_HEALTH ( p1 , 0 ))
     ++playerCount
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p2 , 0 ))
     ++playerCount
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p3 , 0 ))
     ++playerCount
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p4 , 0 ))
     ++playerCount
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p5 , 0 ))
     ++playerCount
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p6 , 0 ))
     ++playerCount
ENDIF


EXEC
     SET_AMBIENT_LEVEL (0.30, 20)
     
     SWITCH_GENERATOR (health, ON)
     
     SWITCH_GENERATOR (kingofHill_molov1, ON)
     SWITCH_GENERATOR (kingofHill_molov2, ON)
     
ENDEXEC



WHILE_EXEC(mainLoop=1)

     SET current_player=1
	WHILE_EXEC(current_player<playerCount)
          IF(current_player=1)
		     SET p=(p1+0)
               SET p_data1=(p1_data1+0)
               SET p_data2=(p1_data2+0)
		ENDIF
		IF(current_player=2)
	     	SET p=(p2+0)
               SET p_data1=(p2_data1+0)
               SET p_data2=(p2_data2+0)
		ENDIF
		IF(current_player=3)
			SET p=(p3+0)
               SET p_data1=(p3_data1+0)
               SET p_data2=(p3_data2+0)
		ENDIF
          IF(current_player=4)
			SET p=(p4+0)
               SET p_data1=(p4_data1+0)
               SET p_data2=(p4_data2+0)
		ENDIF
		IF(current_player=5)
			SET p=(p5+0)
               SET p_data1=(p5_data1+0)
               SET p_data2=(p5_data2+0)
		ENDIF
		IF(current_player=6)
			SET p=(p6+0)
               SET p_data1=(p6_data1+0)
               SET p_data2=(p6_data2+0)
		ENDIF
          
          
           IF(CHECK_CHARACTER_HEALTH(p,0))
           
               SET_CHAR_INVINCIBLE(p,OFF)
           
               //------No Game running---------
               IF(gameMode=0)
                    SET_CHAR_INVINCIBLE(p,ON)
               
                    IF(NOT(IS_CHAR_IN_ZONE(p,start)))
                         WARP_FROM_CAR_TO_POINT (p, 24.0, 23.6, 2.3, 0)
                         REMOVE_WEAPONS(p)
                         SET p_data1=0 	
                         SET p_data2=0 	
                         
                          IF(current_player=1)
                                   SET_CHAR_GRAPHIC_TYPE(p,GANG_GRAPHIC,10)
                              ENDIF
                              IF(current_player=2)
                                   SET_CHAR_GRAPHIC_TYPE(p,GANG_GRAPHIC,9)
                              ENDIF
                              IF(current_player=3)
                                   SET_CHAR_GRAPHIC_TYPE(p,GANG_GRAPHIC,8)
                              ENDIF
                              IF(current_player=4)
                                   SET_CHAR_GRAPHIC_TYPE(p,GANG_GRAPHIC,7)
                              ENDIF
                              IF(current_player=5)
                                   SET_CHAR_GRAPHIC_TYPE(p,GANG_GRAPHIC,6)
                              ENDIF
                              IF(current_player=6)
                                   SET_CHAR_GRAPHIC_TYPE(p,GANG_GRAPHIC,1)
                              ENDIF
                    ENDIF
               
               
                    IF(current_player=1)
                         //----- Car Rain ----------------
                          IF(LOCATE_CHARACTER_ON_FOOT ( p ,21.5, 20.5, 1.0 , 1.0, 1.0 ))
                               SET gameMode=1 
                               DISPLAY_BRIEF_SOON(1029)
                         ENDIF
                         //---------- King of the Hill -----------
                         IF(LOCATE_CHARACTER_ON_FOOT ( p ,22.5, 20.5, 1.0 , 1.0 , 1.0 ))
                               SET gameMode=2
                               DISPLAY_BRIEF_SOON(1030)
                               
                               ADD_ONSCREEN_COUNTER(screen1,data)
                         ENDIF
                         //---------- Slap n' Berry --------------
                         IF(LOCATE_CHARACTER_ON_FOOT ( p ,23.5, 20.5, 1.0 , 1.0, 1.0 ))
                               SET gameMode=3 
                               DISPLAY_BRIEF_SOON(1031)
                               
                               berry1= CREATE_CHAR (134.5, 23.5, 1.00) 22 0 NO_OCCUPATION END
                               SET_CHAR_THREAT_SEARCH(berry1,NO_THREATS)
				           SET_CHAR_THREAT_REACTION (berry1, NO_REACTION)
                               berry2= CREATE_CHAR (138.5, 23.5, 1.00) 22 0 NO_OCCUPATION END
                               SET_CHAR_THREAT_SEARCH(berry2,NO_THREATS)
				           SET_CHAR_THREAT_REACTION (berry2, NO_REACTION)
                               berry3= CREATE_CHAR (134.5, 27.5, 1.00) 22 0 NO_OCCUPATION END
                               SET_CHAR_THREAT_SEARCH(berry3,NO_THREATS)
				           SET_CHAR_THREAT_REACTION (berry3, NO_REACTION)
                               berry4= CREATE_CHAR (138.5, 27.5, 1.00) 22 0 NO_OCCUPATION END
                               SET_CHAR_THREAT_SEARCH(berry4,NO_THREATS)
				           SET_CHAR_THREAT_REACTION (berry4, NO_REACTION)
                               
                               
                         ENDIF
                         //----------- Football  -----------------
                          IF(LOCATE_CHARACTER_ON_FOOT ( p ,24.5, 20.5, 1.0 , 1.0, 1.0 ))
                               SET gameMode=4
                               DISPLAY_BRIEF_SOON(1032)
                               
                               footy = CREATE_OBJ (172.0, 27.0, 2.0) 0 FOOTY END
                               
                               
                               //footMan1= CREATE_CHAR (165.5, 27.0, 1.0) 44  0 NO_OCCUPATION END
                               footMan1= CREATE_CHAR (159.5, 27.0, 2.0) 44  0 NO_OCCUPATION END
                              GIVE_WEAPON(footMan1,MACHINE_GUN)
                               //footMan2= CREATE_CHAR (178.5, 27.0, 1.0) 44  0 NO_OCCUPATION END
                              footMan2= CREATE_CHAR (184.5, 27.0,2.0) 44  0 NO_OCCUPATION END
                              GIVE_WEAPON(footMan2,MACHINE_GUN)
                                 
                              ADD_ONSCREEN_COUNTER(screen1,goals_team1)  
                              ADD_ONSCREEN_COUNTER(screen2,goals_team2)   
                              
                          ENDIF
                         
                         // ---------- Revolt! ------------
                         
                         IF(LOCATE_CHARACTER_ON_FOOT ( p ,25.5, 20.5, 1.0 , 1.0, 1.0 ))
                               SET gameMode=5
                               DISPLAY_BRIEF_SOON(1033)
                               
                               SET wastedPlayers=1
                               
                               fire1 = CREATE_CAR (21.4, 46.6, 1.0) -1 180 FIRETRUK  END
                               fire2 = CREATE_CAR (25.4, 46.6, 1.0) -1 180 FIRETRUK  END
                               fire3 = CREATE_CAR (29.4, 46.6, 1.0) -1 180 FIRETRUK  END
                               fire4 = CREATE_CAR (33.4, 46.6, 1.0) -1 180 FIRETRUK  END
                               fire5 = CREATE_CAR (37.4, 46.6, 1.0) -1 180 FIRETRUK  END
                               fire6 = CREATE_CAR (41.4, 46.6, 1.0) -1 180 FIRETRUK  END
                               
                               SET p_data2=10
                               SET p1_data2=10
                               SET p2_data2=10
                               SET p3_data2=10
                               SET p4_data2=10
                               SET p5_data2=10
                               SET p6_data2=10
                          ENDIF
                         
                         
                    ENDIF
               
               ENDIF
               
               // ------------  Car Rain -----------------
               IF(gameMode=1)
                         IF(NOT(IS_CHAR_IN_ZONE(p,carRain)))
                              WARP_FROM_CAR_TO_POINT (p, 53.0, 24.0, 1.30, 90) 	
                         ENDIF
               
                         IF(IS_CHAR_IN_GANGZONE(p,goal1))
                              ADD_SCORE(p,100000)
                              
                              IF(current_player=1)
                                   DISPLAY_BRIEF(1091)
                              ENDIF
                               IF(current_player=2)
                                   DISPLAY_BRIEF(1092)
                              ENDIF
                               IF(current_player=3)
                                   DISPLAY_BRIEF(1093)
                              ENDIF
                               IF(current_player=4)
                                   DISPLAY_BRIEF(1094)
                              ENDIF
                               IF(current_player=5)
                                   DISPLAY_BRIEF(1095)
                              ENDIF
                               IF(current_player=6)
                                   DISPLAY_BRIEF(1096)
                              ENDIF
                         
                              SET gameMode=0
                         ENDIF
               
               ENDIF
               
               // ------------  King of the Hill -----------------
               IF(gameMode=2)
                     ++rand
                    IF(rand=4)
                     SET rand=0
                    ENDIF
                    
                    IF(NOT(IS_CHAR_IN_ZONE(p,kingofHill)))
                         IF(rand=0)
                          WARP_FROM_CAR_TO_POINT (p, 100.5, 21.5, 1.30, 90) 
                         ENDIF
                         IF(rand=1)
                          WARP_FROM_CAR_TO_POINT (p, 108.5, 21.5, 1.30, 270) 
                         ENDIF
                         IF(rand=2)
                          WARP_FROM_CAR_TO_POINT (p, 100.5, 29.5, 1.30, 90) 
                         ENDIF
                         IF(rand=3)
                          WARP_FROM_CAR_TO_POINT (p, 108.5, 29.5, 1.30, 270) 
                         ENDIF
                         
                         GIVE_WEAPON(p,ROCKET_LAUNCHER ,5)
                          	
                    ENDIF
                    
                    IF((p=king)OR(king=0))
                         SET king=0
                         SET data=0
                         CHANGE_COLOUR (kingLight, 0,0,0)
                         IF(LOCATE_CHARACTER_ON_FOOT ( p ,104.5, 25.5, 2.0 , 1.0 ,1.0))
                              IF(current_player=1)
                                   CHANGE_COLOUR (kingLight, 255,0,0)
                              ENDIF
                              IF(current_player=2)
                                   CHANGE_COLOUR (kingLight, 255,127,39)
                              ENDIF
                              IF(current_player=3)
                                   CHANGE_COLOUR (kingLight, 100,100,100)
                              ENDIF
                              IF(current_player=4)
                                   CHANGE_COLOUR (kingLight, 255,255,0)
                              ENDIF
                              IF(current_player=5)
                                   CHANGE_COLOUR (kingLight, 0,0,255)
                              ENDIF
                              IF(current_player=6)
                                   CHANGE_COLOUR (kingLight, 0,255,0)
                              ENDIF
                              SET king=(p+0)
                              ++p_data1
                              SET data= (p_data1+0)
                              IF(p_data1=1200)
                                    ADD_SCORE(p,100000)
                                    IF(current_player=1)
                                        DISPLAY_BRIEF(1091)
                                   ENDIF
                                   IF(current_player=2)
                                        DISPLAY_BRIEF(1092)
                                   ENDIF
                                   IF(current_player=3)
                                    DISPLAY_BRIEF(1093)
                                   ENDIF
                                   IF(current_player=4)
                                        DISPLAY_BRIEF(1094)
                                   ENDIF
                                   IF(current_player=5)
                                        DISPLAY_BRIEF(1095)
                                   ENDIF
                                   IF(current_player=6)
                                        DISPLAY_BRIEF(1096)
                                   ENDIF
                                   
                                   CLEAR_ONSCREEN_COUNTER(screen1)
                                   SET gameMode=0
                                   SET king=0
                              ENDIF
                         ENDIF
                    ENDIF
               
               ENDIF
           
               // ------------  Slap 'n Berry -----------------
               IF(gameMode=3)
                     ++rand
                    IF(rand=4)
                     SET rand=0
                    ENDIF
                    
                    IF(NOT(IS_CHAR_IN_ZONE(p,slapnBerry)))
                         IF(rand=0)
                          WARP_FROM_CAR_TO_POINT (p, 132.5, 21.5, 1.30, 90) 
                         ENDIF
                         IF(rand=1)
                          WARP_FROM_CAR_TO_POINT (p, 140.5, 21.5, 1.30, 270) 
                         ENDIF
                         IF(rand=2)
                          WARP_FROM_CAR_TO_POINT (p, 132.5, 29.5, 1.30, 90) 
                         ENDIF
                         IF(rand=3)
                          WARP_FROM_CAR_TO_POINT (p, 140.5, 29.5, 1.30, 270) 
                         ENDIF
                   ENDIF
                   
                   
                   IF(HAS_CHAR_PUNCHED_SOMEONE(p))
                         STORE_LAST_CHAR_PUNCHED(p,char)
                         
                         IF(char=berry1)
                              SET berry1_slapper=(p+0)
                              SET_CHAR_OBJECTIVE(berry1, GOTO_CHAR_ON_FOOT, p)
                         ENDIF
                         IF(char=berry2)
                              SET berry2_slapper=(p+0)
						SET_CHAR_OBJECTIVE(berry2, GOTO_CHAR_ON_FOOT, p)
                         ENDIF
                        IF(char=berry3)
                              SET berry3_slapper=(p+0)
                              SET_CHAR_OBJECTIVE(berry3, GOTO_CHAR_ON_FOOT, p)
                         ENDIF
                         IF(char=berry4)
                              SET berry4_slapper=(p+0)
                              SET_CHAR_OBJECTIVE(berry4, GOTO_CHAR_ON_FOOT, p)
                         ENDIF
                   ENDIF
                   
                   IF(IS_CHAR_OBJECTIVE_PASSED(berry1))
                         SET_CHAR_OBJECTIVE(berry1, GOTO_CHAR_ON_FOOT, berry1_slapper)
                   ENDIF
                   IF(IS_CHAR_OBJECTIVE_PASSED(berry2))
                         SET_CHAR_OBJECTIVE(berry2, GOTO_CHAR_ON_FOOT, berry2_slapper)
                   ENDIF
                   IF(IS_CHAR_OBJECTIVE_PASSED(berry3))
                         SET_CHAR_OBJECTIVE(berry3, GOTO_CHAR_ON_FOOT, berry3_slapper)
                   ENDIF
                   IF(IS_CHAR_OBJECTIVE_PASSED(berry4))
                         SET_CHAR_OBJECTIVE(berry4, GOTO_CHAR_ON_FOOT, berry4_slapper)
                   ENDIF
                   
                   IF(berry1_slapper>0)
                   IF( berry1_slapper=berry2_slapper)
                         IF( berry1_slapper=berry3_slapper)
                              IF( berry1_slapper=berry4_slapper)
                                   IF(LOCATE_CHARACTER_ON_FOOT ( p ,136.5, 25.5, 1.0 , 1.0, 1.0 ))
                                        DELETE_ITEM(berry1)
                                        DELETE_ITEM(berry2)
                                        DELETE_ITEM(berry3)
                                        DELETE_ITEM(berry4)
                                   
                                        ADD_SCORE(p,100000)
                                        
                                         IF(current_player=1)
                                             DISPLAY_BRIEF(1091)
                                        ENDIF
                                         IF(current_player=2)
                                         DISPLAY_BRIEF(1092)
                                         ENDIF
                                        IF(current_player=3)
                                             DISPLAY_BRIEF(1093)
                                        ENDIF
                                        IF(current_player=4)
                                          DISPLAY_BRIEF(1094)
                                         ENDIF
                                         IF(current_player=5)
                                              DISPLAY_BRIEF(1095)
                                             ENDIF
                                        IF(current_player=6)
                                         DISPLAY_BRIEF(1096)
                                         ENDIF
                                   
                                        SET berry1_slapper =0
                                        SET berry2_slapper =0
                                        SET berry3_slapper =0
                                        SET berry4_slapper =0
                                   
                                        SET gameMode=0
                                   ENDIF
                              ENDIF
                         ENDIF
                   ENDIF
                   ENDIF
                   
               ENDIF
               
               // ------------ Football -----------------
               
               IF(gameMode=4)
                    IF( NOT(IS_CHAR_IN_ZONE(p,footBall)) )
                        SET p_data1=1
                    ENDIF
                    
                    IF(IS_CHAR_IN_GANGZONE(p,left))
                   //IF(LOCATE_CHARACTER_ANY_MEANS ( p , 162.5, 27.0, 2.0 , 0.6 , 2.0 ))
                        WARP_FROM_CAR_TO_POINT (p, 164.5, 27.0, 2.3, 90)
                    ENDIF
                    IF(IS_CHAR_IN_GANGZONE(p,right))
                   //IF(LOCATE_CHARACTER_ANY_MEANS ( p , 181.5, 27.0, 2.0 , 0.6 , 2.0 ))
                        WARP_FROM_CAR_TO_POINT (p, 179.5, 27.0, 2.3, 270)
                    ENDIF
                  
                    
                    IF(current_player=1)
                         IF(IS_CHAR_IN_GANGZONE(p,reset))
                              MAKE_CHAR_DO_NOTHING(footMan1)
                              REMOVE_WEAPONS (footMan1)
                              MAKE_CHAR_DO_NOTHING(footMan2)
                              REMOVE_WEAPONS (footMan2)
                              DELETE_ITEM(footy)
                              footy = CREATE_OBJ (172.0, 27.0, 2.0) 0 FOOTY END
                              SET p_data1=1
                              SET p1_data1=1
                              SET p2_data1=1
                              SET p3_data1=1
                              SET p4_data1=1
                              SET p5_data1=1
                              SET p6_data1=1
                              DISPLAY_MESSAGE(1101)
                              GIVE_WEAPON(footMan1,MACHINE_GUN)   
                              GIVE_WEAPON(footMan2,MACHINE_GUN)  
                         ENDIF
                    ENDIF
                   
                    
                     SET_CHAR_OBJECTIVE ( footMan1,DESTROY_OBJECT, footy)
                    //IF(IS_CHAR_FIRING_IN_AREA(footMan1,165.5,27.0,1.0,4.0,4.0))
                    IF(IS_CHAR_FIRING_IN_AREA(footMan1,159.5,27.0,2.0,4.0,4.0))
                         ++goals_team2
                         MAKE_CHAR_DO_NOTHING(footMan1)
                         REMOVE_WEAPONS (footMan1)
                         DELETE_ITEM(footy)
                         footy = CREATE_OBJ (172.0, 27.0, 2.0) 0 FOOTY END
                         SET p_data1=1
                         SET p1_data1=1
                         SET p2_data1=1
                         SET p3_data1=1
                         SET p4_data1=1
                         SET p5_data1=1
                         SET p6_data1=1
                         DISPLAY_MESSAGE(1100)
                         GIVE_WEAPON(footMan1,MACHINE_GUN)
                    ENDIF
                    SET_CHAR_OBJECTIVE ( footMan2,DESTROY_OBJECT, footy)
                   // IF(IS_CHAR_FIRING_IN_AREA(footMan2,178.5,27.0,1.0,4.0,4.0))
                   IF(IS_CHAR_FIRING_IN_AREA(footMan2, 184.5, 27.0,2.0,4.0,4.0))
                  
                         ++goals_team1
                         MAKE_CHAR_DO_NOTHING(footMan2)
                         REMOVE_WEAPONS (footMan2)
                         DELETE_ITEM(footy)
                         footy = CREATE_OBJ (172.0, 27.0, 2.0) 0 FOOTY END
                         SET p_data1=1
                         SET p1_data1=1
                         SET p2_data1=1
                         SET p3_data1=1
                         SET p4_data1=1
                         SET p5_data1=1
                         SET p6_data1=1
                         DISPLAY_MESSAGE(1099)
                         GIVE_WEAPON(footMan2,MACHINE_GUN)
                    ENDIF 
                    
                    
                    
                    IF(p_data1=1)
                         IF(current_player=1)
                              WARP_FROM_CAR_TO_POINT (p, 165.5, 27.0, 2.3, 90)
                              SET_CHAR_GRAPHIC_TYPE(p,DUMMY_GRAPHIC,33) 
                         ENDIF
                         IF(current_player=2)
                              WARP_FROM_CAR_TO_POINT (p, 178.5, 27.0, 2.30, 270)
                              SET_CHAR_GRAPHIC_TYPE(p,DUMMY_GRAPHIC,32) 	
                         ENDIF
                         IF(current_player=3)
                              WARP_FROM_CAR_TO_POINT (p, 167.5, 26.0, 2.3, 90)
                              SET_CHAR_GRAPHIC_TYPE(p,DUMMY_GRAPHIC,33) 
                         ENDIF
                         IF(current_player=4)
                              WARP_FROM_CAR_TO_POINT (p, 176.5, 28.0, 2.30, 270)
                              SET_CHAR_GRAPHIC_TYPE(p,DUMMY_GRAPHIC,32) 	
                         ENDIF
                         IF(current_player=5)
                             WARP_FROM_CAR_TO_POINT (p, 167.5, 28.0, 2.3, 90)
                              SET_CHAR_GRAPHIC_TYPE(p,DUMMY_GRAPHIC,33) 
                         ENDIF
                         IF(current_player=6)
                              WARP_FROM_CAR_TO_POINT (p, 176.5, 26.0, 2.30, 270)
                              SET_CHAR_GRAPHIC_TYPE(p,DUMMY_GRAPHIC,32) 	
                         ENDIF
                         SET p_data1=0
                    ENDIF
                    
                    IF((goals_team1=4)OR(goals_team2=4))
                         IF(goals_team1=4)
                              ADD_SCORE(p1,100000)
                              ADD_SCORE(p3,100000)
                              ADD_SCORE(p5,100000)
                              
                              DISPLAY_BRIEF(1097)
                         ENDIF
                         IF(goals_team2=4)
                              ADD_SCORE(p2,100000)
                              ADD_SCORE(p4,100000)
                              ADD_SCORE(p6,100000)
                              
                              DISPLAY_BRIEF(1098)
                         ENDIF
                    
                         SET gameMode=0
                         SET goals_team1=0
                         SET goals_team2=0
                         
                         DELETE_ITEM(footy)
                         DELETE_ITEM(footMan1)
                         DELETE_ITEM(footMan2)
                         
                         CLEAR_ONSCREEN_COUNTER(screen1)
                         CLEAR_ONSCREEN_COUNTER(screen2)
                    ENDIF
               ENDIF
           
               //-----  Revolt! ------------------
               
               IF(gameMode=5)
                     ++rand
                    IF(rand=4)
                     SET rand=0
                    ENDIF
                    
                    IF(NOT(IS_CHAR_IN_ZONE(p,revolt)))
                         IF(current_player=1)
                          WARP_FROM_CAR_TO_POINT (p, 20.8, 46.1, 1.30, 180) 
                         ENDIF	
                         IF(current_player=2)
                          WARP_FROM_CAR_TO_POINT (p, 24.8, 46.1, 1.30, 180) 
                         ENDIF
                         IF(current_player=3)
                          WARP_FROM_CAR_TO_POINT (p, 28.8, 46.1, 1.30, 180) 
                         ENDIF
                         IF(current_player=4)
                          WARP_FROM_CAR_TO_POINT (p, 32.8, 46.1, 1.30, 180) 
                         ENDIF
                         IF(current_player=5)
                          WARP_FROM_CAR_TO_POINT (p, 36.8, 46.1, 1.30, 180) 
                         ENDIF
                         IF(current_player=6)
                          WARP_FROM_CAR_TO_POINT (p, 40.8, 46.1, 1.30, 180) 
                         ENDIF
                    ENDIF
                    
                    IF(p_data2>0)
                         IF(wastedPlayers=playerCount)
                              ADD_SCORE(p,100000)
                              
                               IF(current_player=1)
                                   DISPLAY_BRIEF(1091)
                              ENDIF
                               IF(current_player=2)
                                   DISPLAY_BRIEF(1092)
                              ENDIF
                               IF(current_player=3)
                                   DISPLAY_BRIEF(1093)
                              ENDIF
                               IF(current_player=4)
                                   DISPLAY_BRIEF(1094)
                              ENDIF
                               IF(current_player=5)
                                   DISPLAY_BRIEF(1095)
                              ENDIF
                               IF(current_player=6)
                                   DISPLAY_BRIEF(1096)
                              ENDIF
                              
                              DELETE_ITEM(p1_data1)
                              DELETE_ITEM(p2_data1)
                              DELETE_ITEM(p3_data1)
                              DELETE_ITEM(p4_data1)
                              DELETE_ITEM(p5_data1)
                              DELETE_ITEM(p6_data1)
                              
                              DELETE_ITEM(fire1)
                              DELETE_ITEM(fire2)
                              DELETE_ITEM(fire3)
                              DELETE_ITEM(fire4)
                              DELETE_ITEM(fire5)
                              DELETE_ITEM(fire6)
                              
                              SET gameMode=0
                         ENDIF
               
                    IF(p_data1=0)
                         IF(current_player=1)
                              IF(rand=0)
                                   p_data1=CREATE_CHAR (20.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,22.5, 49.5, 1.0)
                              ENDIF
                             IF(rand=1)
                                   p_data1=CREATE_CHAR (21.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,23.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=2)
                                   p_data1=CREATE_CHAR (22.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,21.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=3)
                                   p_data1=CREATE_CHAR (23.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,20.5, 49.5, 1.0)
                              ENDIF
                              
                              IF(IS_CAR_WRECKED(fire1))
                                   DELETE_ITEM(fire1)
                                   fire1 = CREATE_CAR (21.4, 46.6, 1.0) -1 180 FIRETRUK END
                              ENDIF
                         ENDIF
                         IF(current_player=2)
                              IF(rand=0)
                                   p_data1=CREATE_CHAR (24.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,26.5, 49.5, 1.0)
                              ENDIF
                             IF(rand=1)
                                   p_data1=CREATE_CHAR (25.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,27.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=2)
                                   p_data1=CREATE_CHAR (26.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,25.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=3)
                                   p_data1=CREATE_CHAR (27.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,24.5, 49.5, 1.0)
                              ENDIF
                              
                              IF(IS_CAR_WRECKED(fire2))
                                   DELETE_ITEM(fire2)
                                   fire2 = CREATE_CAR (25.4, 46.6, 1.0) -1 180 FIRETRUK END
                              ENDIF
                         ENDIF
                         IF(current_player=3)
                              IF(rand=0)
                                   p_data1=CREATE_CHAR (28.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,30.5, 49.5, 1.0)
                              ENDIF
                             IF(rand=1)
                                   p_data1=CREATE_CHAR (29.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,31.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=2)
                                   p_data1=CREATE_CHAR (30.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,29.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=3)
                                   p_data1=CREATE_CHAR (31.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,28.5, 49.5, 1.0)
                              ENDIF
                              
                              IF(IS_CAR_WRECKED(fire3))
                                   DELETE_ITEM(fire3)
                                   fire3 = CREATE_CAR (29.4, 46.6, 1.0) -1 180 FIRETRUK END
                              ENDIF
                         ENDIF
                         IF(current_player=4)
                              IF(rand=0)
                                   p_data1=CREATE_CHAR (32.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,34.5, 49.5, 1.0)
                              ENDIF
                             IF(rand=1)
                                   p_data1=CREATE_CHAR (33.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,35.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=2)
                                   p_data1=CREATE_CHAR (34.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,33.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=3)
                                   p_data1=CREATE_CHAR (35.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,32.5, 49.5, 1.0)
                              ENDIF
                              
                              IF(IS_CAR_WRECKED(fire4))
                                   DELETE_ITEM(fire4)
                                   fire4 = CREATE_CAR (33.4, 46.6, 1.0) -1 180 FIRETRUK END
                              ENDIF
                         ENDIF
                         IF(current_player=5)
                              IF(rand=0)
                                   p_data1=CREATE_CHAR (36.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,38.5, 49.5, 1.0)
                              ENDIF
                             IF(rand=1)
                                   p_data1=CREATE_CHAR (37.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,39.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=2)
                                   p_data1=CREATE_CHAR (38.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,37.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=3)
                                   p_data1=CREATE_CHAR (39.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,36.5, 49.5, 1.0)
                              ENDIF
                              
                              IF(IS_CAR_WRECKED(fire5))
                                   DELETE_ITEM(fire5)
                                   fire5 = CREATE_CAR (37.4, 46.6, 1.0) -1 180 FIRETRUK END
                              ENDIF
                         ENDIF
                         IF(current_player=6)
                              IF(rand=0)
                                   p_data1=CREATE_CHAR (40.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,42.5, 49.5, 1.0)
                              ENDIF
                             IF(rand=1)
                                   p_data1=CREATE_CHAR (41.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,43.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=2)
                                   p_data1=CREATE_CHAR (42.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,41.5, 49.5, 1.0)
                              ENDIF
                              IF(rand=3)
                                   p_data1=CREATE_CHAR (43.5, 43.5, 1.3) 44  0 NO_OCCUPATION END
                                   SET_CHAR_OBJECTIVE(p_data1,GOTO_AREA_ON_FOOT,40.5, 49.5, 1.0)
                              ENDIF
                              
                              IF(IS_CAR_WRECKED(fire6))
                                   DELETE_ITEM(fire6)
                                   fire6 = CREATE_CAR (41.4, 46.6, 1.0) -1 180 FIRETRUK END
                              ENDIF
                         ENDIF
                         
                         SET_CHAR_THREAT_SEARCH(p_data1,NO_THREATS)
	                    SET_CHAR_THREAT_REACTION (p_data1, NO_REACTION)
                         
                         
                    ENDIF
                    
                    IF(NOT(p_data1=0))
                    IF(IS_CHAR_OBJECTIVE_PASSED(p_data1))
                         SET char=(p_data1+0)
                         DELETE_ITEM(char)
                         SET p_data1=0
                         --p_data2
                    ENDIF
                    ENDIF
                    
                    IF(NOT(p_data1=0))
                    IF(HAS_CHARACTER_DIED(p_data1))
                         SET p_data1=0
                    ENDIF
                    ENDIF
                    
                    ENDIF
                    
                    
                    IF(p_data2=0)
                         ++wastedPlayers
                    ENDIF
                    
               
               
               ENDIF
               
               
     
          ENDIF
          
          IF(current_player=1)
		     SET p1_data1=(p_data1+0)
		     SET p1_data2=(p_data2+0)
          ENDIF
          IF(current_player=2)
		    SET  p2_data1=(p_data1+0)
		     SET p2_data2=(p_data2+0)
          ENDIF
          IF(current_player=3)
		    SET  p3_data1=(p_data1+0)
		     SET p3_data2=(p_data2+0)
          ENDIF
          IF(current_player=4)
		     SET p4_data1=(p_data1+0)
		     SET p4_data2=(p_data2+0)
          ENDIF
          IF(current_player=5)
		     SET p5_data1=(p_data1+0)
		     SET p5_data2=(p_data2+0)
          ENDIF
          IF(current_player=6)
		     SET p6_data1=(p_data1+0)
		     SET p6_data2=(p_data2+0)
          ENDIF
				
          
     
          ++current_player
     ENDWHILE
     
     
ENDWHILE




LEVELEND
