GammixSAMP

colors.inc R2 - By Gammix

May 31st, 2015
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.49 KB | None | 0 0
  1. /*
  2. Colors Include (colors.inc)
  3. * Most used and flexible colors and embeded colors list!
  4. * Now avaliable color crasher fix(optional though)
  5. * 2 handy player functions !
  6.  
  7. Author: (creator)
  8. * Gammix
  9.  
  10. (c) Copyright 2015
  11. * This file is provided as is (no warranties).
  12. */
  13. /*
  14. FUNCTIONS:
  15. native SetPlayerMarkerVisibility(playerid, alpha = 0xFF, forplayerid = -1);
  16. native TogglePlayerMarker(playerid, bool:toggle, forplayerid = -1);
  17. native _
  18. native COLOR_Create(RR, GG, BB, AA = 255);
  19. native COLOR_SetTransparency(color, alpha = 0xFF);
  20. native COLOR_HexToInt(str[]);
  21. native COLOR_IntToHex(cint);
  22. */
  23.  
  24. static bool:gPlayerMarker[MAX_PLAYERS];
  25.  
  26. //player functions
  27. stock SetPlayerMarkerVisibility(playerid, alpha = 0xFF, forplayerid = -1)
  28. {
  29. if(forplayerid < 0) return SetPlayerColor(playerid, COLOR_SetTransparency(GetPlayerColor(playerid), alpha));//set color for all
  30. else return SetPlayerMarkerForPlayer(playerid, forplayerid, COLOR_SetTransparency(GetPlayerColor(playerid), alpha));//set color for a specific player
  31. }
  32.  
  33. stock TogglePlayerMarker(playerid, bool:toggle)
  34. {
  35. gPlayerMarker[playerid] = toggle;
  36. return true;
  37. }
  38.  
  39. stock IsPlayerMarkerToggled(playerid)
  40. {
  41. return gPlayerMarker[playerid];
  42. }
  43.  
  44. public OnPlayerStreamIn(playerid, forplayerid)
  45. {
  46. if(IsPlayerMarkerToggled(playerid))
  47. {
  48. SetPlayerMarkerForPlayer(forplayerid, playerid, (GetPlayerColor(playerid) & 0xFFFFFF00));
  49. }
  50. else
  51. {
  52. SetPlayerMarkerForPlayer(forplayerid, playerid, (GetPlayerColor(playerid) & 0xFFFFFF00) | 0xFF);
  53. }
  54.  
  55. #if defined FUNCS_OnPlayerStreamIn
  56. return FUNCS_OnPlayerStreamIn(playerid, forplayerid);
  57. #else
  58. return 1;
  59. #endif
  60. }
  61. #if defined _ALS_OnPlayerStreamIn
  62. #undef OnPlayerStreamIn
  63. #else
  64. #define _ALS_OnPlayerStreamIn
  65. #endif
  66. #define OnPlayerStreamIn FUNCS_OnPlayerStreamIn
  67. #if defined FUNCS_OnPlayerStreamIn
  68. forward FUNCS_OnPlayerStreamIn(playerid, forplayerid);
  69. #endif
  70.  
  71. public OnPlayerDisconnect(playerid, reason)
  72. {
  73.  
  74.  
  75. #if defined FUNCS_OnPlayerDisconnect
  76. return FUNCS_OnPlayerDisconnect(playerid, reason);
  77. #else
  78. return 1;
  79. #endif
  80. }
  81. #if defined _ALS_OnPlayerDisconnect
  82. #undef OnPlayerDisconnect
  83. #else
  84. #define _ALS_OnPlayerDisconnect
  85. #endif
  86. #define OnPlayerDisconnect FUNCS_OnPlayerDisconnect
  87. #if defined FUNCS_OnPlayerDisconnect
  88. forward FUNCS_OnPlayerDisconnect(playerid, reason);
  89. #endif
  90.  
  91. public OnPlayerSpawn(playerid)
  92. {
  93. if(IsPlayerMarkerToggled(playerid))
  94. {
  95. for(new i; i < MAX_PLAYERS; i++)
  96. {
  97. SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid) & 0xFFFFFF00));
  98. }
  99. }
  100. else
  101. {
  102. for(new i; i < MAX_PLAYERS; i++)
  103. {
  104. SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid) & 0xFFFFFF00) | 0xFF);
  105. }
  106. }
  107.  
  108. #if defined FUNCS_OnPlayerSpawn
  109. return FUNCS_OnPlayerSpawn(playerid);
  110. #else
  111. return 1;
  112. #endif
  113. }
  114. #if defined _ALS_OnPlayerSpawn
  115. #undef OnPlayerSpawn
  116. #else
  117. #define _ALS_OnPlayerSpawn
  118. #endif
  119. #define OnPlayerSpawn FUNCS_OnPlayerSpawn
  120. #if defined FUNCS_OnPlayerSpawn
  121. forward FUNCS_OnPlayerSpawn(playerid);
  122. #endif
  123.  
  124. //color functions
  125. stock COLOR_Create(RR, GG, BB, AA = 255)//make a color
  126. {
  127. return (RR*16777216) +
  128. (GG*65536) +
  129. (BB*256) +
  130. AA;
  131. }
  132.  
  133. stock COLOR_SetTransparency(color, alpha = 0xFF)
  134. {
  135. static newcolor;
  136.  
  137. alpha = clamp(alpha, 0x00, 0xFF);
  138.  
  139. newcolor = (color & ~0xFF) | alpha;
  140. return newcolor;
  141. }
  142.  
  143. stock COLOR_HexToInt(str[])//credits to samp team
  144. {
  145. if(! str[0]) return false;
  146.  
  147. static cur = 1, res = 0;
  148. for(new i = strlen(string); i > 0; i--)
  149. {
  150. res += cur * (string[i - 1] - ((string[i - 1] < 58) ? (48) : (55)));
  151. cur = cur * 16;
  152. }
  153. return res;
  154. }
  155.  
  156. stock COLOR_IntToHex(cint)//better and simple method !
  157. {
  158. static str[18];
  159. format(str, sizeof(str), "{%06x}", cint >>> 8);
  160. return str;
  161. }
  162.  
  163. //Embeded colors
  164. //different embeded color shades of red
  165. #define INDIAN_RED "{CD5C5C}"
  166. #define LIGHT_CORAL "{F08080}"
  167. #define SALMON "{FA8072}"
  168. #define DARK_SALMON "{E9967A}"
  169. #define LIGHT_SALMON "{FFA07A}"
  170. #define CRIMSON "{DC143C}"
  171. #define RED "{FF0000}"
  172. #define FIREBRICK "{B22222}"
  173. #define DARK_RED "{8B0000}"
  174.  
  175. //different embeded color shades of pink
  176. #define PINK "{FFC0CB}"
  177. #define LIGHT_PINK "{FFB6C1}"
  178. #define HOT_PINK "{FF69B4}"
  179. #define DEEP_PINK "{FF1493}"
  180. #define MEDIUM_VIOLET_RED "{C71585}"
  181. #define PALE_VIOLET_RED "{DB7093}"
  182.  
  183. //different embeded color shades of Orange
  184. #define CORAL "{FF7F50}"
  185. #define TOMATO "{FF6347}"
  186. #define ORANGE_RED "{FF4500}"
  187. #define DARK_ORANGE "{FF8C00}"
  188. #define ORANGE "{FFA500}"
  189.  
  190. //different embeded color shades of Yellow
  191. #define GOLD "{FFD700}"
  192. #define YELLOW "{FFFF00}"
  193. #define LIGHT_YELLOW "{FFFFE0}"
  194. #define LEMON_CHIFFON "{FFFACD}"
  195. #define LIGHT_GOLDENROD_YELLOW "{FAFAD2}"
  196. #define PAPAYAWHIP "{FFEFD5}"
  197. #define MOCCASIN "{FFE4B5}"
  198. #define PEACHPUFF "{FFDAB9}"
  199. #define PALE_GOLDENROD "{EEE8AA}"
  200. #define KHAKI "{F0E68C}"
  201. #define DARK_KHAKI "{BDB76B}"
  202.  
  203. //different embeded color shades of Purple
  204. #define LAVENDER "{E6E6FA}"
  205. #define THISTLE "{D8BFD8}"
  206. #define PLUM "{DDA0DD}"
  207. #define VIOLET "{EE82EE}"
  208. #define ORCHID "{DA70D6}"
  209. #define FUCHSIA "{FF00FF}"
  210. #define MAGENTA "{FF00FF}"
  211. #define MEDIUM_ORCHID "{BA55D3}"
  212. #define MEDIUM_PURPLE "{9370DB}"
  213. #define AMETHYST "{9966CC}"
  214. #define BLUE_VIOLET "{8A2BE2}"
  215. #define DARK_VIOLET "{9400D3}"
  216. #define DARK_ORCHID "{9932CC}"
  217. #define DARK_MAGENTA "{8B008B}"
  218. #define PURPLE "{800080}"
  219. #define INDIGO "{4B0082}"
  220. #define SLATE_BLUE "{6A5ACD}"
  221. #define DARK_SLATE_BLUE "{483D8B}"
  222. #define MEDIUM_SLATEBLUE "{7B68EE}"
  223.  
  224. //different embeded color shades of Green
  225. #define GREEN_YELLOW "{ADFF2F}"
  226. #define CHARTREUSE "{7FFF00}"
  227. #define LAWN_GREEN "{7CFC00}"
  228. #define LIME "{00FF00}"
  229. #define LIME_GREEN "{32CD32}"
  230. #define PALE_GREEN "{98FB98}"
  231. #define LIGHT_GREEN "{90EE90}"
  232. #define MEDIUM_SPRING_GREEN "{00FA9A}"
  233. #define SPRING_GREEN "{00FF7F}"
  234. #define MEDIUM_SEA_GREEN "{3CB371}"
  235. #define SEA_GREEN "{2E8B57}"
  236. #define FOREST_GREEN "{228B22}"
  237. #define GREEN "{008000}"
  238. #define DARK_GREEN "{006400}"
  239. #define YELLOW_GREEN "{9ACD32}"
  240. #define OLIVED_RAB "{6B8E23}"
  241. #define OLIVE "{808000}"
  242. #define DARK_OLIVE_GREEN "{556B2F}"
  243. #define MEDIUM_AQUA_MARINE "{66CDAA}"
  244. #define DARK_SEA_GREEN "{8FBC8F}"
  245. #define LIGHT_SEA_GREEN "{20B2AA}"
  246. #define DARK_CYAN "{008B8B}"
  247. #define TEAL "{008080}"
  248.  
  249. //different embeded color shades of Blue/Cyan
  250. #define AQUA "{00FFFF}"
  251. #define CYAN "{00FFFF}"
  252. #define LIGHT_CYAN "{E0FFFF}"
  253. #define PALE_TURQUOISE "{AFEEEE}"
  254. #define AQUA_MARINE "{7FFFD4}"
  255. #define TURQUOISE "{40E0D0}"
  256. #define MEDIUM_TURQUOISE "{48D1CC}"
  257. #define DARK_TURQUOISE "{00CED1}"
  258. #define CADET_BLUE "{5F9EA0}"
  259. #define STEEL_BLUE "{4682B4}"
  260. #define LIGHT_STEEL_BLUE "{B0C4DE}"
  261. #define POWDER_BLUE "{B0E0E6}"
  262. #define LIGHT_BLUE "{A9C4E4}"
  263. #define SKY_BLUE "{87CEEB}"
  264. #define LIGHT_SKYBLUE "{87CEFA}"
  265. #define DEEP_SKY_BLUE "{00BFFF}"
  266. #define DODGER_BLUE "{1E90FF}"
  267. #define CORN_FLOWER_BLUE "{6495ED}"
  268. #define MEDIUMSLATE_BLUE "{7B68EE}"
  269. #define ROYAL_BLUE "{4169E1}"
  270. #define BLUE "{0000FF}"
  271. #define MEDIUM_BLUE "{0000CD}"
  272. #define DARK_BLUE "{00008B}"
  273. #define NAVY "{000080}"
  274. #define MIDNIGHT_BLUE "{191970}"
  275.  
  276. //different embeded color shades of Brown
  277. #define CORN_SILK "{FFF8DC}"
  278. #define BLANCHED_ALMOND "{FFEBCD}"
  279. #define BISQUE "{FFE4C4}"
  280. #define NAVAJO_WHITE "{FFDEAD}"
  281. #define WHEAT "{F5DEB3}"
  282. #define BURLY_WOOD "{DEB887}"
  283. #define TAN "{D2B48C}"
  284. #define ROSY_BROWN "{BC8F8F}"
  285. #define SANDY_BROWN "{F4A460}"
  286. #define DARK_GOLDENROD "{B8860B}"
  287. #define PERU "{CD853F}"
  288. #define SADDLE_BROWN "{8B4513}"
  289. #define SIENNA "{A0522D}"
  290. #define BROWN "{A52A2A}"
  291. #define MAROON "{800000}"
  292.  
  293. //different embeded color shades of Grey
  294. #define WHITE "{FFFFFF}"
  295. #define GAINSBORO "{DCDCDC}"
  296. #define LIGHT_GREY "{D3D3D3}"
  297. #define SILVER "{C0C0C0}"
  298. #define DARK_GRAY "{A9A9A9}"
  299. #define GRAY "{808080}"
  300. #define DIM_GRAY "{696969}"
  301. #define LIGHT_SLATE_GRAY "{778899}"
  302. #define SLATE_GRAY "{708090}"
  303. #define DARK_SLATE_GRAY "{2F4F4F}"
  304. #define BLACK "{000000}"
  305.  
  306. //HEX colors
  307. //different color shades of red
  308. #define COLOR_INDIAN_RED 0xCD5C5CFF
  309. #define COLOR_LIGHT_CORAL 0xF08080FF
  310. #define COLOR_SALMON 0xFA8072FF
  311. #define COLOR_DARK_SALMON 0xE9967AFF
  312. #define COLOR_LIGHT_SALMON 0xFFA07AFF
  313. #define COLOR_CRIMSON 0xDC143CFF
  314. #define COLOR_RED 0xFF0000FF
  315. #define COLOR_FIREBRICK 0xB22222FF
  316. #define COLOR_DARK_RED 0x8B0000FF
  317.  
  318. //different color shades of pink
  319. #define COLOR_PINK 0xFFC0CBFF
  320. #define COLOR_LIGHT_PINK 0xFFB6C1FF
  321. #define COLOR_HOT_PINK 0xFF69B4FF
  322. #define COLOR_DEEP_PINK 0xFF1493FF
  323. #define COLOR_MEDIUM_VIOLET_RED 0xC71585FF
  324. #define COLOR_PALE_VIOLET_RED 0xDB7093FF
  325.  
  326. //different color shades of Orange
  327. #define COLOR_CORAL 0xFF7F50FF
  328. #define COLOR_TOMATO 0xFF6347FF
  329. #define COLOR_ORANGE_RED 0xFF4500FF
  330. #define COLOR_DARK_ORANGE 0xFF8C00FF
  331. #define COLOR_ORANGE 0xFFA500FF
  332.  
  333. //different color shades of Yellow
  334. #define COLOR_GOLD 0xFFD700FF
  335. #define COLOR_YELLOW 0xFFFF00FF
  336. #define COLOR_LIGHT_YELLOW 0xFFFFE0FF
  337. #define COLOR_LEMON_CHIFFON 0xFFFACDFF
  338. #define COLOR_LIGHT_GOLDENROD_YELLOW 0xFAFAD2FF
  339. #define COLOR_PAPAYAWHIP 0xFFEFD5FF
  340. #define COLOR_MOCCASIN 0xFFE4B5FF
  341. #define COLOR_PEACHPUFF 0xFFDAB9FF
  342. #define COLOR_PALE_GOLDENROD 0xEEE8AAFF
  343. #define COLOR_KHAKI 0xF0E68CFF
  344. #define COLOR_DARK_KHAKI 0xBDB76BFF
  345.  
  346. //different color shades of Purple
  347. #define COLOR_LAVENDER 0xE6E6FAFF
  348. #define COLOR_THISTLE 0xD8BFD8FF
  349. #define COLOR_PLUM 0xDDA0DDFF
  350. #define COLOR_VIOLET 0xEE82EEFF
  351. #define COLOR_ORCHID 0xDA70D6FF
  352. #define COLOR_FUCHSIA 0xFF00FFFF
  353. #define COLOR_MAGENTA 0xFF00FFFF
  354. #define COLOR_MEDIUM_ORCHID 0xBA55D3FF
  355. #define COLOR_MEDIUM_PURPLE 0x9370DBFF
  356. #define COLOR_AMETHYST 0x9966CCFF
  357. #define COLOR_BLUE_VIOLET 0x8A2BE2FF
  358. #define COLOR_DARK_VIOLET 0x9400D3FF
  359. #define COLOR_DARK_ORCHID 0x9932CCFF
  360. #define COLOR_DARK_MAGENTA 0x8B008BFF
  361. #define COLOR_PURPLE 0x800080FF
  362. #define COLOR_INDIGO 0x4B0082FF
  363. #define COLOR_SLATE_BLUE 0x6A5ACDFF
  364. #define COLOR_DARK_SLATE_BLUE 0x483D8BFF
  365. #define COLOR_MEDIUM_SLATEBLUE 0x7B68EEFF
  366.  
  367. //different color shades of Green
  368. #define COLOR_GREEN_YELLOW 0xADFF2FFF
  369. #define COLOR_CHARTREUSE 0x7FFF00FF
  370. #define COLOR_LAWN_GREEN 0x7CFC00FF
  371. #define COLOR_LIME 0x00FF00FF
  372. #define COLOR_LIME_GREEN 0x32CD32FF
  373. #define COLOR_PALE_GREEN 0x98FB98FF
  374. #define COLOR_LIGHT_GREEN 0x90EE90FF
  375. #define COLOR_MEDIUM_SPRING_GREEN 0x00FA9AFF
  376. #define COLOR_SPRING_GREEN 0x00FF7FFF
  377. #define COLOR_MEDIUM_SEA_GREEN 0x3CB371FF
  378. #define COLOR_SEA_GREEN 0x2E8B57FF
  379. #define COLOR_FOREST_GREEN 0x228B22FF
  380. #define COLOR_GREEN 0x008000FF
  381. #define COLOR_DARK_GREEN 0x006400FF
  382. #define COLOR_YELLOW_GREEN 0x9ACD32FF
  383. #define COLOR_OLIVED_RAB 0x6B8E23FF
  384. #define COLOR_OLIVE 0x808000FF
  385. #define COLOR_DARK_OLIVE_GREEN 0x556B2FFF
  386. #define COLOR_MEDIUM_AQUA_MARINE 0x66CDAAFF
  387. #define COLOR_DARK_SEA_GREEN 0x8FBC8FFF
  388. #define COLOR_LIGHT_SEA_GREEN 0x20B2AAFF
  389. #define COLOR_DARK_CYAN 0x008B8BFF
  390. #define COLOR_TEAL 0x008080FF
  391.  
  392. //different color shades of Blue/Cyan
  393. #define COLOR_AQUA 0x00FFFFFF
  394. #define COLOR_CYAN 0x00FFFFFF
  395. #define COLOR_LIGHT_CYAN 0xE0FFFFFF
  396. #define COLOR_PALE_TURQUOISE 0xAFEEEEFF
  397. #define COLOR_AQUA_MARINE 0x7FFFD4FF
  398. #define COLOR_TURQUOISE 0x40E0D0FF
  399. #define COLOR_MEDIUM_TURQUOISE 0x48D1CC
  400. #define COLOR_DARK_TURQUOISE 0x00CED1FF
  401. #define COLOR_CADET_BLUE 0x5F9EA0FF
  402. #define COLOR_STEEL_BLUE 0x4682B4FF
  403. #define COLOR_LIGHT_STEEL_BLUE 0xB0C4DEFF
  404. #define COLOR_POWDER_BLUE 0xB0E0E6FF
  405. #define COLOR_LIGHT_BLUE 0xA9C4E4FF
  406. #define COLOR_SKY_BLUE 0x87CEEBFF
  407. #define COLOR_LIGHT_SKYBLUE 0x87CEFAFF
  408. #define COLOR_DEEP_SKY_BLUE 0x00BFFFFF
  409. #define COLOR_DODGER_BLUE 0x1E90FFFF
  410. #define COLOR_CORN_FLOWER_BLUE 0x6495EDFF
  411. #define COLOR_MEDIUMSLATE_BLUE 0x7B68EEFF
  412. #define COLOR_ROYAL_BLUE 0x4169E1FF
  413. #define COLOR_BLUE 0x0000FFFF
  414. #define COLOR_MEDIUM_BLUE 0x0000CDFF
  415. #define COLOR_DARK_BLUE 0x00008BFF
  416. #define COLOR_NAVY 0x000080FF
  417. #define COLOR_MIDNIGHT_BLUE 0x191970FF
  418.  
  419. //different color shades of Brown
  420. #define COLOR_CORN_SILK 0xFFF8DCFF
  421. #define COLOR_BLANCHED_ALMOND 0xFFEBCDFF
  422. #define COLOR_BISQUE 0xFFE4C4FF
  423. #define COLOR_NAVAJO_WHITE 0xFFDEADFF
  424. #define COLOR_WHEAT 0xF5DEB3FF
  425. #define COLOR_BURLY_WOOD 0xDEB887FF
  426. #define COLOR_TAN 0xD2B48CFF
  427. #define COLOR_ROSY_BROWN 0xBC8F8FFF
  428. #define COLOR_SANDY_BROWN 0xF4A460FF
  429. #define COLOR_DARK_GOLDENROD 0xB8860BFF
  430. #define COLOR_PERU 0xCD853FFF
  431. #define COLOR_SADDLE_BROWN 0x8B4513FF
  432. #define COLOR_SIENNA 0xA0522DFF
  433. #define COLOR_BROWN 0xA52A2AFF
  434. #define COLOR_MAROON 0x800000FF
  435.  
  436. //different color shades of Grey
  437. #define COLOR_WHITE 0xFFFFFFFF
  438. #define COLOR_GAINSBORO 0xDCDCDCFF
  439. #define COLOR_LIGHT_GREY 0xD3D3D3FF
  440. #define COLOR_SILVER 0xC0C0C0FF
  441. #define COLOR_DARK_GRAY 0xA9A9A9FF
  442. #define COLOR_GRAY 0x808080FF
  443. #define COLOR_DIM_GRAY 0x696969FF
  444. #define COLOR_LIGHT_SLATE_GRAY 0x778899FF
  445. #define COLOR_SLATE_GRAY 0x708090FF
  446. #define COLOR_DARK_SLATE_GRAY 0x2F4F4FFF
  447. #define COLOR_BLACK 0x000000FF
Advertisement
Add Comment
Please, Sign In to add comment