Guest User

rColorPicker v0.1

a guest
Aug 20th, 2012
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 12.04 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new PlayerText:gCol[MAX_PLAYERS][26];
  4.  
  5. new PlayerColors[204] =
  6. {
  7. 0xFF8C13AA,0xC715FFAA,0x20B2AAAA,0xDC143CAA,0x6495EDAA,0xf0e68cAA,0x778899AA,0xFF1493AA,0xF4A460AA,
  8. 0xEE82EEAA,0xFFD720AA,0x8b4513AA,0x4949A0AA,0x148b8bAA,0x14ff7fAA,0x556b2fAA,0x0FD9FAAA,0x10DC29AA,
  9. 0x534081AA,0x0495CDAA,0xEF6CE8AA,0xBD34DAAA,0x247C1BAA,0x0C8E5DAA,0x635B03AA,0xCB7ED3AA,0x65ADEBAA,
  10. 0x5C1ACCAA,0xF2F853AA,0x11F891AA,0x7B39AAAA,0x53EB10AA,0x54137DAA,0x275222AA,0xF09F5BAA,0x3D0A4FAA,
  11. 0x22F767AA,0xD63034AA,0x9A6980AA,0xDFB935AA,0x3793FAAA,0x90239DAA,0xE9AB2FAA,0xAF2FF3AA,0x057F94AA,
  12. 0xB98519AA,0x388EEAAA,0x028151AA,0xA55043AA,0x0DE018AA,0x93AB1CAA,0x95BAF0AA,0x369976AA,0x18F71FAA,
  13. 0x4B8987AA,0x491B9EAA,0x829DC7AA,0xBCE635AA,0xCEA6DFAA,0x20D4ADAA,0x2D74FDAA,0x3C1C0DAA,0x12D6D4AA,
  14. 0x48C000AA,0x2A51E2AA,0xE3AC12AA,0xFC42A8AA,0x2FC827AA,0x1A30BFAA,0xB740C2AA,0x42ACF5AA,0x2FD9DEAA,
  15. 0xFAFB71AA,0x05D1CDAA,0xC471BDAA,0x94436EAA,0xC1F7ECAA,0xCE79EEAA,0xBD1EF2AA,0x93B7E4AA,0x3214AAAA,
  16. 0x184D3BAA,0xAE4B99AA,0x7E49D7AA,0x4C436EAA,0xFA24CCAA,0xCE76BEAA,0xA04E0AAA,0x9F945CAA,0xDCDE3DAA,
  17. 0x10C9C5AA,0x70524DAA,0x0BE472AA,0x8A2CD7AA,0x6152C2AA,0xCF72A9AA,0xE59338AA,0xEEDC2DAA,0xD8C762AA,
  18. 0xD8C762AA,0xFF8C13AA,0xC715FFAA,0x20B2AAAA,0xDC143CAA,0x6495EDAA,0xf0e68cAA,0x778899AA,0xFF1493AA,
  19. 0xF4A460AA,0xEE82EEAA,0xFFD720AA,0x8b4513AA,0x4949A0AA,0x148b8bAA,0x14ff7fAA,0x556b2fAA,0x0FD9FAAA,
  20. 0x10DC29AA,0x534081AA,0x0495CDAA,0xEF6CE8AA,0xBD34DAAA,0x247C1BAA,0x0C8E5DAA,0x635B03AA,0xCB7ED3AA,
  21. 0x65ADEBAA,0x5C1ACCAA,0xF2F853AA,0x11F891AA,0x7B39AAAA,0x53EB10AA,0x54137DAA,0x275222AA,0xF09F5BAA,
  22. 0x3D0A4FAA,0x22F767AA,0xD63034AA,0x9A6980AA,0xDFB935AA,0x3793FAAA,0x90239DAA,0xE9AB2FAA,0xAF2FF3AA,
  23. 0x057F94AA,0xB98519AA,0x388EEAAA,0x028151AA,0xA55043AA,0x0DE018AA,0x93AB1CAA,0x95BAF0AA,0x369976AA,
  24. 0x18F71FAA,0x4B8987AA,0x491B9EAA,0x829DC7AA,0xBCE635AA,0xCEA6DFAA,0x20D4ADAA,0x2D74FDAA,0x3C1C0DAA,
  25. 0x12D6D4AA,0x48C000AA,0x2A51E2AA,0xE3AC12AA,0xFC42A8AA,0x2FC827AA,0x1A30BFAA,0xB740C2AA,0x42ACF5AA,
  26. 0x2FD9DEAA,0xFAFB71AA,0x05D1CDAA,0xC471BDAA,0x94436EAA,0xC1F7ECAA,0xCE79EEAA,0xBD1EF2AA,0x93B7E4AA,
  27. 0x3214AAAA,0x184D3BAA,0xAE4B99AA,0x7E49D7AA,0x4C436EAA,0xFA24CCAA,0xCE76BEAA,0xA04E0AAA,0x9F945CAA,
  28. 0xDCDE3DAA,0x10C9C5AA,0x70524DAA,0x0BE472AA,0x8A2CD7AA,0x6152C2AA,0xCF72A9AA,0xE59338AA,0xEEDC2DAA,
  29. 0xD8C762AA,0xD8C762AA,0xA2FF00AA,0xFFA600AA,0xFF00AEAA,0xBF00FFAA
  30. };
  31.  
  32.  
  33.  
  34. /*==============================Callbacks=====================================*/
  35.  
  36. public OnFilterScriptInit()
  37. {
  38.     print("--------------------------------------");
  39.     print(" Loaded Player Color Picker || rColor v0.1 || by [DoD]Ron");
  40.     print("--------------------------------------");
  41.     for(new x=0; x<MAX_PLAYERS; x++)
  42.          if(IsPlayerConnected(x)) CreateColorTexts(x);
  43.     return 1;
  44. }
  45. public OnFilterScriptExit()
  46. {
  47.     for(new x=0; x<MAX_PLAYERS; x++)
  48.          if(IsPlayerConnected(x))
  49.          if(GetPVarInt(x,"r_Col"))
  50.          {
  51.            CancelSelectTextDraw(x);
  52.            DeletePVar(x,"r_Col");
  53.            for(new y=0; y<26; y++) PlayerTextDrawDestroy(x,gCol[x][y]);
  54.          }
  55. }
  56.  
  57. public OnPlayerCommandText(playerid, cmdtext[])
  58. {
  59.     if(!strcmp(cmdtext, "/rcolor", true))
  60.     {
  61.        SetPVarInt(playerid,"r_Col",1);
  62.        ShowColors(playerid);
  63.        return 1;
  64.     }
  65.     return 0;
  66. }
  67.  
  68.  
  69. public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
  70. {
  71.   if(_:playertextid != INVALID_TEXT_DRAW)
  72.   {
  73.     new f;
  74.     if(playertextid == gCol[playerid][20]) SetPVarInt(playerid,"r_Col",5),ShowColors(playerid);
  75.     else if(playertextid == gCol[playerid][22]) SetPVarInt(playerid,"r_Col",4),ShowColors(playerid);
  76.     else if(playertextid == gCol[playerid][25]) SetPVarInt(playerid,"r_Col",3),ShowColors(playerid);
  77.     else if(playertextid == gCol[playerid][24]) SetPVarInt(playerid,"r_Col",2),ShowColors(playerid);
  78.     else if(playertextid == gCol[playerid][21]) SetPVarInt(playerid,"r_Col",1),ShowColors(playerid);
  79.     else
  80.     {
  81.       for(new x=3; x<20; x++)
  82.       {
  83.        if(playertextid == gCol[playerid][x])
  84.        {
  85.         new rCol = 20*(GetPVarInt(playerid,"r_Col")-1)+f;
  86.         SetPlayerColor(playerid,PlayerColors[rCol]);
  87.         for(new y=0; y<26; y++) PlayerTextDrawHide(playerid,gCol[playerid][y]);
  88.         new str[128];
  89.  
  90.         format(str,sizeof(str)," -rColors- {94DBE3}You color has been changed to {%06x}||||||||||||||",(GetPlayerColor(playerid) >>> 8));
  91.         SendClientMessage(playerid,0x03E6FF3FF,str);
  92.  
  93.         CancelSelectTextDraw(playerid);
  94.         DeletePVar(playerid,"r_Col");
  95.         break;
  96.        }
  97.        else f++;
  98.       }
  99.     }
  100.   }
  101.   return 1;
  102. }
  103.  
  104. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  105. {
  106.   if(_:clickedid == INVALID_TEXT_DRAW)
  107.   {
  108.         if(GetPVarInt(playerid,"r_Col"))
  109.         {
  110.             for(new x=0; x<26; x++)
  111.             {
  112.                     PlayerTextDrawHide(playerid,gCol[playerid][x]);
  113.             }
  114.             DeletePVar(playerid,"r_Col");
  115.         }
  116.   }
  117.   return 1;
  118. }
  119.  
  120. public OnPlayerConnect(playerid)
  121. {
  122.     CreateColorTexts(playerid);
  123.     return 1;
  124. }
  125. public OnPlayerDisconnect(playerid,reason)
  126. {
  127.    for(new y=0; y<26; y++) PlayerTextDrawDestroy(playerid,gCol[playerid][y]);
  128.    return 1;
  129. }
  130.  
  131. /*==============================Stocks=====================================*/
  132.  
  133. stock CreateColorTexts(playerid)
  134. {
  135.     gCol[playerid][0] = CreatePlayerTextDraw(playerid,166.000000, 13.000000, "-");
  136.     PlayerTextDrawBackgroundColor(playerid,gCol[playerid][0], 255);
  137.     PlayerTextDrawFont(playerid,gCol[playerid][0], 1);
  138.     PlayerTextDrawLetterSize(playerid,gCol[playerid][0], 19.399997, 30.299995);
  139.     PlayerTextDrawColor(playerid,gCol[playerid][0], -1);
  140.     PlayerTextDrawSetOutline(playerid,gCol[playerid][0], 0);
  141.     PlayerTextDrawSetProportional(playerid,gCol[playerid][0], 1);
  142.     PlayerTextDrawSetShadow(playerid,gCol[playerid][0], 1);
  143.  
  144.     gCol[playerid][1] = CreatePlayerTextDraw(playerid,252.000000, 164.000000, "~r~~h~C~h~o~h~l~h~o~r~r ~b~l~g~i~y~s~p~t");
  145.     PlayerTextDrawBackgroundColor(playerid,gCol[playerid][1], 255);
  146.     PlayerTextDrawFont(playerid,gCol[playerid][1], 3);
  147.     PlayerTextDrawLetterSize(playerid,gCol[playerid][1], 0.490000, 2.199999);
  148.     PlayerTextDrawColor(playerid,gCol[playerid][1], -1);
  149.     PlayerTextDrawSetOutline(playerid,gCol[playerid][1], 1);
  150.     PlayerTextDrawSetProportional(playerid,gCol[playerid][1], 1);
  151.  
  152.     gCol[playerid][2] = CreatePlayerTextDraw(playerid,305.000000, 186.000000, "_");
  153.     PlayerTextDrawAlignment(playerid,gCol[playerid][2], 2);
  154.     PlayerTextDrawBackgroundColor(playerid,gCol[playerid][2], 255);
  155.     PlayerTextDrawFont(playerid,gCol[playerid][2], 1);
  156.     PlayerTextDrawLetterSize(playerid,gCol[playerid][2], 1.029999, 10.699993);
  157.     PlayerTextDrawColor(playerid,gCol[playerid][2], -1);
  158.     PlayerTextDrawSetOutline(playerid,gCol[playerid][2], 0);
  159.     PlayerTextDrawSetProportional(playerid,gCol[playerid][2], 1);
  160.     PlayerTextDrawSetShadow(playerid,gCol[playerid][2], 1);
  161.     PlayerTextDrawUseBox(playerid,gCol[playerid][2], 1);
  162.     PlayerTextDrawBoxColor(playerid,gCol[playerid][2], 255);
  163.     PlayerTextDrawTextSize(playerid,gCol[playerid][2], 130.000000, 323.000000);
  164.  
  165.     new Float:var=189.0;
  166.     for(new l=3; l<20; l++)
  167.     {
  168.         gCol[playerid][l] = CreatePlayerTextDraw(playerid,305.000000, var, "_");
  169.         PlayerTextDrawAlignment(playerid,gCol[playerid][l], 2);
  170.         PlayerTextDrawBackgroundColor(playerid,gCol[playerid][l], 255);
  171.         PlayerTextDrawFont(playerid,gCol[playerid][l], 1);
  172.         PlayerTextDrawLetterSize(playerid,gCol[playerid][l], 1.019999, 0.040001);
  173.         PlayerTextDrawColor(playerid,gCol[playerid][l], -1);
  174.         PlayerTextDrawSetOutline(playerid,gCol[playerid][l], 0);
  175.         PlayerTextDrawSetProportional(playerid,gCol[playerid][l], 1);
  176.         PlayerTextDrawSetShadow(playerid,gCol[playerid][l], 1);
  177.         PlayerTextDrawUseBox(playerid,gCol[playerid][l], 1);
  178.         PlayerTextDrawBoxColor(playerid,gCol[playerid][l], 255);
  179.         PlayerTextDrawTextSize(playerid,gCol[playerid][l], 103.000000, 309.000000);
  180.         PlayerTextDrawSetSelectable(playerid,gCol[playerid][l],1);
  181.         var+=5.0;
  182.     }
  183.  
  184.     gCol[playerid][20] = CreatePlayerTextDraw(playerid,196.000000, 275.000000, "5");
  185.     PlayerTextDrawBackgroundColor(playerid,gCol[playerid][20], 255);
  186.     PlayerTextDrawFont(playerid,gCol[playerid][20], 1);
  187.     PlayerTextDrawLetterSize(playerid,gCol[playerid][20], 0.310000, 0.699999);
  188.     PlayerTextDrawColor(playerid,gCol[playerid][20], -1);
  189.     PlayerTextDrawSetOutline(playerid,gCol[playerid][20], 0);
  190.     PlayerTextDrawSetProportional(playerid,gCol[playerid][20], 1);
  191.     PlayerTextDrawSetShadow(playerid,gCol[playerid][20], 1);
  192.     PlayerTextDrawUseBox(playerid,gCol[playerid][20], 1);
  193.     PlayerTextDrawTextSize(playerid,gCol[playerid][20], 156.000000, 4.000000);
  194.     PlayerTextDrawUseBox(playerid,gCol[playerid][20], 1);
  195.     PlayerTextDrawBoxColor(playerid,gCol[playerid][20], 0);
  196.     PlayerTextDrawTextSize(playerid,gCol[playerid][20], 203.000000, 20.000000);
  197.     PlayerTextDrawSetSelectable(playerid,gCol[playerid][20],1);
  198.  
  199.     gCol[playerid][21] = CreatePlayerTextDraw(playerid,150.000000, 275.000000, "1");
  200.     PlayerTextDrawBackgroundColor(playerid,gCol[playerid][21], 255);
  201.     PlayerTextDrawFont(playerid,gCol[playerid][21], 1);
  202.     PlayerTextDrawLetterSize(playerid,gCol[playerid][21], 0.310000, 0.699999);
  203.     PlayerTextDrawColor(playerid,gCol[playerid][21], -1);
  204.     PlayerTextDrawSetOutline(playerid,gCol[playerid][21], 0);
  205.     PlayerTextDrawSetProportional(playerid,gCol[playerid][21], 1);
  206.     PlayerTextDrawSetShadow(playerid,gCol[playerid][21], 1);
  207.     PlayerTextDrawUseBox(playerid,gCol[playerid][21], 1);
  208.     PlayerTextDrawBoxColor(playerid,gCol[playerid][21], 0);
  209.     PlayerTextDrawTextSize(playerid,gCol[playerid][21], 156.000000, 20.000000);
  210.     PlayerTextDrawSetSelectable(playerid,gCol[playerid][21],1);
  211.  
  212.     gCol[playerid][24] = CreatePlayerTextDraw(playerid,161.000000, 275.000000, "2");
  213.     PlayerTextDrawBackgroundColor(playerid,gCol[playerid][24], 255);
  214.     PlayerTextDrawFont(playerid,gCol[playerid][24], 1);
  215.     PlayerTextDrawLetterSize(playerid,gCol[playerid][24], 0.310000, 0.699999);
  216.     PlayerTextDrawColor(playerid,gCol[playerid][24], -1);
  217.     PlayerTextDrawSetOutline(playerid,gCol[playerid][24], 0);
  218.     PlayerTextDrawSetProportional(playerid,gCol[playerid][24], 1);
  219.     PlayerTextDrawSetShadow(playerid,gCol[playerid][24], 1);
  220.     PlayerTextDrawUseBox(playerid,gCol[playerid][24], 1);
  221.     PlayerTextDrawBoxColor(playerid,gCol[playerid][24], 0);
  222.     PlayerTextDrawTextSize(playerid,gCol[playerid][24], 168.000000, 20.000000);
  223.     PlayerTextDrawSetSelectable(playerid,gCol[playerid][24],1);
  224.  
  225.     gCol[playerid][25] = CreatePlayerTextDraw(playerid,173.000000, 275.000000, "3");
  226.     PlayerTextDrawBackgroundColor(playerid,gCol[playerid][25], 255);
  227.     PlayerTextDrawFont(playerid,gCol[playerid][25], 1);
  228.     PlayerTextDrawLetterSize(playerid,gCol[playerid][25], 0.310000, 0.699999);
  229.     PlayerTextDrawColor(playerid,gCol[playerid][25], -1);
  230.     PlayerTextDrawSetOutline(playerid,gCol[playerid][25], 0);
  231.     PlayerTextDrawSetProportional(playerid,gCol[playerid][25], 1);
  232.     PlayerTextDrawSetShadow(playerid,gCol[playerid][25], 1);
  233.     PlayerTextDrawUseBox(playerid,gCol[playerid][25], 1);
  234.     PlayerTextDrawBoxColor(playerid,gCol[playerid][25], 0);
  235.     PlayerTextDrawTextSize(playerid,gCol[playerid][25], 180.000000, 20.000000);
  236.     PlayerTextDrawSetSelectable(playerid,gCol[playerid][25],1);
  237.  
  238.     gCol[playerid][22] = CreatePlayerTextDraw(playerid,184.000000, 275.000000, "4");
  239.     PlayerTextDrawBackgroundColor(playerid,gCol[playerid][22], 255);
  240.     PlayerTextDrawFont(playerid,gCol[playerid][22], 1);
  241.     PlayerTextDrawLetterSize(playerid,gCol[playerid][22], 0.310000, 0.699999);
  242.     PlayerTextDrawColor(playerid,gCol[playerid][22], -1);
  243.     PlayerTextDrawSetOutline(playerid,gCol[playerid][22], 0);
  244.     PlayerTextDrawSetProportional(playerid,gCol[playerid][22], 1);
  245.     PlayerTextDrawSetShadow(playerid,gCol[playerid][22], 1);
  246.     PlayerTextDrawUseBox(playerid,gCol[playerid][22], 1);
  247.     PlayerTextDrawBoxColor(playerid,gCol[playerid][22], 0);
  248.     PlayerTextDrawTextSize(playerid,gCol[playerid][22], 191.000000, 20.000000);
  249.     PlayerTextDrawSetSelectable(playerid,gCol[playerid][22],1);
  250. }
  251. stock ShowColors(playerid)
  252. {
  253.   new f=(GetPVarInt(playerid,"r_Col")-1)*20;
  254.   for(new x=0; x<26; x++)
  255.   {
  256.      if(x > 2 && x<20)
  257.      {
  258.       PlayerTextDrawBoxColor(playerid, gCol[playerid][x],PlayerColors[f]);
  259.       f++;
  260.      }
  261.      PlayerTextDrawShow(playerid,gCol[playerid][x]);
  262.   }
  263.   SelectTextDraw(playerid,0xE01B1BCC);
  264. }
Advertisement
Add Comment
Please, Sign In to add comment