Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Проехал на красный - получи звезду 3 (клео-скрипт для гта са)
- {$CLEO}
- var
- 17@ : Integer
- 18@ : Integer
- 6@ : Integer
- 8@ : Integer
- 29@ : Integer
- 30@ : Integer
- 25@ : Integer
- end
- const
- Player_WAS_in_front_of_red_traffic_light = 17@
- Traffic_light_type = 18@ // 1 or 2
- Type_of_red_traffic_light = 6@ // 0,1,2,3 0 - both not red 3 - both red
- Player_IS_in_front_of_red_traffic_light = 8@
- Traffic_light_model = 25@
- end
- 19@ = 30000.0
- 20@ = 30000.0
- //----------------------------------------------------------------------------------------------------
- while true
- wait 0
- if
- player.Defined($PLAYER_CHAR)
- then
- if and
- actor.Driving($PLAYER_ACTOR)
- 84A7: not actor $PLAYER_ACTOR driving_boat
- 84C8: not actor $PLAYER_ACTOR driving_flying_vehicle
- $ONMISSION == 0
- then
- if or
- 89AE: not actor $PLAYER_ACTOR driving_train
- actor.DrivingVehicleType($PLAYER_ACTOR, #TRAM)
- then
- 03C0: 28@ = actor $PLAYER_ACTOR car
- if
- 8ABD: not vehicle 28@ siren_on
- then
- 046C: 28@ = car 28@ driver
- if
- 803C: $PLAYER_ACTOR <> 28@ // (int)
- then
- 23@ = 0
- continue
- end
- //--------------------------------------------------------------------------Определяем ближайший светофор
- actor.StorePos($PLAYER_ACTOR 0@ 1@ 2@)
- 0509: 14@ = distance_between_XY 0@ 1@ and_XY 19@ 20@
- gosub @GET_RANDOM_OBJECT
- if
- 11@ == 1
- then
- 23@ = 0
- 0085: Traffic_light_model = 31@ // (int)
- 0087: 19@ = 12@ // (float)
- 0087: 20@ = 13@ // (float)
- 0087: 27@ = 26@ // (float)
- 27@ += 1.0
- 0509: 14@ = distance_between_XY 0@ 1@ and_XY 19@ 20@
- 0176: 24@ = object 9@ Z_angle
- 02F6: 10@ = cosine 24@ // (float) синус
- 02F7: 22@ = sine 24@ // (float) косинус
- 0073: 10@ /= 22@ // (float) тангенс
- //----------------------------------Определяем тип светофора
- if and
- 24@ >= 60.0
- 24@ <= 150.0
- then
- Traffic_light_type = 2
- else
- if and
- 24@ >= 240.0
- 24@ <= 330.0
- then
- Traffic_light_type = 2
- else
- Traffic_light_type = 1
- end
- end
- end
- //-----------------------------------------------------------------Производим проверки от незаслуженных звезд
- actor.StorePos($player_actor 0@ 1@ 2@)
- if and
- 14@ < 20.0 // если ближайший светофор достаточно близко
- 06BD: no_obstacles_between 0@ 1@ 2@ and 19@ 20@ 27@ solid 1 car 0 actor 0 object 0 particle 0
- // и нет препятствий между светофором и игроком
- then // иначе интереса светофор не представляют
- else
- 23@ = 0
- continue
- end
- //------------------------Определяем позицию игрока относительно светофора
- 0087: 22@ = 0@ // (float)
- 0063: 22@ -= 19@ // (float)
- 006B: 22@ *= 10@ // (float)
- 005B: 22@ += 20@ // (float)
- if or
- 24@ < 90.0
- 24@ > 270.0
- then
- if
- 0025: 22@ > 1@ // (float) Y_act < tg_Z_tl*(X_act-X_tl)+Y_tl
- then
- Player_IS_in_front_of_red_traffic_light = True
- else
- Player_IS_in_front_of_red_traffic_light = False
- end
- else
- if
- 24@ == 90.0
- then
- if
- 0025: 0@ > 19@ // (float) X_act > X_tl
- then
- Player_IS_in_front_of_red_traffic_light = True
- else
- Player_IS_in_front_of_red_traffic_light = False
- end
- else
- if
- 24@ == 270.0
- then
- if
- 0025: 19@ > 0@ // (float) X_act < X_tl
- then
- Player_IS_in_front_of_red_traffic_light = True
- else
- Player_IS_in_front_of_red_traffic_light = False
- end
- else // Z > 90 AND Z < 270
- if
- 0025: 1@ > 22@ // (float) Y_act > tg_Z_tl*(X_act-X_tl)+Y_tl
- then
- Player_IS_in_front_of_red_traffic_light = True
- else
- Player_IS_in_front_of_red_traffic_light = False
- end
- end
- end
- end
- //------------------------------------------------------------------------
- if
- 23@ == 0
- then
- if or // Список светофоров, запрещённых к пересечению только спереди (при красном сигнале)
- Traffic_light_model == 3855
- Traffic_light_model == 1315
- Traffic_light_model == 1352
- Traffic_light_model == 1350
- Traffic_light_model == 1351
- Traffic_light_model == 3516
- then
- if
- Player_IS_in_front_of_red_traffic_light == True
- then
- 23@ = 1
- end
- else
- if or // Список светофоров, запрещённых к пересечению и спереди, и сзади
- Traffic_light_model == 1283
- Traffic_light_model == 1284
- then
- 23@ = 1
- end
- end
- else
- if
- 23@ == 2
- then
- if
- Player_IS_in_front_of_red_traffic_light <> Player_WAS_in_front_of_red_traffic_light
- then
- 23@ = 3
- end
- end
- end
- Player_WAS_in_front_of_red_traffic_light = Player_IS_in_front_of_red_traffic_light
- //---------------------------Определяем текущие цвета светофоров типов 1 и 2
- 0AA7: call_function 0x49D3A0 num_params 0 pop 0 29@ // Направление 2 (запад-восток)
- 0AA7: call_function 0x49D350 num_params 0 pop 0 30@ // Направление 1 (север-юг)
- for 16@ = 8 to 31
- 08C3: clear 29@ bit 16@
- 08C3: clear 30@ bit 16@
- end // значения функций: 0 - зелёный, 1 - желтый, 2 - красный
- if
- 30@ == 2
- then
- if
- 29@ == 2
- then
- Type_of_red_traffic_light = 3 // both are red
- else
- Type_of_red_traffic_light = 1
- end
- else
- if
- 29@ == 2
- then
- Type_of_red_traffic_light = 2
- else
- Type_of_red_traffic_light = 0
- end
- end
- //--------------------------------------------------------------------------
- if or
- Type_of_red_traffic_light == 3
- Type_of_red_traffic_light == Traffic_light_type
- then
- if
- 23@ == 1
- then
- 23@ = 2
- else
- if
- 23@ == 3
- then
- if
- player.Defined($PLAYER_CHAR)
- then
- if
- 810F: not player $PLAYER_CHAR wanted_level > 0
- then
- gosub @CHECK_ANY_COP_NEAR_PLAYER
- if
- 11@ == 1
- then
- 010D: set_player $PLAYER_CHAR wanted_level_to 1
- end
- end
- end
- 23@ = 0
- end
- end
- else
- 23@ = 0
- end // type == type
- else
- 23@ = 0
- end // siren on
- else
- 23@ = 0
- end
- else
- 23@ = 0
- end
- else
- 23@ = 0
- end // player defined
- end // while main
- //-----------------------------------------------------------------------------------------
- :GET_RANDOM_OBJECT
- 0A8D: 7@ = read_memory 0xB7449C size 4 virtual_protect 0
- 000A: 7@ += 0x4
- 0A8D: 7@ = read_memory 7@ size 4 virtual_protect 0
- for 5@ = 0 to 89344 step 0x100
- 0A8D: 9@ = read_memory 7@ size 1 virtual_protect 0
- 000A: 7@ += 0x1
- if and
- 0029: 9@ >= 0x00
- 001B: 0x80 > 9@
- then
- 005A: 9@ += 5@ // (int)
- if and
- 03CA: (check) object 9@ exists
- 04E6: object 9@ near_point 0@ 1@ 2@ radius 20.0 20.0 20.0 flag 0
- then
- 0984: 31@ = object 9@ model
- if and
- 31@ <> 3855 // GAY_TRAFFIC_LIGHT +
- 31@ <> 1315 // TRAFFICLIGHT1 +
- 31@ <> 1352 // CJ_TRAFFIC_LIGHT3 +
- 31@ <> 1350 // CJ_TRAFFIC_LIGHT4 +
- 31@ <> 1351 // CJ_TRAFFIC_LIGHT5 +
- 31@ <> 3516 // VGSSTRIPTLIGHTS1 +
- 31@ <> 1283 // MTRAFFIC1 +
- then
- if
- 31@ <> 1284 // MTRAFFIC2 +
- then
- 31@ = 0
- end
- end
- if
- 31@ <> 0
- then
- object.StorePos(9@ 12@ 13@ 26@)
- 0509: 14@ = distance_between_XY 0@ 1@ and_XY 19@ 20@
- 0509: 3@ = distance_between_XY 0@ 1@ and_XY 12@ 13@
- if
- 0025: 14@ > 3@ // (float)
- then
- 11@ = 1
- return
- end
- end
- 11@ = 0
- end
- end
- end
- return
- :CHECK_ANY_COP_NEAR_PLAYER
- 0A8D: 4@ = read_memory 0xB74490 size 4 virtual_protect 0
- 000A: 4@ += 0x4
- 0A8D: 4@ = read_memory 4@ size 4 virtual_protect 0
- for 15@ = 0 to 35584 step 0x100
- 0A8D: 21@ = read_memory 4@ size 1 virtual_protect 0
- 000A: 4@ += 0x1
- if and
- 0029: 21@ >= 0x00
- 001B: 0x80 > 21@
- then
- 005A: 21@ += 15@ // (int)
- if
- 056D: (check) actor 21@ defined
- then
- 089F: get_actor 21@ pedtype_to 16@
- if and
- 16@ == 6
- 00FE: actor 21@ sphere 0 in_sphere 0@ 1@ 2@ radius 25.0 25.0 25.0
- 0364: actor 21@ spotted_actor $PLAYER_ACTOR
- then
- 11@ = 1
- return
- end
- end
- end
- end
- 11@ = 0
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement