Guest User

Jake's Efficient Color Changer v1.0

a guest
Aug 4th, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.69 KB | None | 0 0
  1. /*
  2. This script is included in my very first "Jake EvoLuTioN 2013 scripts" album
  3. The album might release soon containing my very very popular from my previous script
  4. JakAdmin v2.8. This script is under Jake Production script.
  5.  
  6. Jake's Efficient Color Changer
  7. ----------
  8. Ability to change color without using a command with just a key!
  9. Author: Jake, Zeex
  10.  
  11. - Part of Jake EvoLuTioN 2013 script - (c) 2013 August
  12.  
  13. Changelogs v1.0:
  14.  
  15. • Default colors 8!
  16. • Can browse colors without dialog or commands, Just uses with Key!
  17. • 2 commands to do the browsing:
  18.     /browsecolor - Browses color and the key takes the action in selecting, and choosing!
  19.     /stopbrowsec - Stops browsing the color. Returns back to normal color
  20. • Additional 1 command:
  21.     /helpbrowsec
  22. */
  23.  
  24. #include <a_samp>
  25. #include <zcmd>
  26.  
  27. new
  28.     bool:ChoosingColor[MAX_PLAYERS] = false,
  29.     CurrentCol[MAX_PLAYERS] = -1
  30. ;
  31.  
  32. public OnFilterScriptInit()
  33. {
  34.     print("\n");
  35.     print("*** Jake Script Production Exclusive ***");
  36.     print("ECHO: Presents");
  37.     SetTimer("SendPrint", 1200, 0);
  38.     return 1;
  39. }
  40.  
  41. forward SendPrint();
  42. public SendPrint()
  43. {
  44.     print("Jake's Efficient Color Changer");
  45.     print("Ability to change color without using a command with just a key!");
  46.     print("Copyrights - 2013 (August)");
  47.     print("Author: Jake, Zeex for zcmd");
  48.     print("Idea from C Fast Color Changer");
  49.     print("\n");
  50. }
  51.  
  52. public OnPlayerConnect(playerid)
  53. {
  54.     if(ChoosingColor[playerid] == true)
  55.     {
  56.         ChoosingColor[playerid] = false;
  57.         CurrentCol[playerid] = -1;
  58.     }
  59.     return 1;
  60. }
  61.  
  62. public OnPlayerDisconnect(playerid, reason)
  63. {
  64.     if(ChoosingColor[playerid] == true)
  65.     {
  66.         ChoosingColor[playerid] = false;
  67.         CurrentCol[playerid] = -1;
  68.     }
  69.     return 1;
  70. }
  71.  
  72. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  73. {
  74.     if(ChoosingColor[playerid] == true)
  75.     {
  76.         if(newkeys == KEY_YES)
  77.         {
  78.             CurrentCol[playerid]++;
  79.             if(CurrentCol[playerid] == 0)
  80.             {
  81.                 SetPlayerColor(playerid, 0xFFFF00AA);
  82.                 GameTextForPlayer(playerid, "~w~Color: ~y~Yellow~n~~w~Color ID: 1", 2000, 3);
  83.             }
  84.             else if(CurrentCol[playerid] == 1)
  85.             {
  86.                 SetPlayerColor(playerid, 0x33CC33C8);
  87.                 GameTextForPlayer(playerid, "~w~Color: ~g~Green~n~~w~Color ID: 2", 2000, 3);
  88.             }
  89.             else if(CurrentCol[playerid] == 2)
  90.             {
  91.                 SetPlayerColor(playerid, 0xFF8000C8);
  92.                 GameTextForPlayer(playerid, "~w~Color: Orange~n~~w~Color ID: 3", 2000, 3);
  93.             }
  94.             else if(CurrentCol[playerid] == 3)
  95.             {
  96.                 SetPlayerColor(playerid, 0xFFFFFFFF);
  97.                 GameTextForPlayer(playerid, "~w~Color: White~n~Color ID: 4", 2000, 3);
  98.             }
  99.             else if(CurrentCol[playerid] == 4)
  100.             {
  101.                 SetPlayerColor(playerid, 0x0080FFC8);
  102.                 GameTextForPlayer(playerid, "~w~Color: ~b~Blue~n~~w~Color ID: 5", 2000, 3);
  103.             }
  104.             else if(CurrentCol[playerid] == 5)
  105.             {
  106.                 SetPlayerColor(playerid, 0xFF80FFFF);
  107.                 GameTextForPlayer(playerid, "~w~Color: ~r~~h~~h~~h~~h~Pink~n~~w~Color ID: 6", 2000, 3);
  108.             }
  109.             else if(CurrentCol[playerid] == 6)
  110.             {
  111.                 SetPlayerColor(playerid, 0xA52A2AAA);
  112.                 GameTextForPlayer(playerid, "~w~Color: Brown~n~~w~Color ID: 7", 2000, 3);
  113.             }
  114.             else if(CurrentCol[playerid] == 7)
  115.             {
  116.                 SetPlayerColor(playerid, 0x2C2727AA);
  117.                 GameTextForPlayer(playerid, "~w~Color: ~l~Black~n~~w~Color ID: 8", 2000, 3);
  118.             }
  119.             else if(CurrentCol[playerid] == 8)
  120.             {
  121.                 SetPlayerColor(playerid, 0xFF0000C8);
  122.                 GameTextForPlayer(playerid, "~w~Color: ~r~Red~n~~w~Color ID: 9", 2000, 3);
  123.             }
  124.             else if(CurrentCol[playerid] >= 9)
  125.             {
  126.                 GameTextForPlayer(playerid, "~r~No more colors available!~n~~w~Only ~y~8 ~w~colors!~n~~w~To move back press ~r~N", 4000, 3);
  127.             }
  128.         }
  129.         else if(newkeys == KEY_NO)
  130.         {
  131.             CurrentCol[playerid]--;
  132.             if(CurrentCol[playerid] == 0)
  133.             {
  134.                 SetPlayerColor(playerid, 0xFFFF00AA);
  135.                 GameTextForPlayer(playerid, "~w~Color: ~y~Yellow~n~~w~Color ID: 1", 2000, 3);
  136.             }
  137.             else if(CurrentCol[playerid] == 1)
  138.             {
  139.                 SetPlayerColor(playerid, 0x33CC33C8);
  140.                 GameTextForPlayer(playerid, "~w~Color: ~g~Green~n~~w~Color ID: 2", 2000, 3);
  141.             }
  142.             else if(CurrentCol[playerid] == 2)
  143.             {
  144.                 SetPlayerColor(playerid, 0xFF8000C8);
  145.                 GameTextForPlayer(playerid, "~w~Color: Orange~n~Color ID: 3", 2000, 3);
  146.             }
  147.             else if(CurrentCol[playerid] == 3)
  148.             {
  149.                 SetPlayerColor(playerid, 0xFFFFFFFF);
  150.                 GameTextForPlayer(playerid, "~w~Color: White~n~~w~Color ID: 4", 2000, 3);
  151.             }
  152.             else if(CurrentCol[playerid] == 4)
  153.             {
  154.                 SetPlayerColor(playerid, 0x0080FFC8);
  155.                 GameTextForPlayer(playerid, "~w~Color: ~b~Blue~n~~w~Color ID: 5", 2000, 3);
  156.             }
  157.             else if(CurrentCol[playerid] == 5)
  158.             {
  159.                 SetPlayerColor(playerid, 0xFF80FFFF);
  160.                 GameTextForPlayer(playerid, "~w~Color: ~r~~h~~h~~h~~h~~h~Pink~n~~w~Color ID: 6", 2000, 3);
  161.             }
  162.             else if(CurrentCol[playerid] == 6)
  163.             {
  164.                 SetPlayerColor(playerid, 0xA52A2AAA);
  165.                 GameTextForPlayer(playerid, "~w~Color: Brown~n~Color ID: 7", 2000, 3);
  166.             }
  167.             else if(CurrentCol[playerid] == 7)
  168.             {
  169.                 SetPlayerColor(playerid, 0x2C2727AA);
  170.                 GameTextForPlayer(playerid, "~w~Color: ~l~Black~n~~w~Color ID: 8", 2000, 3);
  171.             }
  172.             else if(CurrentCol[playerid] >= -1)
  173.             {
  174.                 GameTextForPlayer(playerid, "~r~No more colors available!~n~~w~Only ~y~8 ~w~colors!~n~~w~To move back press ~r~Y", 4000, 3);
  175.             }
  176.         }
  177.         if(newkeys == KEY_FIRE)
  178.         {
  179.             if(CurrentCol[playerid] != -1 || CurrentCol[playerid] >= 9)
  180.             {
  181.                 DeletePVar(playerid, "JECCColor");
  182.                 GameTextForPlayer(playerid, "~w~Color ~g~Successfully ~y~choosed!", 2000, 3);
  183.                 ChoosingColor[playerid] = false;
  184.                 CurrentCol[playerid] = -1;
  185.                 TogglePlayerControllable(playerid, 1);
  186.             }
  187.         }
  188.     }
  189.     return 1;
  190. }
  191. CMD:browsecolor(playerid, params[])
  192. {
  193.     if(ChoosingColor[playerid] == true) return SendClientMessage(playerid, 0xFF0000C8, "You're already browsing, selecting colors, /stopbrowsec to stop browsing!");
  194.     TogglePlayerControllable(playerid, 0);
  195.     GameTextForPlayer(playerid, "~w~Browsing Color Controls:~n~~y~Y for forward browsing~n~~r~N for backward browsing!~n~~g~Press FIRE key to select the color!", 4300, 3);
  196.     ChoosingColor[playerid] = true;
  197.     SetPVarInt(playerid, "JECCColor", GetPlayerColor(playerid));
  198.     SendClientMessage(playerid, -1, "=== Jake's Efficient Color Changer Controls ===");
  199.     SendClientMessage(playerid, 0x33CC33C8, "Press Y for forward color browsing!");
  200.     SendClientMessage(playerid, 0xFF0000C8, "Press N for backward color browsing!");
  201.     SendClientMessage(playerid, -1, "Press FIRE key to choose the selected color!");
  202.     return 1;
  203. }
  204. CMD:stopbrowsec(playerid, params[])
  205. {
  206.     if(ChoosingColor[playerid] == false) return SendClientMessage(playerid, 0xFF0000C8, "You're not browsing, selecting colors! To start browsing, /browsecolor!");
  207.     TogglePlayerControllable(playerid, 1);
  208.     GameTextForPlayer(playerid, "~r~Browsing colors has been stopped!~n~~w~Color back to ~g~normal!", 3000, 3);
  209.     ChoosingColor[playerid] = false;
  210.     SetPlayerColor(playerid, GetPVarInt(playerid, "JECCColor"));
  211.     DeletePVar(playerid, "JECCColor");
  212.     SendClientMessage(playerid, 0xFF0000C8, "Browsing colors has been stopped, Color back to normal!");
  213.     return 1;
  214. }
  215. CMD:helpbrowsec(playerid, params[])
  216. {
  217.     SendClientMessage(playerid, -1, "=== Jake's Efficient Color Changer Help ===");
  218.     SendClientMessage(playerid, -1, "Commands: /helpbrowsec, /browsecolor, /stopbrowsec");
  219.     SendClientMessage(playerid, -1, "Instruction Manual:");
  220.     SendClientMessage(playerid, -1, "1. Type /browsecolor in the chat menu");
  221.     SendClientMessage(playerid, -1, "2. Choose color by browsing, with Y and N keys!");
  222.     SendClientMessage(playerid, -1, "3. Click the FIRE key if you've selected your color!");
  223.     SendClientMessage(playerid, -1, "4. Done!");
  224.     SendClientMessage(playerid, -1, "If you don't want to browse color anymore, Just /stopbrowsec!");
  225.     return 1;
  226. }
Advertisement
Add Comment
Please, Sign In to add comment