Advertisement
Guest User

Star for red

a guest
May 28th, 2011
102
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Проехал на красный - получи звезду 3 (клео-скрипт для гта са)
  2. {$CLEO}
  3. var
  4. 17@ : Integer
  5. 18@ : Integer
  6. 6@ : Integer
  7. 8@ : Integer
  8. 29@ : Integer
  9. 30@ : Integer
  10. 25@ : Integer
  11. end
  12. const
  13. Player_WAS_in_front_of_red_traffic_light = 17@
  14. Traffic_light_type = 18@ // 1 or 2
  15. Type_of_red_traffic_light = 6@ // 0,1,2,3 0 - both not red 3 - both red
  16. Player_IS_in_front_of_red_traffic_light = 8@
  17. Traffic_light_model = 25@
  18. end
  19. 19@ = 30000.0
  20. 20@ = 30000.0
  21. //----------------------------------------------------------------------------------------------------
  22. while true
  23. wait 0
  24. if
  25. player.Defined($PLAYER_CHAR)
  26. then
  27. if and
  28. actor.Driving($PLAYER_ACTOR)
  29. 84A7: not actor $PLAYER_ACTOR driving_boat
  30. 84C8: not actor $PLAYER_ACTOR driving_flying_vehicle
  31. $ONMISSION == 0
  32. then
  33. if or
  34. 89AE: not actor $PLAYER_ACTOR driving_train
  35. actor.DrivingVehicleType($PLAYER_ACTOR, #TRAM)
  36. then
  37. 03C0: 28@ = actor $PLAYER_ACTOR car
  38. if
  39. 8ABD: not vehicle 28@ siren_on
  40. then
  41. 046C: 28@ = car 28@ driver
  42. if
  43. 803C: $PLAYER_ACTOR <> 28@ // (int)
  44. then
  45. 23@ = 0
  46. continue
  47. end
  48. //--------------------------------------------------------------------------Определяем ближайший светофор
  49. actor.StorePos($PLAYER_ACTOR 0@ 1@ 2@)
  50. 0509: 14@ = distance_between_XY 0@ 1@ and_XY 19@ 20@
  51. gosub @GET_RANDOM_OBJECT
  52. if
  53. 11@ == 1
  54. then
  55. 23@ = 0
  56. 0085: Traffic_light_model = 31@ // (int)
  57. 0087: 19@ = 12@ // (float)
  58. 0087: 20@ = 13@ // (float)
  59. 0087: 27@ = 26@ // (float)
  60. 27@ += 1.0
  61. 0509: 14@ = distance_between_XY 0@ 1@ and_XY 19@ 20@
  62. 0176: 24@ = object 9@ Z_angle
  63. 02F6: 10@ = cosine 24@ // (float) синус
  64. 02F7: 22@ = sine 24@ // (float) косинус
  65. 0073: 10@ /= 22@ // (float) тангенс
  66. //----------------------------------Определяем тип светофора
  67. if and
  68. 24@ >= 60.0
  69. 24@ <= 150.0
  70. then
  71. Traffic_light_type = 2
  72. else
  73. if and
  74. 24@ >= 240.0
  75. 24@ <= 330.0
  76. then
  77. Traffic_light_type = 2
  78. else
  79. Traffic_light_type = 1
  80. end
  81. end
  82. end
  83. //-----------------------------------------------------------------Производим проверки от незаслуженных звезд
  84. actor.StorePos($player_actor 0@ 1@ 2@)
  85. if and
  86. 14@ < 20.0 // если ближайший светофор достаточно близко
  87. 06BD: no_obstacles_between 0@ 1@ 2@ and 19@ 20@ 27@ solid 1 car 0 actor 0 object 0 particle 0
  88. // и нет препятствий между светофором и игроком
  89. then // иначе интереса светофор не представляют
  90. else
  91. 23@ = 0
  92. continue
  93. end
  94. //------------------------Определяем позицию игрока относительно светофора
  95. 0087: 22@ = 0@ // (float)
  96. 0063: 22@ -= 19@ // (float)
  97. 006B: 22@ *= 10@ // (float)
  98. 005B: 22@ += 20@ // (float)
  99. if or
  100. 24@ < 90.0
  101. 24@ > 270.0
  102. then
  103. if
  104. 0025: 22@ > 1@ // (float) Y_act < tg_Z_tl*(X_act-X_tl)+Y_tl
  105. then
  106. Player_IS_in_front_of_red_traffic_light = True
  107. else
  108. Player_IS_in_front_of_red_traffic_light = False
  109. end
  110. else
  111. if
  112. 24@ == 90.0
  113. then
  114. if
  115. 0025: 0@ > 19@ // (float) X_act > X_tl
  116. then
  117. Player_IS_in_front_of_red_traffic_light = True
  118. else
  119. Player_IS_in_front_of_red_traffic_light = False
  120. end
  121. else
  122. if
  123. 24@ == 270.0
  124. then
  125. if
  126. 0025: 19@ > 0@ // (float) X_act < X_tl
  127. then
  128. Player_IS_in_front_of_red_traffic_light = True
  129. else
  130. Player_IS_in_front_of_red_traffic_light = False
  131. end
  132. else // Z > 90 AND Z < 270
  133. if
  134. 0025: 1@ > 22@ // (float) Y_act > tg_Z_tl*(X_act-X_tl)+Y_tl
  135. then
  136. Player_IS_in_front_of_red_traffic_light = True
  137. else
  138. Player_IS_in_front_of_red_traffic_light = False
  139. end
  140. end
  141. end
  142. end
  143. //------------------------------------------------------------------------
  144. if
  145. 23@ == 0
  146. then
  147. if or // Список светофоров, запрещённых к пересечению только спереди (при красном сигнале)
  148. Traffic_light_model == 3855
  149. Traffic_light_model == 1315
  150. Traffic_light_model == 1352
  151. Traffic_light_model == 1350
  152. Traffic_light_model == 1351
  153. Traffic_light_model == 3516
  154. then
  155. if
  156. Player_IS_in_front_of_red_traffic_light == True
  157. then
  158. 23@ = 1
  159. end
  160. else
  161. if or // Список светофоров, запрещённых к пересечению и спереди, и сзади
  162. Traffic_light_model == 1283
  163. Traffic_light_model == 1284
  164. then
  165. 23@ = 1
  166. end
  167. end
  168. else
  169. if
  170. 23@ == 2
  171. then
  172. if
  173. Player_IS_in_front_of_red_traffic_light <> Player_WAS_in_front_of_red_traffic_light
  174. then
  175. 23@ = 3
  176. end
  177. end
  178. end
  179. Player_WAS_in_front_of_red_traffic_light = Player_IS_in_front_of_red_traffic_light
  180. //---------------------------Определяем текущие цвета светофоров типов 1 и 2
  181. 0AA7: call_function 0x49D3A0 num_params 0 pop 0 29@ // Направление 2 (запад-восток)
  182. 0AA7: call_function 0x49D350 num_params 0 pop 0 30@ // Направление 1 (север-юг)
  183. for 16@ = 8 to 31
  184. 08C3: clear 29@ bit 16@
  185. 08C3: clear 30@ bit 16@
  186. end // значения функций: 0 - зелёный, 1 - желтый, 2 - красный
  187. if
  188. 30@ == 2
  189. then
  190. if
  191. 29@ == 2
  192. then
  193. Type_of_red_traffic_light = 3 // both are red
  194. else
  195. Type_of_red_traffic_light = 1
  196. end
  197. else
  198. if
  199. 29@ == 2
  200. then
  201. Type_of_red_traffic_light = 2
  202. else
  203. Type_of_red_traffic_light = 0
  204. end
  205. end
  206. //--------------------------------------------------------------------------
  207. if or
  208. Type_of_red_traffic_light == 3
  209. Type_of_red_traffic_light == Traffic_light_type
  210. then
  211. if
  212. 23@ == 1
  213. then
  214. 23@ = 2
  215. else
  216. if
  217. 23@ == 3
  218. then
  219. if
  220. player.Defined($PLAYER_CHAR)
  221. then
  222. if
  223. 810F: not player $PLAYER_CHAR wanted_level > 0
  224. then
  225. gosub @CHECK_ANY_COP_NEAR_PLAYER
  226. if
  227. 11@ == 1
  228. then
  229. 010D: set_player $PLAYER_CHAR wanted_level_to 1
  230. end
  231. end
  232. end
  233. 23@ = 0
  234. end
  235. end
  236. else
  237. 23@ = 0
  238. end // type == type
  239. else
  240. 23@ = 0
  241. end // siren on
  242. else
  243. 23@ = 0
  244. end
  245. else
  246. 23@ = 0
  247. end
  248. else
  249. 23@ = 0
  250. end // player defined
  251. end // while main
  252. //-----------------------------------------------------------------------------------------
  253.  
  254. :GET_RANDOM_OBJECT
  255. 0A8D: 7@ = read_memory 0xB7449C size 4 virtual_protect 0
  256. 000A: 7@ += 0x4
  257. 0A8D: 7@ = read_memory 7@ size 4 virtual_protect 0
  258. for 5@ = 0 to 89344 step 0x100
  259. 0A8D: 9@ = read_memory 7@ size 1 virtual_protect 0
  260. 000A: 7@ += 0x1
  261. if and
  262. 0029: 9@ >= 0x00
  263. 001B: 0x80 > 9@
  264. then
  265. 005A: 9@ += 5@ // (int)
  266. if and
  267. 03CA: (check) object 9@ exists
  268. 04E6: object 9@ near_point 0@ 1@ 2@ radius 20.0 20.0 20.0 flag 0
  269. then
  270. 0984: 31@ = object 9@ model
  271. if and
  272. 31@ <> 3855 // GAY_TRAFFIC_LIGHT +
  273. 31@ <> 1315 // TRAFFICLIGHT1 +
  274. 31@ <> 1352 // CJ_TRAFFIC_LIGHT3 +
  275. 31@ <> 1350 // CJ_TRAFFIC_LIGHT4 +
  276. 31@ <> 1351 // CJ_TRAFFIC_LIGHT5 +
  277. 31@ <> 3516 // VGSSTRIPTLIGHTS1 +
  278. 31@ <> 1283 // MTRAFFIC1 +
  279. then
  280. if
  281. 31@ <> 1284 // MTRAFFIC2 +
  282. then
  283. 31@ = 0
  284. end
  285. end
  286. if
  287. 31@ <> 0
  288. then
  289. object.StorePos(9@ 12@ 13@ 26@)
  290. 0509: 14@ = distance_between_XY 0@ 1@ and_XY 19@ 20@
  291. 0509: 3@ = distance_between_XY 0@ 1@ and_XY 12@ 13@
  292. if
  293. 0025: 14@ > 3@ // (float)
  294. then
  295. 11@ = 1
  296. return
  297. end
  298. end
  299. 11@ = 0
  300. end
  301. end
  302. end
  303. return
  304.  
  305. :CHECK_ANY_COP_NEAR_PLAYER
  306. 0A8D: 4@ = read_memory 0xB74490 size 4 virtual_protect 0
  307. 000A: 4@ += 0x4
  308. 0A8D: 4@ = read_memory 4@ size 4 virtual_protect 0
  309. for 15@ = 0 to 35584 step 0x100
  310. 0A8D: 21@ = read_memory 4@ size 1 virtual_protect 0
  311. 000A: 4@ += 0x1
  312. if and
  313. 0029: 21@ >= 0x00
  314. 001B: 0x80 > 21@
  315. then
  316. 005A: 21@ += 15@ // (int)
  317. if
  318. 056D: (check) actor 21@ defined
  319. then
  320. 089F: get_actor 21@ pedtype_to 16@
  321. if and
  322. 16@ == 6
  323. 00FE: actor 21@ sphere 0 in_sphere 0@ 1@ 2@ radius 25.0 25.0 25.0
  324. 0364: actor 21@ spotted_actor $PLAYER_ACTOR
  325. then
  326. 11@ = 1
  327. return
  328. end
  329. end
  330. end
  331. end
  332. 11@ = 0
  333. return
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement