michalmonday

shootingIndicator (samp 0.3z)

Aug 6th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.18 KB | None | 0 0
  1. {$CLEO .cs}
  2. 0000: NOP
  3. repeat
  4. wait 50
  5. until 0AFA: is_samp_structures_available
  6. 0AF8: samp add_message_to_chat "shootingIndicator is {00CC00}Enabled {F7F694}[Switch: /sitog]" color 0xF7F694
  7. 0B34: samp register_client_command "sitog" to_label @sitog
  8. 0AC8: 10@ = allocate_memory_size 260
  9. 0AC8: 9@ = allocate_memory_size 260
  10. 0AC8: 8@ = allocate_memory_size 260
  11. 0AC8: 7@ = allocate_memory_size 260
  12. 0AC8: 6@ = allocate_memory_size 260
  13. 0AC8: 5@ = allocate_memory_size 260
  14. 0AC8: 4@ = allocate_memory_size 260
  15. 0AC8: 3@ = allocate_memory_size 260
  16. 0390: load_txd_dictionary 'wpn'
  17. 038F: load_texture "upr" as 1 //ak
  18. 038F: load_texture "upl" as 2
  19. 038F: load_texture "up" as 3
  20. 038F: load_texture "triang" as 4
  21. 038F: load_texture "square" as 5
  22. 038F: load_texture "right" as 6
  23. 038F: load_texture "left" as 7
  24. 038F: load_texture "downr" as 8
  25. 038F: load_texture "downl" as 9
  26. 038F: load_texture "down" as 10
  27. 038F: load_texture "cross" as 11
  28. 038F: load_texture "cring" as 12
  29. 038F: load_texture "circle" as 13
  30. 038F: load_texture "chit" as 14
  31. 13@ = 0
  32. 27@ = 1
  33. 33@ = 0
  34.  
  35. :First
  36. wait 0
  37. //variables for colors: 11@ 12@ 21@ 22@ 23@ 24@ 25@ 26@
  38. //switcher 27@
  39. //free 31@
  40. // 28@ = spam indicator
  41. if 27@ == 1
  42. jf @First
  43.  
  44. if 0029: 13@ >= 1
  45. then
  46. 0B5A: get_screen_resolution 14@ 15@ //int
  47. 14@ /= 10
  48. 14@ *= 8
  49. 15@ /= 10
  50. 15@ *= 7
  51. if 28@ == 1
  52. then
  53. 28@ = 0
  54. 0AB1: call_scm_func @DrawText 7 shooterName 3@ victimName 4@ posX 14@ posY 15@ weaponImage 17@ shooterColor 0xF21C00 victimColor 0xF21C00
  55. else
  56. 0AB1: call_scm_func @DrawText 7 shooterName 3@ victimName 4@ posX 14@ posY 15@ weaponImage 17@ shooterColor 11@ victimColor 12@
  57. end
  58. 15@ += 27
  59. end
  60.  
  61. if 0029: 13@ >= 2
  62. then
  63. if 28@ == 2
  64. then
  65. 28@ = 0
  66. 0AB1: call_scm_func @DrawText 7 shooterName 5@ victimName 6@ posX 14@ posY 15@ weaponImage 18@ shooterColor 0xF21C00 victimColor 0xF21C00
  67. else
  68. 0AB1: call_scm_func @DrawText 7 shooterName 5@ victimName 6@ posX 14@ posY 15@ weaponImage 18@ shooterColor 21@ victimColor 22@
  69. end
  70. 15@ += 27
  71. end
  72.  
  73. if 0029: 13@ >= 3
  74. then
  75. if 28@ == 3
  76. then
  77. 28@ = 0
  78. 0AB1: call_scm_func @DrawText 7 shooterName 7@ victimName 8@ posX 14@ posY 15@ weaponImage 19@ shooterColor 0xF21C00 victimColor 0xF21C00
  79. else
  80. 0AB1: call_scm_func @DrawText 7 shooterName 7@ victimName 8@ posX 14@ posY 15@ weaponImage 19@ shooterColor 23@ victimColor 24@
  81. end
  82. 15@ += 27
  83. end
  84.  
  85. if 0029: 13@ >= 4
  86. then
  87. if 28@ == 4
  88. then
  89. 28@ = 0
  90. 0AB1: call_scm_func @DrawText 7 shooterName 9@ victimName 10@ posX 14@ posY 15@ weaponImage 20@ shooterColor 0xF21C00 victimColor 0xF21C00
  91. else
  92. 0AB1: call_scm_func @DrawText 7 shooterName 9@ victimName 10@ posX 14@ posY 15@ weaponImage 20@ shooterColor 25@ victimColor 26@
  93. end
  94. 15@ += 27
  95. end
  96.  
  97.  
  98. for 30@ = 0 to 1001
  99. if 30@ == 1001
  100. then
  101. 0AB1: call_scm_func @PlayerActor_to_var 1 Actor handle $PLAYER_ACTOR _var 1@
  102. 2@ = 0
  103. 0AB1: call_scm_func @WasPlayerHit 1 Actor handle 1@ _returned 2@ _weaponName 16@ // 1@ = 1 means that hit, 1@ == 0 means not hit
  104. if 2@ == 1
  105. then
  106. for 29@ = 0 to 1000
  107. if
  108. SAMP.IsPlayerConnected(29@)
  109. then
  110. if
  111. 0@ = SAMP.GetActorHandleByPlayerID(29@)
  112. then
  113. if
  114. 051A: actor 1@ damaged_by_actor 0@
  115. then
  116. jump @Second
  117. end
  118. end
  119. end
  120. end
  121. end
  122. else
  123. if
  124. SAMP.IsPlayerConnected(30@)
  125. then
  126. if
  127. 1@ = SAMP.GetActorHandleByPlayerID(30@)
  128. then
  129. 2@ = 0
  130. 0AB1: call_scm_func @WasPlayerHit 1 Actor handle 1@ _returned 2@ _weaponName 16@ // 1@ = 1 means that hit, 1@ == 0 means not hit
  131. if 2@ == 1
  132. then
  133. for 29@ = 0 to 1001
  134. if 29@ == 1001
  135. then
  136. 0AB1: call_scm_func @PlayerActor_to_var 1 Actor handle $PLAYER_ACTOR _var 0@
  137. if
  138. 051A: actor 1@ damaged_by_actor 0@
  139. then
  140. jump @Second
  141. end
  142. else
  143. if
  144. SAMP.IsPlayerConnected(29@)
  145. then
  146. if
  147. 0@ = SAMP.GetActorHandleByPlayerID(29@)
  148. then
  149. if
  150. 051A: actor 1@ damaged_by_actor 0@
  151. then
  152. jump @Second
  153. end
  154. end
  155. end
  156. end
  157. end
  158. end
  159. end
  160. end
  161. end
  162. end
  163. jump @First
  164.  
  165. :Second // 0@ = shooter 1@ = victim
  166. //variables for colors: 11@ 12@ 21@ 22@ 23@ 24@ 25@ 26@
  167. //switcher 27@
  168. //free 28@ 31@
  169.  
  170. wait 0
  171. 054E: clear_actor 1@ damage
  172. 0467: clear_actor 0@ last_weapon_damage
  173.  
  174. if and
  175. 056D: actor 0@ defined
  176. 056D: actor 1@ defined
  177. then
  178. if 001B: 15000 > 33@
  179. then
  180. 0AB1: call_scm_func @GetActorName 1 Actor handle 0@ _returnedString 2@
  181. if
  182. 0C14: strcmp string1 3@ string2 2@
  183. then
  184. 0AB1: call_scm_func @GetActorName 1 Actor handle 1@ _returnedString 2@
  185. if
  186. 0C14: strcmp string1 4@ string2 2@
  187. then
  188. 28@ = 1
  189. jump @First
  190. end
  191. end
  192.  
  193. 0AB1: call_scm_func @GetActorName 1 Actor handle 0@ _returnedString 2@
  194. if
  195. 0C14: strcmp string1 5@ string2 2@
  196. then
  197. 0AB1: call_scm_func @GetActorName 1 Actor handle 1@ _returnedString 2@
  198. if
  199. 0C14: strcmp string1 6@ string2 2@
  200. then
  201. 28@ = 2
  202. jump @First
  203. end
  204. end
  205.  
  206. 0AB1: call_scm_func @GetActorName 1 Actor handle 0@ _returnedString 2@
  207. if
  208. 0C14: strcmp string1 7@ string2 2@
  209. then
  210. 0AB1: call_scm_func @GetActorName 1 Actor handle 1@ _returnedString 2@
  211. if
  212. 0C14: strcmp string1 8@ string2 2@
  213. then
  214. 28@ = 3
  215. jump @First
  216. end
  217. end
  218.  
  219. 0AB1: call_scm_func @GetActorName 1 Actor handle 0@ _returnedString 2@
  220. if
  221. 0C14: strcmp string1 9@ string2 2@
  222. then
  223. 0AB1: call_scm_func @GetActorName 1 Actor handle 1@ _returnedString 2@
  224. if
  225. 0C14: strcmp string1 10@ string2 2@
  226. then
  227. 28@ = 4
  228. jump @First
  229. end
  230. end
  231. end
  232.  
  233.  
  234. if 0029: 13@ >= 3
  235. then
  236. 0085: 25@ = 23@
  237. 0085: 26@ = 24@
  238. 0085: 20@ = 19@
  239. 0C13: strcpy destination 9@ source 7@
  240. 0C13: strcpy destination 10@ source 8@
  241. end
  242.  
  243. if 0029: 13@ >= 2
  244. then
  245. 0085: 23@ = 21@
  246. 0085: 24@ = 22@
  247. 0085: 19@ = 18@
  248. 0C13: strcpy destination 7@ source 5@
  249. 0C13: strcpy destination 8@ source 6@
  250. end
  251.  
  252. if 0029: 13@ >= 1
  253. then
  254. 0085: 21@ = 11@
  255. 0085: 22@ = 12@
  256. 0085: 18@ = 17@
  257. 0C13: strcpy destination 5@ source 3@
  258. 0C13: strcpy destination 6@ source 4@
  259. end
  260.  
  261. 0085: 17@ = 16@
  262.  
  263. 0AB1: call_scm_func @GetActorNameAndColor 1 Actor handle 0@ _returnedString 3@ _returnedColor 11@
  264. 0AB1: call_scm_func @GetActorNameAndColor 1 Actor handle 1@ _returnedString 4@ _returnedColor 12@
  265.  
  266. 13@ += 1
  267. 33@ = 0
  268. end
  269. jump @First
  270.  
  271.  
  272. :sitog
  273. 0B12: 27@ = 27@ XOR 1
  274. if 27@ == 1
  275. then
  276. 0AD1: show_formatted_text_highpriority "shootingIndicator is ~G~enabled" time 800
  277. else
  278. 0AD1: show_formatted_text_highpriority "shootingIndicator is ~R~disabled" time 800
  279. end
  280. samp.CmdRet
  281.  
  282.  
  283.  
  284.  
  285. // FUNCTIONS
  286. //
  287. //
  288. //
  289. //
  290. //
  291. //
  292. //
  293. //
  294. //
  295. //
  296.  
  297. //0AB1: call_scm_func @GetActorNameAndColor 1 Actor handle 0@ _returnedString 3@ _returnedColor 11@
  298. :GetActorNameAndColor
  299. 0AC8: 4@ = allocate_memory_size 260
  300. 0AC8: 3@ = allocate_memory_size 260
  301. 0B2B: samp 1@ = get_player_id_by_actor_handle 0@
  302. 0B36: samp 2@ = get_player_nickname 1@
  303. 0C13: strcpy destination 3@ source 2@ // to prevent bug
  304. 0AD3: 4@ = format "(%d)" 1@
  305. 0C15: strcat destination 3@ source 4@
  306. 0B37: samp 5@ = get_player_color 1@
  307. 0AC9: free_allocated_memory 4@
  308. 0AB2: ret 2 3@ 5@
  309.  
  310. //0AB1: call_scm_func @GetActorName 1 Actor handle 1@ _returnedString 2@
  311. :GetActorName
  312. 0AC8: 4@ = allocate_memory_size 260
  313. 0AC8: 3@ = allocate_memory_size 260
  314. 0B2B: samp 1@ = get_player_id_by_actor_handle 0@
  315. 0B36: samp 2@ = get_player_nickname 1@
  316. 0C13: strcpy destination 3@ source 2@ // to prevent bug
  317. 0AD3: 4@ = format "(%d)" 1@
  318. 0C15: strcat destination 3@ source 4@
  319. 0AC9: free_allocated_memory 4@
  320. 0AB2: ret 1 3@
  321.  
  322. //0AB1: call_scm_func @DrawText 7 shooterName 0@ victimName 1@ posX 2@ posY 3@ weaponImage 4@ shooterColor 5@ victimColor 6@
  323. :DrawText
  324. 03F0: enable_text_draw 1
  325. 0C17: 31@ = strlen 0@
  326. 31@ *= 10
  327. 0062: 2@ -= 31@ // (int)
  328. 0D94: draw_text 0@ pos_xy 2@ 3@ align_xy 0.0 0.0 color 5@ shadow 1
  329. 2@ += 76
  330. 005A: 2@ += 31@ // (int)
  331. 0D94: draw_text 1@ pos_xy 2@ 3@ align_xy 0.0 0.0 color 6@ shadow 1
  332. 2@ -= 38
  333. 3@ += 9
  334. 0B5F: convert_window_screen_coords 2@ 3@ to_game_screen_coords 2@ 3@
  335. 03E3: set_texture_to_be_drawn_antialiased 4@
  336. if and
  337. 6@ == 0xF21C00
  338. 5@ == 0xF21C00
  339. then
  340. 038D: draw_texture 4@ position 2@ 3@ size 12.0 12.0 RGBA 200 0 0 255
  341. else
  342. 038D: draw_texture 4@ position 2@ 3@ size 12.0 12.0 RGBA 255 255 255 255
  343. end
  344. 0AB2: ret 0
  345.  
  346.  
  347. //0AB1: call_scm_func @WasPlayerHit 1 Actor handle $PLAYER_ACTOR _returned 1@ _weaponDrawNumber 3@ // 1@ = 1 means that hit, 1@ == 0 means not hit
  348. :WasPlayerHit
  349. 2@ = 0
  350. if
  351. 031D: actor 0@ hit_by_weapon 22 //Colt
  352. then
  353. 2@ = 1
  354. 3@ = 2
  355. else
  356. if
  357. 031D: actor 0@ hit_by_weapon 23 //Silenced
  358. then
  359. 2@ = 1
  360. 3@ = 11
  361. else
  362. if
  363. 031D: actor 0@ hit_by_weapon 24 //Deagle
  364. then
  365. 2@ = 1
  366. 3@ = 4
  367. else
  368. if
  369. 031D: actor 0@ hit_by_weapon 25 //Shotgun
  370. then
  371. 2@ = 1
  372. 3@ = 10
  373. else
  374. if
  375. 031D: actor 0@ hit_by_weapon 26 //Sawn
  376. then
  377. 2@ = 1
  378. 3@ = 9
  379. else
  380. if
  381. 031D: actor 0@ hit_by_weapon 27 //Combat shotgun
  382. then
  383. 2@ = 1
  384. 3@ = 3
  385. else
  386. if
  387. 031D: actor 0@ hit_by_weapon 28 //Uzi
  388. then
  389. 2@ = 1
  390. 3@ = 14
  391. else
  392. if
  393. 031D: actor 0@ hit_by_weapon 29 //Mp5
  394. then
  395. 2@ = 1
  396. 3@ = 7
  397. else
  398. if
  399. 031D: actor 0@ hit_by_weapon 30 //AK47
  400. then
  401. 2@ = 1
  402. 3@ = 1
  403. else
  404. if
  405. 031D: actor 0@ hit_by_weapon 31 //M4
  406. then
  407. 2@ = 1
  408. 3@ = 5
  409. else
  410. if
  411. 031D: actor 0@ hit_by_weapon 32 //Tec9
  412. then
  413. 2@ = 1
  414. 3@ = 13
  415. else
  416. if
  417. 031D: actor 0@ hit_by_weapon 33 //Rifle
  418. then
  419. 2@ = 1
  420. 3@ = 8
  421. else
  422. if
  423. 031D: actor 0@ hit_by_weapon 34 //Sniper
  424. then
  425. 2@ = 1
  426. 3@ = 12
  427. else
  428. if
  429. 031D: actor 0@ hit_by_weapon 38 //Minigun
  430. then
  431. 2@ = 1
  432. 3@ = 6
  433. end
  434. end
  435. end
  436. end
  437. end
  438. end
  439. end
  440. end
  441. end
  442. end
  443. end
  444. end
  445. end
  446. end
  447. 0AB2: ret 2 2@ 3@
  448.  
  449. //0AB1: call_scm_func @PlayerActor_to_var 1 Actor handle $PLAYER_ACTOR Var 1@
  450. :PlayerActor_to_var
  451. 00A0: store_actor 0@ position_to 1@ 2@ 3@
  452. 0AB2: ret 1 0@
Add Comment
Please, Sign In to add comment