SHARE
TWEET

FuNk's Name/ID/Chat Color Changer [Y_INI]

a guest Jun 18th, 2016 274 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*__________________________________________________________________
  2. |                                                                  |
  3. |                  Name/Chat/ID Color Changer By FuNkY             |
  4. |               ____            ____         ___                   |
  5. |               |___ U N K Y      |  HE     |  __ R E A T          |
  6. |               |                 |         |___|                  |
  7. |__________________________________________________________________|*/
  8.  
  9. #include <a_samp>
  10. #include <zcmd>
  11. #include <YSI\y_ini>
  12. #define PlayerColors "PlayerColors/%s.ini"
  13.  
  14. #define DIALOG_COLORS       1
  15. #define DIALOG_IDCOLOR      2
  16. #define DIALOG_ChatColor    3
  17.  
  18. enum ColorData
  19. {
  20.     Color,
  21.     IDColor,
  22.     ChatColor
  23. }
  24.  
  25. new User[MAX_PLAYERS][ColorData];
  26.  
  27. public OnFilterScriptInit()
  28. {
  29.     print("\n--------------------------------------");
  30.     print(" Name/Chat/ID Color Changer By FuNkY    ");
  31.     print(" --------------LOADED------------------ ");
  32.     print("--------------------------------------\n");
  33.     return 1;
  34. }
  35.  
  36. public OnFilterScriptExit()
  37. {
  38.     print("\n--------------------------------------");
  39.     print(" Name/Chat/ID Color Changer By FuNkY    ");
  40.     print(" ----------------UNLOADED---------------");
  41.     print("--------------------------------------\n");
  42.     return 1;
  43. }
  44.  
  45.  
  46.  
  47. public OnPlayerConnect(playerid)
  48. {
  49.     if(fexist(ColorRoot(playerid)))
  50.     {
  51.         INI_ParseFile(ColorRoot(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  52.     }
  53.     else
  54.     {
  55.         new INI:file = INI_Open(ColorRoot(playerid));
  56.         INI_WriteInt(file, "Color", User[playerid][Color]);
  57.         INI_WriteInt(file, "IDColor", User[playerid][IDColor]);
  58.         INI_WriteInt(file, "ChatColor", User[playerid][ChatColor]);
  59.  
  60.  
  61.         INI_ParseFile(ColorRoot(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  62.         INI_Close(file);
  63.     }
  64.     return 1;
  65. }
  66.  
  67. public OnPlayerDisconnect(playerid,reason)
  68. {
  69.     if(fexist(ColorRoot(playerid)))
  70.     {
  71.         new INI:file = INI_Open(ColorRoot(playerid));
  72.         INI_WriteInt(file, "Color", User[playerid][Color]);
  73.         INI_WriteInt(file, "IDColor", User[playerid][IDColor]);
  74.         INI_WriteInt(file, "ChatColor", User[playerid][ChatColor]);
  75.  
  76.         INI_Close(file);
  77.     }
  78.     return 1;
  79. }
  80.  
  81. public OnPlayerText(playerid, text[])
  82. {
  83.     new string[500];
  84.     format(string, sizeof(string), "{%06x}%s {%06x}[%d]: {%06x}%s",(User[playerid][Color] >>> 8), GetName(playerid), (User[playerid][IDColor] >>> 8), playerid, (User[playerid][ChatColor] >>> 8), text);
  85.     SendClientMessageToAll(playerid, string);
  86.     return 0;
  87. }
  88.  
  89. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  90. {
  91.         new string[128];
  92.         if(dialogid == DIALOG_COLORS)
  93.         {
  94.             if(response)
  95.             {
  96.                 switch(listitem)
  97.                 {
  98.                     case 0: User[playerid][Color] = 4294967295;
  99.                     case 1: User[playerid][Color] = 4294902015;
  100.                     case 2: User[playerid][Color] = 4278190335;
  101.                     case 3: User[playerid][Color] = 65535;
  102.                     case 4: User[playerid][Color] = 1861762303;
  103.                     case 5: User[playerid][Color] = 1768516095;
  104.                     case 6: User[playerid][Color] = 4205821695;
  105.                     case 7: User[playerid][Color] = 4258273279;
  106.                     case 8: User[playerid][Color] = 502396415;
  107.                     case 9: User[playerid][Color] = 3522502143;
  108.                     case 10: User[playerid][Color] = 2386452479;
  109.                     case 11: User[playerid][Color] = 2561656831;
  110.                     case 12: User[playerid][Color] = 2147472639;
  111.                     case 13: User[playerid][Color] = 1867397119;
  112.                 }
  113.  
  114.                 SetPlayerColor(playerid, User[playerid][Color]);
  115.                 format(string, sizeof(string), "{%06x}You have successfully changed your Name Color!", (User[playerid][Color] >>> 8));
  116.                 SendClientMessage(playerid, -1, string);
  117.             }
  118.         }
  119.         if(dialogid == DIALOG_IDCOLOR)
  120.         {
  121.             if(response)
  122.             {
  123.                 switch(listitem)
  124.                 {
  125.                     case 0: User[playerid][IDColor] = 4294967295;
  126.                     case 1: User[playerid][IDColor] = 4294902015;
  127.                     case 2: User[playerid][IDColor] = 4278190335;
  128.                     case 3: User[playerid][IDColor] = 65535;
  129.                     case 4: User[playerid][IDColor] = 1861762303;
  130.                     case 5: User[playerid][IDColor] = 1768516095;
  131.                     case 6: User[playerid][IDColor] = 4205821695;
  132.                     case 7: User[playerid][IDColor] = 4258273279;
  133.                     case 8: User[playerid][IDColor] = 502396415;
  134.                     case 9: User[playerid][IDColor] = 3522502143;
  135.                     case 10: User[playerid][IDColor] = 2386452479;
  136.                     case 11: User[playerid][IDColor] = 2561656831;
  137.                     case 12: User[playerid][IDColor] = 2147472639;
  138.                     case 13: User[playerid][IDColor] = 1867397119;
  139.                 }
  140.  
  141.                 format(string, sizeof(string), "{%06x}You have successfully changed your ID Color!", (User[playerid][IDColor] >>> 8));
  142.                 SendClientMessage(playerid, -1, string);
  143.             }
  144.         }
  145.         if(dialogid == DIALOG_ChatColor)
  146.         {
  147.             if(response)
  148.             {
  149.                 switch(listitem)
  150.                 {
  151.  
  152.                     case 0: User[playerid][ChatColor] = 4294967295;
  153.                     case 1: User[playerid][ChatColor] = 4294902015;
  154.                     case 2: User[playerid][ChatColor] = 4278190335;
  155.                     case 3: User[playerid][ChatColor] = 65535;
  156.                     case 4: User[playerid][ChatColor] = 1861762303;
  157.                     case 5: User[playerid][ChatColor] = 1768516095;
  158.                     case 6: User[playerid][ChatColor] = 4205821695;
  159.                     case 7: User[playerid][ChatColor] = 4258273279;
  160.                     case 8: User[playerid][ChatColor] = 502396415;
  161.                     case 9: User[playerid][ChatColor] = 3522502143;
  162.                     case 10: User[playerid][ChatColor] = 2386452479;
  163.                     case 11: User[playerid][ChatColor] = 2561656831;
  164.                     case 12: User[playerid][ChatColor] = 2147472639;
  165.                     case 13: User[playerid][ChatColor] = 1867397119;
  166.                 }
  167.  
  168.                 format(string, sizeof(string), "{%06x}You have successfully changed your Chat Color!", (User[playerid][ChatColor] >>> 8));
  169.                 SendClientMessage(playerid, -1, string);
  170.             }
  171.         }
  172.         return 0;
  173. }
  174. CMD:color(playerid, params[])
  175. {
  176.     ShowPlayerDialog(playerid, DIALOG_COLORS, DIALOG_STYLE_LIST, "Name Colors", "{FFFFFF}White\n{FFFF00}Yellow\n{FF0000}Red\n{0000FF}Blue\n{6EF83C}Green\n{696969}Gray\n{FAAFBE}Pink\n{FDD017}Gold\n{1DF1F5}Cyan\n{D1F51D}Lime Green\n{8E3E5F}Purple\n{98AFC7}Blue Gray\n{7FFFD4}Aqua\n{6F4E37}Brown", "Select", "Close");
  177.     return 1;
  178. }
  179. CMD:idcolor(playerid, params[])
  180. {
  181.     ShowPlayerDialog(playerid, DIALOG_IDCOLOR, DIALOG_STYLE_LIST, "ID Colors", "{FFFFFF}White\n{FFFF00}Yellow\n{FF0000}Red\n{0000FF}Blue\n{6EF83C}Green\n{696969}Gray\n{FAAFBE}Pink\n{FDD017}Gold\n{1DF1F5}Cyan\n{D1F51D}Lime Green\n{8E3E5F}Purple\n{98AFC7}Blue Gray\n{7FFFD4}Aqua\n{6F4E37}Brown", "Select", "Close");
  182.     return 1;
  183. }
  184. CMD:chatcolor(playerid, params[])
  185. {
  186.     ShowPlayerDialog(playerid, DIALOG_ChatColor, DIALOG_STYLE_LIST, "Chat Colors", "{FFFFFF}White\n{FFFF00}Yellow\n{FF0000}Red\n{0000FF}Blue\n{6EF83C}Green\n{696969}Gray\n{FAAFBE}Pink\n{FDD017}Gold\n{1DF1F5}Cyan\n{D1F51D}Lime Green\n{8E3E5F}Purple\n{98AFC7}Blue Gray\n{7FFFD4}Aqua\n{6F4E37}Brown", "Select", "Close");
  187.     return 1;
  188. }
  189. forward LoadUser_data(playerid, name[], value[]);
  190. public LoadUser_data(playerid, name[], value[])
  191. {
  192.     INI_Int("Color", User[playerid][Color]);
  193.     INI_Int("IDColor", User[playerid][IDColor]);
  194.     INI_Int("ChatColor", User[playerid][ChatColor]);
  195.  
  196.     return 1;
  197. }
  198. ColorRoot(playerid)
  199. {
  200.     new string[128],playername[MAX_PLAYER_NAME];
  201.     GetPlayerName(playerid,playername,sizeof(playername));
  202.     format(string,sizeof(string),PlayerColors,playername);
  203.     return string;
  204. }
  205. GetName(playerid)
  206. {
  207.     new pName[24];
  208.     GetPlayerName(playerid, pName, 24);
  209.     return pName;
  210. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top