// Created by Razor & Heri 
// gtatwo.fora.pl          
// relased: 12.06.2009     
PLAYER_PED p1 = (110.5, 145.5, 4.0) 10 180 //redteam 
PLAYER_PED p2 = (111.5, 144.5, 3.0) 10 180 //        
PLAYER_PED p3 = (109.5, 124.5, 3.0) 13 0   //blueteam
PLAYER_PED p4 = (111.5, 124.5, 3.0) 13 0   //        

COUNTER loop = 1
COUNTER ptk = 666

COUNTER p1tank_p2drive = 0 
COUNTER p2tank_p1drive = 0 
COUNTER p3tank_p4drive = 0 
COUNTER p4tank_p3drive = 0 
COUNTER wrak_red_enabled = 0 
COUNTER wrak_blue_enabled = 0
COUNTER redpunkty = 31 
COUNTER bluepunkty = 31
COUNTER redepuktyzabezpieczenie = 1
COUNTER bluepuktyzabezpieczenie = 1
COUNTER ptkilosc = 10
COUNTER blueteam_on = 0
COUNTER redteam_on = 0
COUNTER remove_blocks = 1

ONSCREEN_COUNTER redteamcounter
ONSCREEN_COUNTER blueteamcounter
ONSCREEN_COUNTER zero

COUNTER zabepieczenie_przed_wyjebaniem1 = 0
COUNTER zabepieczenie_przed_wyjebaniem2 = 0

CAR_DATA bluetrun_bus
CAR_DATA redtrun_bus

CAR_DATA redtank
CAR_DATA bluetank
CAR_DATA redgta1
CAR_DATA bluegta1

CAR_DATA redtanks
CAR_DATA bluetanks
CAR_DATA redgta1s
CAR_DATA bluegta1s



CHAR_DATA charbus1
CHAR_DATA charbus2

OBJ_DATA remote1 = ( 109.5  , 142.5 , 3.0 ) 180      REMOTE
OBJ_DATA remote2 = ( 111.5  , 142.5 , 3.0 ) 180      REMOTE
OBJ_DATA remote3 = ( 109.5  , 126.5 , 3.0 ) 180      REMOTE
OBJ_DATA remote4 = ( 111.5  , 126.5 , 3.0 ) 180      REMOTE

enable_team_red:
SET redteam_on = 0
DELAY_HERE (30)
SET p1tank_p2drive = 0
SET p2tank_p1drive = 0
RETURN  

enable_team_blue:
SET blueteam_on = 0
DELAY_HERE (30)
SET p3tank_p4drive = 0
SET p4tank_p3drive = 0
RETURN  

remote_red1:
SET p1tank_p2drive = 2
DELAY_HERE (5)
TAKE_REMOTE_CONTROL_OF_CAR (p1, redgta1)
TAKE_REMOTE_CONTROL_OF_CAR (p2, redtank)
RETURN 

remote_red2:
SET p2tank_p1drive = 2
DELAY_HERE (5)
TAKE_REMOTE_CONTROL_OF_CAR (p1, redtank)
TAKE_REMOTE_CONTROL_OF_CAR (p2, redgta1)
RETURN

remote_blue1:
SET p3tank_p4drive = 2
SET zabepieczenie_przed_wyjebaniem1 = 0
DELAY_HERE (5)
TAKE_REMOTE_CONTROL_OF_CAR (p3, bluegta1)
TAKE_REMOTE_CONTROL_OF_CAR (p4, bluetank)
RETURN

remote_blue2:
SET p4tank_p3drive = 2
SET zabepieczenie_przed_wyjebaniem2 = 0
DELAY_HERE (5)
TAKE_REMOTE_CONTROL_OF_CAR (p3, bluetank)
TAKE_REMOTE_CONTROL_OF_CAR (p4, bluegta1)
RETURN

LEVELSTART 



ADD_ONSCREEN_COUNTER  ( zero , ptk )
ADD_ONSCREEN_COUNTER  ( redteamcounter , redpunkty )
ADD_ONSCREEN_COUNTER  ( blueteamcounter , bluepunkty )

  

redgta1s = CREATE_CAR ( 108.5 , 142.5 , 4.0 ) 28 180 GT24640 MINI_CAR END
redtanks = CREATE_CAR ( 112.5 , 142.5 , 4.0 ) 2 180 TANK MINI_CAR END
bluegta1s = CREATE_CAR ( 108.5 , 126.5 , 4.0 ) 14 0 GT24640 MINI_CAR END
bluetanks = CREATE_CAR ( 112.5 , 126.5 , 4.0 ) 2 180 TANK MINI_CAR END

WHILE (loop = 1)


IF (p1tank_p2drive = 0) 
IF ( CHECK_CHARACTER_HEALTH ( p2, 0 ) )
IF (( LOCATE_CHARACTER_ANY_MEANS ( p1 ,  109.5 , 142.5 , 3.0 , 1.0 , 1.0 )) 
AND ( LOCATE_CHARACTER_ANY_MEANS ( p2 ,  111.5 , 142.5 , 3.0 , 1.0 , 1.0 ) ) )
      
       SET p1tank_p2drive = 1
ENDIF
ENDIF
ENDIF
//
IF (p2tank_p1drive = 0) 
IF ( CHECK_CHARACTER_HEALTH ( p2, 0 ) )
IF ( ( LOCATE_CHARACTER_ANY_MEANS ( p2 ,  109.5 , 142.5 , 3.0 , 1.0 , 1.0 ) ) 
AND ( LOCATE_CHARACTER_ANY_MEANS ( p1 ,  111.5 , 142.5 , 3.0 , 1.0 , 1.0 ) ) )
      
       SET p2tank_p1drive = 1
ENDIF
ENDIF
ENDIF
//
IF (p3tank_p4drive = 0)
IF ( ( CHECK_CHARACTER_HEALTH ( p3, 0 ) ) AND ( CHECK_CHARACTER_HEALTH ( p4 , 0 ) ) )
IF ( ( LOCATE_CHARACTER_ANY_MEANS ( p3 ,  109.5 , 126.5 , 3.0 , 1.0 , 1.0 ) ) 
AND ( LOCATE_CHARACTER_ANY_MEANS ( p4 ,  111.5 , 126.5 , 3.0 , 1.0 , 1.0 ) ) )
    
       SET zabepieczenie_przed_wyjebaniem1 = 2
       SET p3tank_p4drive = 1
ENDIF
ENDIF
ENDIF
//
IF (p4tank_p3drive = 0)  
IF ( ( CHECK_CHARACTER_HEALTH ( p3, 0 ) ) AND ( CHECK_CHARACTER_HEALTH ( p4 , 0 ) ) )
IF ( ( LOCATE_CHARACTER_ANY_MEANS ( p4 ,  109.5 , 126.5 , 3.0 , 1.0 , 1.0 ) ) 
AND ( LOCATE_CHARACTER_ANY_MEANS ( p3 ,  111.5 , 126.5 , 3.0 , 1.0 , 1.0 ) ) )
    
       SET zabepieczenie_przed_wyjebaniem2 = 2
       SET p4tank_p3drive = 1
ENDIF
ENDIF
ENDIF

// RED TEAM // P1 TANK ////// P2 GTA1
IF (p1tank_p2drive = 1)       
         redgta1 = CREATE_CAR ( 110.5 , 140.5 , 3.0 ) 28 180 GT24640 END
         redtank = CREATE_CAR ( 136.5 , 148.5 , 2.0 ) 2 180 TANK MINI_CAR END

         GIVE_WEAPON (redtank, TANK_GUN, 99)
         PUT_CAR_ON_TRAILER (redtank ,redgta1 )
         SET wrak_red_enabled = 1
         GOSUB remote_red1:
ENDIF
// RED TEAM // P1 GTA1 ////// P2 TANK
IF (p2tank_p1drive = 1)      
         redgta1 = CREATE_CAR ( 110.5 , 140.5 , 3.0 ) 28 180 GT24640 END 
         redtank = CREATE_CAR ( 136.5 , 148.5 , 2.0 ) 2 180 TANK MINI_CAR END   
 
         GIVE_WEAPON (redtank, TANK_GUN, 99)           
         PUT_CAR_ON_TRAILER (redtank ,redgta1 )
         SET wrak_red_enabled = 1              
         GOSUB remote_red2:
ENDIF
// BLUE TEAM // P3 TANK ////// P4 GTA1
IF (p3tank_p4drive = 1) 
   IF (zabepieczenie_przed_wyjebaniem1 = 2)
         bluegta1 = CREATE_CAR ( 110.5 , 128.5 , 3.0 ) 14 0 GT24640 END
         bluetank = CREATE_CAR ( 137.5 , 147.5 , 2.0 ) 2 180 TANK MINI_CAR END

         GIVE_WEAPON (bluetank, TANK_GUN, 99)
         PUT_CAR_ON_TRAILER (bluetank ,bluegta1 )
         SET wrak_blue_enabled = 1
         GOSUB remote_blue1:
   ENDIF     
ENDIF
// BLUE TEAM // P3 GTA1 ////// P4 TANK
IF (p4tank_p3drive = 1)
   IF (zabepieczenie_przed_wyjebaniem2 = 2)
         bluegta1 = CREATE_CAR ( 110.5 , 128.5 , 3.0 ) 14 0 GT24640 END
         bluetank = CREATE_CAR ( 137.5 , 147.5 , 2.0 ) 2 180 TANK MINI_CAR END

         GIVE_WEAPON (bluetank, TANK_GUN, 99)
         PUT_CAR_ON_TRAILER (bluetank ,bluegta1 )
         SET wrak_blue_enabled = 1
         GOSUB remote_blue2:
   ENDIF      
ENDIF

// Wrecks respawns
IF (wrak_red_enabled = 1 )
IF ( IS_CAR_WRECKED (redgta1))
   SET redepuktyzabezpieczenie = 1
      redtrun_bus = CREATE_CAR ( 73.0 , 137.0 , 5.0 ) 3 90 BUS END
      PUT_CAR_ON_TRAILER (redgta1, redtrun_bus)
      charbus1 = CREATE_CHAR_INSIDE_CAR ( redtrun_bus ) 13 criminal END
      SET_CHAR_DRIVE_AGGRESSION ( charbus1 , on )
      SET redteam_on = 1
      SET wrak_red_enabled = 2      
ENDIF
ENDIF

IF (redteam_on = 1)
GOSUB enable_team_red:
ENDIF

IF ((wrak_red_enabled = 2 )
AND (IS_CAR_IN_BLOCK( redtrun_bus , 75.0 ,137.0 ,3.5 , 5.0 , 5.0 )))
   KILL_CHAR (charbus1)
ENDIF


IF (wrak_blue_enabled = 1 )
   IF ( IS_CAR_WRECKED (bluegta1))
   SET bluepuktyzabezpieczenie = 1
      bluetrun_bus = CREATE_CAR ( 73.0 , 141.0 , 5.0 ) 2 90 BUS END   
      PUT_CAR_ON_TRAILER (bluegta1, bluetrun_bus)
      charbus2 = CREATE_CHAR_INSIDE_CAR ( bluetrun_bus ) 13 criminal END
      SET_CHAR_DRIVE_AGGRESSION ( charbus2 , on )
      SET blueteam_on = 1
      SET wrak_blue_enabled = 2      
   ENDIF
ENDIF

IF (blueteam_on = 1)
GOSUB enable_team_blue:
ENDIF

IF ((wrak_blue_enabled = 2 )
AND (IS_CAR_IN_BLOCK( bluetrun_bus , 75.0 ,141.0 ,3.5 , 5.0 , 5.0 )))
KILL_CHAR (charbus2)
ENDIF

IF (redepuktyzabezpieczenie = 1)
--redpunkty
DELAY_HERE ( 5 )
SET redepuktyzabezpieczenie = 0
ENDIF

IF (bluepuktyzabezpieczenie = 1)
--bluepunkty
DELAY_HERE ( 5 )
SET bluepuktyzabezpieczenie = 0
ENDIF

IF (redpunkty < 100)
IF ( LOCATE_CHARACTER_ANY_MEANS ( p1 ,  109.5, 145.5, 4.0, 1.0, 1.0 ))
++redpunkty
++redpunkty
++redpunkty
++redpunkty
++redpunkty
++redpunkty
++redpunkty
++redpunkty
++redpunkty
++redpunkty
++bluepunkty
++bluepunkty
++bluepunkty
++bluepunkty
++bluepunkty
++bluepunkty
++bluepunkty
++bluepunkty
++bluepunkty
++bluepunkty
ENDIF
ENDIF

IF (redpunkty > 11)
IF ( LOCATE_CHARACTER_ANY_MEANS ( p1 ,  111.5, 145.5, 4.0, 1.0, 1.0 ))
--redpunkty
--redpunkty
--redpunkty
--redpunkty
--redpunkty
--redpunkty
--redpunkty
--redpunkty
--redpunkty
--redpunkty
--bluepunkty
--bluepunkty
--bluepunkty
--bluepunkty
--bluepunkty
--bluepunkty
--bluepunkty
--bluepunkty
--bluepunkty
--bluepunkty
ENDIF
ENDIF

IF (redpunkty = 0)
ADD_SCORE (p3, 10000000)
ADD_SCORE (p4, 10000000)
ENDIF

IF (bluepunkty = 0)
ADD_SCORE (p1, 10000000)
ADD_SCORE (p2, 10000000)
ENDIF

IF (remove_blocks = 1)
IF (NOT( LOCATE_CHARACTER_ANY_MEANS ( p1 ,  110.5, 145.5, 4.0, 3.0, 1.0 )))
REMOVE_BLOCK (110,143,3,DONT_DROP)
REMOVE_BLOCK (110,125,3,DONT_DROP)
SET remove_blocks = 0
ENDIF
ENDIF

SET_CHAR_INVINCIBLE (p1,on)
IF ( CHECK_CHARACTER_HEALTH ( p2, 0 ) )
SET_CHAR_INVINCIBLE (p2,on)
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p3, 0 ) )
SET_CHAR_INVINCIBLE (p3,on)
ENDIF
IF ( CHECK_CHARACTER_HEALTH ( p3, 0 ) )
SET_CHAR_INVINCIBLE (p4,on)
ENDIF

CLEAR_ONSCREEN_COUNTER (zero)

ENDWHILE

LEVELEND

