AXV09

[PAWN | INC] ColorPicker v1.0..1

May 1st, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.47 KB | None | 0 0
  1. /*
  2. ColorPicker
  3.  
  4. Author: Maku, edited by AXV
  5. Type: include
  6. Date created: 30-04-2013
  7. Date updated: 01-05-2013
  8. Version: 1.0.1
  9.  
  10. Copyright 2013 by Maku.
  11. All rights reserved.
  12. */
  13.  
  14. #if defined _colorpicker_included
  15. #endinput
  16. #endif
  17. #define _colorpicker_included
  18.  
  19. #include <a_samp>
  20. #if !defined _samp_included
  21. #tryinclude <a_samp>
  22. #if !defined _samp_included
  23. #error Brak biblioteki a_samp.inc!!!
  24. #endif
  25. #endif
  26.  
  27. /*
  28. Natives:
  29. native ShowPlayerColorPicker(playerid, pickerid, bool:showalpha = false, bool:showcancel = true);
  30. native HidePlayerColorPicker(playerid, bool:call_callback = false, call_response = 0);
  31. native OnColorPickerResponse(playerid, pickerid, color, response);
  32. */
  33.  
  34. #define COLOR_PICKER_RED 0
  35. #define COLOR_PICKER_GREEN 1
  36. #define COLOR_PICKER_BLUE 2
  37. #define COLOR_PICKER_ALPHA 3
  38. #define COLOR_PICKER_ID 4
  39. #define COLOR_PICKER_ALPHA_ENABLE 5
  40. #define RGBAToHex(%0,%1,%2,%3) ((%0)<<24 | (%1)<<16 | (%2)<<8 | (%3))
  41.  
  42. new
  43. Text:cp_Draw[19],
  44. PlayerText:cp_playerDraw[MAX_PLAYERS][5],
  45. ChooseColor[MAX_PLAYERS][6]
  46. ;
  47.  
  48. forward OnColorPickerResponse(playerid, pickerid, color, response);
  49.  
  50. // Functions
  51. LoadColorPicker() {
  52. print ("\n+-----------------------------------------+");
  53. print ( "| [INC] ColorPicker v1.0.1 by Maku - Loaded |");
  54. print ( "+-----------------------------------------+\n");
  55.  
  56. // window
  57. cp_Draw[0] = TextDrawCreate(320.000000, 190.000000, "_");
  58. TextDrawAlignment(cp_Draw[0], 2);
  59. TextDrawBackgroundColor(cp_Draw[0], 255);
  60. TextDrawFont(cp_Draw[0], 1);
  61. TextDrawLetterSize(cp_Draw[0], 0.500000, 10.000000);
  62. TextDrawColor(cp_Draw[0], -1);
  63. TextDrawSetOutline(cp_Draw[0], 0);
  64. TextDrawSetProportional(cp_Draw[0], 1);
  65. TextDrawSetShadow(cp_Draw[0], 1);
  66. TextDrawUseBox(cp_Draw[0], 1);
  67. TextDrawBoxColor(cp_Draw[0], 102);
  68. TextDrawTextSize(cp_Draw[0], 0.000000, 200.000000);
  69.  
  70. // title
  71. cp_Draw[1] = TextDrawCreate(320.000000, 180.000000, "~y~~h~Color~h~Picker");
  72. TextDrawAlignment(cp_Draw[1], 2);
  73. TextDrawBackgroundColor(cp_Draw[1], 32);
  74. TextDrawFont(cp_Draw[1], 0);
  75. TextDrawLetterSize(cp_Draw[1], 0.599999, 1.500000);
  76. TextDrawColor(cp_Draw[1], -1);
  77. TextDrawSetOutline(cp_Draw[1], 1);
  78. TextDrawSetProportional(cp_Draw[1], 1);
  79.  
  80. // labels
  81. cp_Draw[2] = TextDrawCreate(269.000000, 223.000000, "Aktualny kolor");
  82. TextDrawAlignment(cp_Draw[2], 2);
  83. TextDrawBackgroundColor(cp_Draw[2], 1);
  84. TextDrawFont(cp_Draw[2], 2);
  85. TextDrawLetterSize(cp_Draw[2], 0.159999, 0.799998);
  86. TextDrawColor(cp_Draw[2], -1);
  87. TextDrawSetOutline(cp_Draw[2], 1);
  88. TextDrawSetProportional(cp_Draw[2], 1);
  89.  
  90. cp_Draw[3] = TextDrawCreate(355.000000, 206.000000, "Koloryzacja");
  91. TextDrawAlignment(cp_Draw[3], 2);
  92. TextDrawBackgroundColor(cp_Draw[3], 1);
  93. TextDrawFont(cp_Draw[3], 2);
  94. TextDrawLetterSize(cp_Draw[3], 0.159999, 0.799998);
  95. TextDrawColor(cp_Draw[3], -1);
  96. TextDrawSetOutline(cp_Draw[3], 1);
  97. TextDrawSetProportional(cp_Draw[3], 1);
  98.  
  99. cp_Draw[4] = TextDrawCreate(319.000000, 211.000000, "~y~~h~-"); // paseczek od napisu 'koloryzacja'
  100. TextDrawBackgroundColor(cp_Draw[4], 16);
  101. TextDrawFont(cp_Draw[4], 1);
  102. TextDrawLetterSize(cp_Draw[4], 5.000000, 0.499998);
  103. TextDrawColor(cp_Draw[4], -1);
  104. TextDrawSetOutline(cp_Draw[4], 1);
  105. TextDrawSetProportional(cp_Draw[4], 1);
  106.  
  107. cp_Draw[5] = TextDrawCreate(324.000000, 221.000000, "~r~~h~RED");
  108. TextDrawAlignment(cp_Draw[5], 2);
  109. TextDrawBackgroundColor(cp_Draw[5], 1);
  110. TextDrawFont(cp_Draw[5], 2);
  111. TextDrawLetterSize(cp_Draw[5], 0.159999, 0.799998);
  112. TextDrawColor(cp_Draw[5], -1);
  113. TextDrawSetOutline(cp_Draw[5], 1);
  114. TextDrawSetProportional(cp_Draw[5], 1);
  115.  
  116. cp_Draw[6] = TextDrawCreate(326.000000, 240.000000, "~b~~h~BLUE");
  117. TextDrawAlignment(cp_Draw[6], 2);
  118. TextDrawBackgroundColor(cp_Draw[6], 1);
  119. TextDrawFont(cp_Draw[6], 2);
  120. TextDrawLetterSize(cp_Draw[6], 0.159999, 0.799998);
  121. TextDrawColor(cp_Draw[6], -1);
  122. TextDrawSetOutline(cp_Draw[6], 1);
  123. TextDrawSetProportional(cp_Draw[6], 1);
  124.  
  125. cp_Draw[7] = TextDrawCreate(328.000000, 260.000000, "~g~~h~GREEN");
  126. TextDrawAlignment(cp_Draw[7], 2);
  127. TextDrawBackgroundColor(cp_Draw[7], 1);
  128. TextDrawFont(cp_Draw[7], 2);
  129. TextDrawLetterSize(cp_Draw[7], 0.159999, 0.799998);
  130. TextDrawColor(cp_Draw[7], -1);
  131. TextDrawSetOutline(cp_Draw[7], 1);
  132. TextDrawSetProportional(cp_Draw[7], 1);
  133.  
  134. // clickable
  135. cp_Draw[8] = TextDrawCreate(355.000000, 220.000000, "<"); // red
  136. TextDrawAlignment(cp_Draw[8], 2);
  137. TextDrawBackgroundColor(cp_Draw[8], 0);
  138. TextDrawFont(cp_Draw[8], 1);
  139. TextDrawLetterSize(cp_Draw[8], 0.230000, 0.999998);
  140. TextDrawColor(cp_Draw[8], -1);
  141. TextDrawSetOutline(cp_Draw[8], 0);
  142. TextDrawSetProportional(cp_Draw[8], 1);
  143. TextDrawSetShadow(cp_Draw[8], 1);
  144. TextDrawUseBox(cp_Draw[8], 1);
  145. TextDrawBoxColor(cp_Draw[8], 68);
  146. TextDrawTextSize(cp_Draw[8], 12.000000, 10.000000);
  147. TextDrawSetSelectable(cp_Draw[8], true);
  148.  
  149. cp_Draw[9] = TextDrawCreate(390.000000, 220.000000, ">"); // red
  150. TextDrawAlignment(cp_Draw[9], 2);
  151. TextDrawBackgroundColor(cp_Draw[9], 255);
  152. TextDrawFont(cp_Draw[9], 1);
  153. TextDrawLetterSize(cp_Draw[9], 0.230000, 0.999998);
  154. TextDrawColor(cp_Draw[9], -1);
  155. TextDrawSetOutline(cp_Draw[9], 0);
  156. TextDrawSetProportional(cp_Draw[9], 1);
  157. TextDrawSetShadow(cp_Draw[9], 1);
  158. TextDrawUseBox(cp_Draw[9], 1);
  159. TextDrawBoxColor(cp_Draw[9], 68);
  160. TextDrawTextSize(cp_Draw[9], 12.000000, 10.000000);
  161. TextDrawSetSelectable(cp_Draw[9], true);
  162.  
  163. cp_Draw[10] = TextDrawCreate(355.000000, 240.000000, "<"); // blue
  164. TextDrawAlignment(cp_Draw[10], 2);
  165. TextDrawBackgroundColor(cp_Draw[10], 255);
  166. TextDrawFont(cp_Draw[10], 1);
  167. TextDrawLetterSize(cp_Draw[10], 0.230000, 0.999998);
  168. TextDrawColor(cp_Draw[10], -1);
  169. TextDrawSetOutline(cp_Draw[10], 0);
  170. TextDrawSetProportional(cp_Draw[10], 1);
  171. TextDrawSetShadow(cp_Draw[10], 1);
  172. TextDrawUseBox(cp_Draw[10], 1);
  173. TextDrawBoxColor(cp_Draw[10], 68);
  174. TextDrawTextSize(cp_Draw[10], 12.000000, 10.000000);
  175. TextDrawSetSelectable(cp_Draw[10], true);
  176.  
  177. cp_Draw[11] = TextDrawCreate(355.000000, 260.000000, "<"); // green
  178. TextDrawAlignment(cp_Draw[11] , 2);
  179. TextDrawBackgroundColor(cp_Draw[11] , 255);
  180. TextDrawFont(cp_Draw[11] , 1);
  181. TextDrawLetterSize(cp_Draw[11] , 0.230000, 0.999998);
  182. TextDrawColor(cp_Draw[11] , -1);
  183. TextDrawSetOutline(cp_Draw[11] , 0);
  184. TextDrawSetProportional(cp_Draw[11] , 1);
  185. TextDrawSetShadow(cp_Draw[11] , 1);
  186. TextDrawUseBox(cp_Draw[11] , 1);
  187. TextDrawBoxColor(cp_Draw[11] , 68);
  188. TextDrawTextSize(cp_Draw[11] , 12.000000, 10.000000);
  189. TextDrawSetSelectable(cp_Draw[11], true);
  190.  
  191. cp_Draw[12] = TextDrawCreate(390.000000, 240.000000, ">"); // blue
  192. TextDrawAlignment(cp_Draw[12], 2);
  193. TextDrawBackgroundColor(cp_Draw[12], 255);
  194. TextDrawFont(cp_Draw[12], 1);
  195. TextDrawLetterSize(cp_Draw[12], 0.230000, 0.999998);
  196. TextDrawColor(cp_Draw[12], -1);
  197. TextDrawSetOutline(cp_Draw[12], 0);
  198. TextDrawSetProportional(cp_Draw[12], 1);
  199. TextDrawSetShadow(cp_Draw[12], 1);
  200. TextDrawUseBox(cp_Draw[12], 1);
  201. TextDrawBoxColor(cp_Draw[12], 68);
  202. TextDrawTextSize(cp_Draw[12], 12.000000, 10.000000);
  203. TextDrawSetSelectable(cp_Draw[12], true);
  204.  
  205. cp_Draw[13] = TextDrawCreate(390.000000, 260.000000, ">"); // green
  206. TextDrawAlignment(cp_Draw[13], 2);
  207. TextDrawBackgroundColor(cp_Draw[13], 255);
  208. TextDrawFont(cp_Draw[13], 1);
  209. TextDrawLetterSize(cp_Draw[13], 0.230000, 0.999998);
  210. TextDrawColor(cp_Draw[13], -1);
  211. TextDrawSetOutline(cp_Draw[13], 0);
  212. TextDrawSetProportional(cp_Draw[13], 1);
  213. TextDrawSetShadow(cp_Draw[13], 1);
  214. TextDrawUseBox(cp_Draw[13], 1);
  215. TextDrawBoxColor(cp_Draw[13], 68);
  216. TextDrawTextSize(cp_Draw[13], 12.000000, 10.000000);
  217. TextDrawSetSelectable(cp_Draw[13], true);
  218.  
  219. cp_Draw[14] = TextDrawCreate(416.000000, 190.000000, "x"); // cancel
  220. TextDrawAlignment(cp_Draw[14], 2);
  221. TextDrawBackgroundColor(cp_Draw[14], 255);
  222. TextDrawFont(cp_Draw[14], 2);
  223. TextDrawLetterSize(cp_Draw[14], 0.199999, 0.699998);
  224. TextDrawColor(cp_Draw[14], -1);
  225. TextDrawSetOutline(cp_Draw[14], 0);
  226. TextDrawSetProportional(cp_Draw[14], 1);
  227. TextDrawSetShadow(cp_Draw[14], 1);
  228. TextDrawUseBox(cp_Draw[14], 1);
  229. TextDrawBoxColor(cp_Draw[14], 68);
  230. TextDrawTextSize(cp_Draw[14], 12.000000, 8.000000);
  231. TextDrawSetSelectable(cp_Draw[14], true);
  232.  
  233. cp_Draw[15] = TextDrawCreate(409.000000, 271.000000, "OK"); // okey
  234. TextDrawAlignment(cp_Draw[15], 2);
  235. TextDrawBackgroundColor(cp_Draw[15], 0);
  236. TextDrawFont(cp_Draw[15], 1);
  237. TextDrawLetterSize(cp_Draw[15], 0.230000, 0.999998);
  238. TextDrawColor(cp_Draw[15], -1);
  239. TextDrawSetOutline(cp_Draw[15], 0);
  240. TextDrawSetProportional(cp_Draw[15], 1);
  241. TextDrawSetShadow(cp_Draw[15], 1);
  242. TextDrawUseBox(cp_Draw[15], 1);
  243. TextDrawBoxColor(cp_Draw[15], 68);
  244. TextDrawTextSize(cp_Draw[15], 12.000000, 12.000000);
  245. TextDrawSetSelectable(cp_Draw[15], true);
  246. // end clickable
  247.  
  248. cp_Draw[16] = TextDrawCreate(300.000000, 231.000000, "~r~~h~~h~-"); // pasek pod 'RED'
  249. TextDrawBackgroundColor(cp_Draw[16], 16);
  250. TextDrawFont(cp_Draw[16], 1);
  251. TextDrawLetterSize(cp_Draw[16], 7.899997, 0.699998);
  252. TextDrawColor(cp_Draw[16], -1);
  253. TextDrawSetOutline(cp_Draw[16], 1);
  254. TextDrawSetProportional(cp_Draw[16], 1);
  255.  
  256. cp_Draw[17] = TextDrawCreate(300.000000, 251.000000, "~g~~h~~h~-"); // pasek pod 'BLUE'
  257. TextDrawBackgroundColor(cp_Draw[17], 16);
  258. TextDrawFont(cp_Draw[17], 1);
  259. TextDrawLetterSize(cp_Draw[17], 7.899997, 0.699998);
  260. TextDrawColor(cp_Draw[17], -1);
  261. TextDrawSetOutline(cp_Draw[17], 1);
  262. TextDrawSetProportional(cp_Draw[17], 1);
  263.  
  264. // credits
  265. cp_Draw[18] = TextDrawCreate(218.000000, 278.000000, "Code by Maku123 | Design by AXV");
  266. TextDrawBackgroundColor(cp_Draw[18], 1);
  267. TextDrawFont(cp_Draw[18], 1);
  268. TextDrawLetterSize(cp_Draw[18], 0.119998, 0.399998);
  269. TextDrawColor(cp_Draw[18], -1);
  270. TextDrawSetOutline(cp_Draw[18], 1);
  271. TextDrawSetProportional(cp_Draw[18], 1);
  272. return 1;
  273. }
  274.  
  275. UnLoadColorPicker() {
  276. for(new i = GetMaxPlayers() - 1; i >= 0; --i) if (IsPlayerConnected (i)) {
  277. HidePlayerColorPicker(i);
  278. PlayerTextDrawDestroy(i, cp_playerDraw[i][0]);
  279. PlayerTextDrawDestroy(i, cp_playerDraw[i][1]);
  280. PlayerTextDrawDestroy(i, cp_playerDraw[i][2]);
  281. PlayerTextDrawDestroy(i, cp_playerDraw[i][3]);
  282. }
  283. for(new i; i < sizeof (cp_Draw); i++) {
  284. TextDrawDestroy(cp_Draw[i]);
  285. }
  286. return 1;
  287. }
  288.  
  289. /*
  290. Poprawka #1
  291. - Poprawiono CP_OnPlayerKeyStateChange(playerid, _:clickedid); na forward CP_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
  292. */
  293.  
  294. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
  295. if ((newkeys & 16) && ChooseColor[playerid][COLOR_PICKER_ID] != -1) {
  296. HidePlayerColorPicker(playerid, true, 1);
  297. }
  298. CallLocalFunction("CP_OnPlayerKeyStateChange", "ddd", playerid, newkeys, oldkeys);
  299. return 1;
  300. }
  301. #if defined _ALS_OnPlayerKeyStateChange
  302. #undef OnPlayerKeyStateChange
  303. #else
  304. #define _ALS_OnPlayerKeyStateChange
  305. #endif
  306. #define OnPlayerKeyStateChange CP_OnPlayerKeyStateChange
  307. forward CP_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
  308.  
  309. /*
  310. Notatka
  311. #AXV
  312. Robiąc textdrawy niezauwazylem czegos takiego jak 'alpha' - powininem dodac w kolejnej wersji releasu
  313. */
  314.  
  315. public OnPlayerClickTextDraw(playerid, Text:clickedid) {
  316. if (ChooseColor[playerid][COLOR_PICKER_ID] != -1) {
  317. if (clickedid == cp_Draw[14] || clickedid == Text:INVALID_TEXT_DRAW) { // button 'X'
  318. HidePlayerColorPicker(playerid, true, 0);
  319. }
  320. else if (clickedid == cp_Draw[15]) { // button 'OK'
  321. HidePlayerColorPicker(playerid, true, 1);
  322. } else {
  323. if (clickedid == cp_Draw[8]) ChooseColor[playerid][COLOR_PICKER_RED] -= 5;
  324. if (clickedid == cp_Draw[11]) ChooseColor[playerid][COLOR_PICKER_GREEN] -= 5;
  325. if (clickedid == cp_Draw[10]) ChooseColor[playerid][COLOR_PICKER_BLUE] -= 5;
  326. //if (clickedid == cp_Draw[8]) ChooseColor[playerid][COLOR_PICKER_ALPHA] -= 5;
  327. if (clickedid == cp_Draw[9]) ChooseColor[playerid][COLOR_PICKER_RED] += 5;
  328. if (clickedid == cp_Draw[13]) ChooseColor[playerid][COLOR_PICKER_GREEN] += 5;
  329. if (clickedid == cp_Draw[12]) ChooseColor[playerid][COLOR_PICKER_BLUE] += 5;
  330. //if (clickedid == cp_Draw[12]) ChooseColor[playerid][COLOR_PICKER_ALPHA] += 5;
  331.  
  332. ColorPicker_RefreshColor(playerid, ChooseColor[playerid][COLOR_PICKER_ALPHA_ENABLE]);
  333. }
  334. }
  335. CallLocalFunction("CP_OnPlayerClickTextDraw", "dd", playerid, _:clickedid);
  336. return 1;
  337. }
  338. #if defined _ALS_OnPlayerClickTextDraw
  339. #undef OnPlayerClickTextDraw
  340. #else
  341. #define _ALS_OnPlayerClickTextDraw
  342. #endif
  343. #define OnPlayerClickTextDraw CP_OnPlayerClickTextDraw
  344. forward CP_OnPlayerClickTextDraw(playerid, _:clickedid);
  345.  
  346.  
  347. stock HidePlayerColorPicker(playerid, bool:call_callback = false, call_response = 0) {
  348. for (new i; i < sizeof cp_Draw; i++) {
  349. TextDrawHideForPlayer(playerid, cp_Draw[i]);
  350. }
  351.  
  352. if (call_callback) {
  353. new color = RGBAToHex(ChooseColor[playerid][COLOR_PICKER_RED],ChooseColor[playerid][COLOR_PICKER_GREEN],ChooseColor[playerid][COLOR_PICKER_BLUE],ChooseColor[playerid][COLOR_PICKER_ALPHA]);
  354. CallRemoteFunction("OnColorPickerResponse", "dddd", playerid, ChooseColor[playerid][COLOR_PICKER_ID], color, call_response);
  355. }
  356. ChooseColor[playerid][COLOR_PICKER_ID] = -1;
  357. PlayerTextDrawHide(playerid, cp_playerDraw[playerid][0]);
  358. PlayerTextDrawHide(playerid, cp_playerDraw[playerid][1]);
  359. PlayerTextDrawHide(playerid, cp_playerDraw[playerid][2]);
  360. PlayerTextDrawHide(playerid, cp_playerDraw[playerid][3]);
  361. CancelSelectTextDraw(playerid);
  362. return 1;
  363. }
  364.  
  365. stock ShowPlayerColorPicker(playerid, pickerid, bool:showalpha = false, bool:showcancel = true) {
  366. ChooseColor[playerid][COLOR_PICKER_ID] = pickerid;
  367.  
  368. ChooseColor[playerid][COLOR_PICKER_RED] = 155;
  369. ChooseColor[playerid][COLOR_PICKER_GREEN] = 155;
  370. ChooseColor[playerid][COLOR_PICKER_BLUE] = 155;
  371. ChooseColor[playerid][COLOR_PICKER_ALPHA] = 255;
  372. ChooseColor[playerid][COLOR_PICKER_ALPHA_ENABLE] = showalpha;
  373.  
  374. for (new i; i < sizeof cp_Draw; i++) {
  375. // tymczasowo wylaczamy opcje alpha
  376. /*if (i == 15 && showalpha == true) continue;
  377. if (i == 3 && showalpha == false) continue;
  378. if (i == 8 && showalpha == false) continue;
  379. if (i == 12 && showalpha == false) continue;*/
  380. if (i == 14 && showcancel == false) continue;
  381.  
  382. TextDrawShowForPlayer(playerid, cp_Draw[i]);
  383. }
  384.  
  385. ColorPicker_RefreshColor(playerid, showalpha);
  386. SelectTextDraw(playerid, 0x5EBAF2FF);
  387. return 1;
  388. }
  389.  
  390. stock ColorPicker_RefreshColor(playerid, showalpha) {
  391. if (ChooseColor[playerid][COLOR_PICKER_RED] > 255) ChooseColor[playerid][COLOR_PICKER_RED] = 0;
  392. if (ChooseColor[playerid][COLOR_PICKER_RED] < 0) ChooseColor[playerid][COLOR_PICKER_RED] = 255;
  393.  
  394. if (ChooseColor[playerid][COLOR_PICKER_GREEN] > 255) ChooseColor[playerid][COLOR_PICKER_GREEN] = 0;
  395. if (ChooseColor[playerid][COLOR_PICKER_GREEN] < 0) ChooseColor[playerid][COLOR_PICKER_GREEN] = 255;
  396.  
  397. if (ChooseColor[playerid][COLOR_PICKER_BLUE] > 255) ChooseColor[playerid][COLOR_PICKER_BLUE] = 0;
  398. if (ChooseColor[playerid][COLOR_PICKER_BLUE] < 0) ChooseColor[playerid][COLOR_PICKER_BLUE] = 255;
  399.  
  400. // if (ChooseColor[playerid][COLOR_PICKER_ALPHA] > 255) ChooseColor[playerid][COLOR_PICKER_ALPHA] = 0;
  401. // if (ChooseColor[playerid][COLOR_PICKER_ALPHA] < 0) ChooseColor[playerid][COLOR_PICKER_ALPHA] = 255;
  402.  
  403. new color = RGBAToHex(ChooseColor[playerid][COLOR_PICKER_RED],ChooseColor[playerid][COLOR_PICKER_GREEN],ChooseColor[playerid][COLOR_PICKER_BLUE],ChooseColor[playerid][COLOR_PICKER_ALPHA]);
  404. PlayerTextDrawBoxColor(playerid, cp_playerDraw[playerid][0], color);
  405. PlayerTextDrawShow(playerid, cp_playerDraw[playerid][0]);
  406.  
  407. new buf[10];
  408. if (showalpha) {
  409. format (buf, sizeof (buf), "%d", ChooseColor[playerid][COLOR_PICKER_RED]);
  410. PlayerTextDrawSetString(playerid, cp_playerDraw[playerid][1], buf);
  411.  
  412. format (buf, sizeof (buf), "%d", ChooseColor[playerid][COLOR_PICKER_BLUE]);
  413. PlayerTextDrawSetString(playerid, cp_playerDraw[playerid][2], buf);
  414.  
  415. format (buf, sizeof (buf), "%d", ChooseColor[playerid][COLOR_PICKER_GREEN]);
  416. PlayerTextDrawSetString(playerid, cp_playerDraw[playerid][3], buf);
  417. } else {
  418. format (buf, sizeof (buf), "%d", ChooseColor[playerid][COLOR_PICKER_RED]);
  419. PlayerTextDrawSetString(playerid, cp_playerDraw[playerid][1], buf);
  420.  
  421. format (buf, sizeof (buf), "%d", ChooseColor[playerid][COLOR_PICKER_BLUE]);
  422. PlayerTextDrawSetString(playerid, cp_playerDraw[playerid][2], buf);
  423.  
  424. format (buf, sizeof (buf), "%d", ChooseColor[playerid][COLOR_PICKER_GREEN]);
  425. PlayerTextDrawSetString(playerid, cp_playerDraw[playerid][3], buf);
  426. }
  427. PlayerTextDrawShow(playerid, cp_playerDraw[playerid][1]);
  428. PlayerTextDrawShow(playerid, cp_playerDraw[playerid][2]);
  429. PlayerTextDrawShow(playerid, cp_playerDraw[playerid][3]);
  430. return 1;
  431. }
  432.  
  433. public OnPlayerConnect(playerid) {
  434. ChooseColor[playerid][COLOR_PICKER_ID] = -1;
  435. cp_playerDraw[playerid][0] = CreatePlayerTextDraw(playerid,269.000000, 233.000000, "_");
  436. PlayerTextDrawAlignment(playerid,cp_playerDraw[playerid][0], 2);
  437. PlayerTextDrawBackgroundColor(playerid,cp_playerDraw[playerid][0], 255);
  438. PlayerTextDrawFont(playerid,cp_playerDraw[playerid][0], 1);
  439. PlayerTextDrawLetterSize(playerid,cp_playerDraw[playerid][0], 0.500000, 4.000000);
  440. PlayerTextDrawColor(playerid,cp_playerDraw[playerid][0], 16711935);
  441. PlayerTextDrawSetOutline(playerid,cp_playerDraw[playerid][0], 0);
  442. PlayerTextDrawSetProportional(playerid,cp_playerDraw[playerid][0], 1);
  443. PlayerTextDrawSetShadow(playerid,cp_playerDraw[playerid][0], 1);
  444. PlayerTextDrawUseBox(playerid,cp_playerDraw[playerid][0], 1);
  445. PlayerTextDrawBoxColor(playerid,cp_playerDraw[playerid][0], 16711935);
  446. PlayerTextDrawTextSize(playerid,cp_playerDraw[playerid][0], 289.000000, 60.000000);
  447.  
  448. cp_playerDraw[playerid][1] = CreatePlayerTextDraw(playerid, 373.000000, 221.000000, "155");
  449. PlayerTextDrawAlignment(playerid,cp_playerDraw[playerid][1], 2);
  450. PlayerTextDrawBackgroundColor(playerid,cp_playerDraw[playerid][1], 1);
  451. PlayerTextDrawFont(playerid,cp_playerDraw[playerid][1], 2);
  452. PlayerTextDrawLetterSize(playerid,cp_playerDraw[playerid][1], 0.159999, 0.799998);
  453. PlayerTextDrawColor(playerid,cp_playerDraw[playerid][1], -1);
  454. PlayerTextDrawSetOutline(playerid,cp_playerDraw[playerid][1], 1);
  455. PlayerTextDrawSetProportional(playerid,cp_playerDraw[playerid][1], 1);
  456.  
  457. cp_playerDraw[playerid][2] = CreatePlayerTextDraw(playerid, 373.000000, 241.000000, "155");
  458. PlayerTextDrawAlignment(playerid, cp_playerDraw[playerid][2], 2);
  459. PlayerTextDrawBackgroundColor(playerid, cp_playerDraw[playerid][2], 1);
  460. PlayerTextDrawFont(playerid, cp_playerDraw[playerid][2], 2);
  461. PlayerTextDrawLetterSize(playerid, cp_playerDraw[playerid][2], 0.159999, 0.799998);
  462. PlayerTextDrawColor(playerid, cp_playerDraw[playerid][2], -1);
  463. PlayerTextDrawSetOutline(playerid, cp_playerDraw[playerid][2], 1);
  464. PlayerTextDrawSetProportional(playerid, cp_playerDraw[playerid][2], 1);
  465.  
  466. cp_playerDraw[playerid][3] = CreatePlayerTextDraw(playerid,373.000000, 261.000000, "155");
  467. PlayerTextDrawAlignment(playerid,cp_playerDraw[playerid][3], 2);
  468. PlayerTextDrawBackgroundColor(playerid,cp_playerDraw[playerid][3], 1);
  469. PlayerTextDrawFont(playerid,cp_playerDraw[playerid][3], 2);
  470. PlayerTextDrawLetterSize(playerid,cp_playerDraw[playerid][3], 0.159999, 0.799998);
  471. PlayerTextDrawColor(playerid,cp_playerDraw[playerid][3], -1);
  472. PlayerTextDrawSetOutline(playerid,cp_playerDraw[playerid][3], 1);
  473. PlayerTextDrawSetProportional(playerid,cp_playerDraw[playerid][3], 1);
  474.  
  475. CallLocalFunction("ColorPicker_OnPlayerConnect", "dd", playerid);
  476. return 1;
  477. }
  478. #if defined _ALS_OnPlayerConnect
  479. #undef OnPlayerConnect
  480. #else
  481. #define _ALS_OnPlayerConnect
  482. #endif
  483. #define OnPlayerConnect ColorPicker_OnPlayerConnect
  484. forward ColorPicker_OnPlayerConnect(playerid);
  485.  
  486. public OnPlayerDisconnect(playerid, reason) {
  487. PlayerTextDrawDestroy(playerid, cp_playerDraw[playerid][0]);
  488. PlayerTextDrawDestroy(playerid, cp_playerDraw[playerid][1]);
  489. PlayerTextDrawDestroy(playerid, cp_playerDraw[playerid][2]);
  490. PlayerTextDrawDestroy(playerid, cp_playerDraw[playerid][3]);
  491. CallLocalFunction("ColorPicker_OnPlayerDisconnect", "dd", playerid, reason);
  492. return 1;
  493. }
  494. #if defined _ALS_OnPlayerDisconnect
  495. #undef OnPlayerDisconnect
  496. #else
  497. #define _ALS_OnPlayerDisconnect
  498. #endif
  499. #define OnPlayerDisconnect ColorPicker_OnPlayerDisconnect
  500. forward ColorPicker_OnPlayerDisconnect(playerid, reason);
  501.  
  502. #if defined FILTERSCRIPT
  503.  
  504. public OnFilterScriptInit() {
  505. LoadColorPicker();
  506. CallLocalFunction("ColorPicker_OnFilterScriptInit", "");
  507. return 1;
  508. }
  509. #if defined _ALS_OnFilterScriptInit
  510. #undef OnFilterScriptInit
  511. #else
  512. #define _ALS_OnFilterScriptInit
  513. #endif
  514. #define OnFilterScriptInit ColorPicker_OnFilterScriptInit
  515. forward ColorPicker_OnFilterScriptInit();
  516.  
  517. public OnFilterScriptExit() {
  518. UnLoadColorPicker();
  519. CallLocalFunction("ColorPicker_OnFilterScriptExit", "");
  520. return 1;
  521. }
  522. #if defined _ALS_OnFilterScriptExit
  523. #undef OnFilterScriptExit
  524. #else
  525. #define _ALS_OnFilterScriptExit
  526. #endif
  527. #define OnFilterScriptExit ColorPicker_OnFilterScriptExit
  528. forward ColorPicker_OnFilterScriptExit();
  529. #else
  530. public OnGameModeInit() {
  531. LoadColorPicker();
  532. CallLocalFunction("ColorPicker_OnGameModeInit", "");
  533. return 1;
  534. }
  535. #if defined _ALS_OnGameModeInit
  536. #undef OnGameModeInit
  537. #else
  538. #define _ALS_OnGameModeInit
  539. #endif
  540. #define OnGameModeInit ColorPicker_OnGameModeInit
  541. forward ColorPicker_OnGameModeInit();
  542.  
  543. public OnGameModeExit() {
  544. UnLoadColorPicker();
  545. CallLocalFunction("ColorPicker_OnGameModeExit", "");
  546. return 1;
  547. }
  548. #if defined _ALS_OnGameModeExit
  549. #undef OnGameModeExit
  550. #else
  551. #define _ALS_OnGameModeExit
  552. #endif
  553. #define OnGameModeExit ColorPicker_OnGameModeExit
  554. forward ColorPicker_OnGameModeExit();
  555.  
  556. #endif
Advertisement
Add Comment
Please, Sign In to add comment