Advertisement
Guest User

Untitled

a guest
May 28th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 44.56 KB | None | 0 0
  1. /**************** Sistema Registro & Clanes con Tops DINI *********************/
  2. //==============================================================================
  3. //  # Sistema Registro & Clanes con Tops DINI
  4. //  # Autor: Zoutdaxv.
  5. //  # Versión: 0.4.2
  6. //  # Fecha: 20/Feb/2010
  7. //  # Actualizado: 01/Jun/2010
  8. //  # Creditos:
  9. //      - » RyDeR «: idea In Game ColorPicker (Sin copiar & pegar).
  10. //      - Zamaroht: TDE & Función RGBA.
  11. //==============================================================================
  12. #include <a_samp>
  13. #include <dini>
  14. //==============================================================================
  15. #define DLG_TOP_PLAYERS 1500
  16. #define DLG_TOP_CLANES 1501
  17. #define DLG_PLY_INFO 1503
  18. #define DLG_CLAN_INFO 1504
  19. //==============================================================================
  20. #define ROJO 0xAA3333AA
  21. #define NARANJA 0xF97804FF
  22. #define BLANCO 0xEFEFF7AA
  23. #define LIGHTBLUE 0x00C2ECFF
  24. #define NICESKY 0x99FFFFAA
  25. //==============================================================================
  26. #define MAX_DATOS 3000 //NÚMERO DE DATOS QUE SE GUARDARÁN PARA LOS TOPS.
  27. #define MAX_TOP_PLAYERS 10 //LUGARES QUE SE MOSTRARÁN EN EL TOP PLAYERS
  28. #define MAX_TOP_CLANES 10 //LUGARES QUE SE MOSTRARÁN EN EL TOP CLANES
  29. //==============================================================================
  30. //TOP PLAYERS & TOP CLANES
  31. enum info
  32. {
  33.     NickTOP[32],
  34.     AsesinatosTOP,
  35.     MuertesTOP,
  36.     Float:RatioTOP
  37. };
  38. new TopInfoP[MAX_TOP_PLAYERS+1][info];
  39. new TopInfoC[MAX_TOP_CLANES+1][info];
  40. new TopP[MAX_TOP_PLAYERS+1];
  41. new TopC[MAX_TOP_CLANES+1];
  42. new NOMBRE[MAX_DATOS][32];
  43. new Float:VALOR[MAX_DATOS];
  44. new bool:EnTop[MAX_DATOS];
  45. //==============================================================================
  46. //Strings diálogos:
  47. new DLG_INFO_STR[2048];
  48. //Si se ponen más lugares en el top players,
  49. //modificar esto, máximo 4096:
  50. new DLG_TOP_PLY_STR[1024];
  51. //Si se ponen más lugares en el top clanes,
  52. //modificar esto, máximo 4096:
  53. new DLG_TOP_CLAN_STR[1024];
  54. //==============================================================================
  55. //JUGADORES:
  56. new bool:Registrado[MAX_PLAYERS] = false;
  57. new bool:Ingresado[MAX_PLAYERS] = false;
  58. new Nickname[MAX_PLAYERS][MAX_PLAYER_NAME];
  59. new Asesinatos[MAX_PLAYERS];
  60. new Muertes[MAX_PLAYERS];
  61. new Float:Ratio[MAX_PLAYERS];
  62. //Combinador de colores:
  63. new bool:CColor[MAX_PLAYERS] = false;
  64. new CSelec[MAX_PLAYERS] = 1;
  65. new COLORES[MAX_PLAYERS][4];//0 ROJO, 1 VERDE, 2 AZUL, 3 Transparencia
  66. //==============================================================================
  67. //TextDraws Combinador de colores
  68. new Text:NumColor[MAX_PLAYERS];
  69. new Text:Color[MAX_PLAYERS];
  70. new Text:CComb[MAX_PLAYERS];
  71. new Text:Comb[MAX_PLAYERS];
  72. //==============================================================================
  73. //CLANES:
  74. new Clan_TAG[MAX_PLAYERS][4];
  75. new Clan_ID[MAX_PLAYERS];
  76. new Invitacion[MAX_PLAYERS][32];
  77. new bool:EnClan[MAX_PLAYERS];
  78. //==============================================================================
  79. new PlayerColors[200] = {
  80.     0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,
  81.     0xFF1493FF,0xF4A460FF,0xEE82EEFF,0xFFD720FF,0x8b4513FF,0x4949A0FF,0x148b8bFF,
  82.     0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,
  83.     0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,0x5C1ACCFF,
  84.     0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,0x275222FF,0xF09F5BFF,
  85.     0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,
  86.     0xE9AB2FFF,0xAF2FF3FF,0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,
  87.     0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,0x4B8987FF,0x491B9EFF,
  88.     0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,
  89.     0x48C000FF,0x2A51E2FF,0xE3AC12FF,0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,
  90.     0x42ACF5FF,0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,
  91.     0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,
  92.     0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,0x9F945CFF,0xDCDE3DFF,0x10C9C5FF,
  93.     0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,
  94.     0xD8C762FF,0xD8C762FF,0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,
  95.     0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,0xEE82EEFF,0xFFD720FF,0x8b4513FF,
  96.     0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0x534081FF,
  97.     0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,
  98.     0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,
  99.     0x275222FF,0xF09F5BFF,0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,
  100.     0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,0x057F94FF,0xB98519FF,0x388EEAFF,
  101.     0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,
  102.     0x4B8987FF,0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,
  103.     0x3C1C0DFF,0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF,0xFC42A8FF,0x2FC827FF,
  104.     0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,
  105.     0x94436EFF,0xC1F7ECFF,0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,0x184D3BFF,
  106.     0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,0x9F945CFF,
  107.     0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,
  108.     0xE59338FF,0xEEDC2DFF,0xD8C762FF,0xD8C762FF
  109. };
  110.  
  111. public OnFilterScriptInit()
  112. {
  113.     new
  114.         Archivo[64];
  115.        
  116.     print("\n --------------------------------------");
  117.     print("  Sistema & Tops 0.4.2");
  118.     print(" --------------------------------------\n");
  119.     SetTimer("ActualizarListaJugadores", 1500, 0);
  120.     SetTimer("ActualizarTopPlayers", 3500, 0);
  121.     SetTimer("ActualizarTopClanes", 5000, 0);
  122.    
  123.     format(Archivo, sizeof Archivo, "Clan.ini");
  124.     if(!dini_Exists(Archivo)) {
  125.         dini_Create(Archivo);
  126.         dini_IntSet(Archivo, "Clan_IDs", 0);
  127.     }
  128.     if(!fexist("Jugadores.txt")) {
  129.         new
  130.             File:file = fopen("Jugadores.txt", io_write);
  131.  
  132.         fclose(file);
  133.     }
  134.     if(!fexist("Clanes.txt")) {
  135.         new
  136.             File:file = fopen("Clanes.txt", io_write);
  137.  
  138.         fclose(file);
  139.     }
  140.     return 1;
  141. }
  142.  
  143. public OnFilterScriptExit()
  144. {
  145.     return 1;
  146. }
  147.  
  148. public OnPlayerConnect(playerid)
  149. {
  150.     new
  151.         Archivo[64];
  152.        
  153.     GetPlayerName(playerid, Nickname[playerid], MAX_PLAYER_NAME);
  154.     if(strfind(Nickname[playerid], "[", true) != -1 || strfind(Nickname[playerid], "]", true) != -1)
  155.     {
  156.         SendClientMessage(playerid, ROJO, "Tu nick no puede contener corchetes");
  157.         return Kick(playerid);
  158.     }
  159.     //Verificar registro:
  160.     format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", Nickname[playerid]);
  161.     if(dini_Exists(Archivo)) Registrado[playerid] = true;
  162.     SetPlayerColor(playerid, PlayerColors[playerid]);
  163.     return 1;
  164. }
  165.  
  166. public OnPlayerDisconnect(playerid, reason)
  167. {
  168.     Invitacion[playerid][0] = 0;
  169.     Clan_ID[playerid] = 0;
  170.     Clan_TAG[playerid][0] = 0;
  171.     EnClan[playerid] = false;
  172.     Registrado[playerid] = false;
  173.     Ingresado[playerid] = false;
  174.     Asesinatos[playerid] = 0;
  175.     Muertes[playerid] = 0;
  176.     Ratio[playerid] = 0.0;
  177.     return 1;
  178. }
  179.  
  180. public OnPlayerDeath(playerid, killerid, reason)
  181. {
  182.     new
  183.         Archivo[64],
  184.         TempMuertes,
  185.         TempAsesinatos;
  186.  
  187.     Muertes[playerid]++;
  188.     Ratio[playerid] = float(Asesinatos[playerid]) / float(Muertes[playerid]);
  189.  
  190.     if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
  191.     {
  192.         Asesinatos[killerid]++;
  193.         if(Muertes[killerid] == 0) Ratio[killerid] = float(Asesinatos[playerid]);
  194.         else Ratio[killerid] = float(Asesinatos[killerid]) / float(Muertes[killerid]);
  195.     }
  196.     if(IsPlayerConnected(playerid) && Ingresado[playerid] == true)
  197.     {
  198.         format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", Nickname[playerid]);
  199.         if(dini_Exists(Archivo))
  200.         {
  201.             dini_IntSet(Archivo, "Muertes", Muertes[playerid]);
  202.             dini_FloatSet(Archivo, "Ratio", Ratio[playerid]);
  203.         }
  204.         if(EnClan[playerid] == true)
  205.         {
  206.             format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  207.             if(dini_Exists(Archivo))
  208.             {
  209.                 dini_IntSet(Archivo, "Muertes", dini_Int(Archivo, "Muertes")+1);
  210.                 dini_FloatSet(Archivo, "Ratio", float(dini_Int(Archivo, "Asesinatos")) / float(dini_Int(Archivo, "Muertes")));
  211.             }
  212.         }
  213.     }
  214.     if(IsPlayerConnected(killerid) && Ingresado[killerid] == true && killerid != INVALID_PLAYER_ID)
  215.     {
  216.         format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", Nickname[killerid]);
  217.         if(dini_Exists(Archivo))
  218.         {
  219.             dini_IntSet(Archivo, "Asesinatos", Asesinatos[killerid]);
  220.             dini_FloatSet(Archivo, "Ratio", Ratio[killerid]);
  221.         }
  222.         if(EnClan[killerid] == true)
  223.         {
  224.             format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[killerid]);
  225.             if(dini_Exists(Archivo))
  226.             {
  227.                 TempMuertes = dini_Int(Archivo, "Muertes");
  228.                 TempAsesinatos = dini_Int(Archivo, "Asesinatos");
  229.                 dini_IntSet(Archivo, "Asesinatos", TempAsesinatos+1);
  230.                 if(TempMuertes == 0) dini_FloatSet(Archivo, "Ratio", float(TempAsesinatos));
  231.                 else dini_FloatSet(Archivo, "Ratio", float(TempAsesinatos) / float(TempMuertes));
  232.             }
  233.         }
  234.     }
  235.     return 1;
  236. }
  237.  
  238. public OnPlayerText(playerid, text[])
  239. {
  240.     new
  241.         Nick[MAX_PLAYER_NAME],
  242.         texto[128];
  243.        
  244.     if(text[0] == '!' && EnClan[playerid] == true)
  245.     {
  246.         GetPlayerName(playerid, Nick, MAX_PLAYER_NAME);
  247.         format(texto, sizeof texto, "%s: %s", Nick, text[1]);
  248.         for(new i = 0; i < MAX_PLAYERS; i++)
  249.         {
  250.             if(IsPlayerConnected(i))
  251.             {
  252.                 if(EnClan[i] == EnClan[playerid])
  253.                 {
  254.                     SendClientMessage(playerid, LIGHTBLUE, texto);
  255.                 }
  256.             }
  257.         }
  258.         return 0;
  259.     }
  260.     return 1;
  261. }
  262.  
  263. public OnPlayerCommandText(playerid, cmdtext[])
  264. {
  265.     new
  266.         cmd[20],
  267.         tmp[20],
  268.         tmp2[20],
  269.         tmp3[24],
  270.         string[64],
  271.         Archivo[64],
  272.         Nick[MAX_PLAYER_NAME],
  273.         longitud,
  274.         id,
  275.         File:file,
  276.         idx;
  277.  
  278.     cmd = strtok(cmdtext, idx);
  279.    
  280.     if(!strcmp("/kill", cmd, true))
  281.     {
  282.         SetPlayerHealth(playerid, 0.0);
  283.         return 1;
  284.     }
  285.     if(!strcmp("/registrar", cmd, true))
  286.     {
  287.         if(Registrado[playerid] ==  true) return SendClientMessage(playerid, ROJO, "Ya estás registrado");
  288.         tmp = strtok(cmdtext, idx);
  289.         longitud =  strlen(tmp);
  290.         if(longitud == 0) return SendClientMessage(playerid, BLANCO, "Uso /registrar [Contraseña]");
  291.         if(longitud < 3 || longitud > 16)
  292.         {
  293.             return SendClientMessage(playerid, ROJO, "La contraseña debe tener de 3 a 16 caracteres");
  294.         }
  295.         Registrar(playerid, tmp);
  296.         return 1;
  297.     }
  298.     if(!strcmp("/login", cmd, true))
  299.     {
  300.         if(Registrado[playerid] == false) return SendClientMessage(playerid, ROJO, "No estás registrado");
  301.         if(Ingresado[playerid] == true) return SendClientMessage(playerid, ROJO, "Ya estás logueado");
  302.         tmp = strtok(cmdtext, idx);
  303.         longitud =  strlen(tmp);
  304.         if(longitud == 0) return SendClientMessage(playerid, BLANCO, "Uso /login [Contraseña]");
  305.         Login(playerid, tmp);
  306.         return 1;
  307.     }
  308.     if(!strcmp(cmd, "/stats", true))
  309.     {
  310.         tmp = strtok(cmdtext, idx);
  311.         if(!strlen(tmp)) return SendClientMessage(playerid, BLANCO, "Usa: /stats [id]");
  312.         id = strval(tmp);
  313.         if(!IsPlayerConnected(id)) return SendClientMessage(playerid, ROJO, "Jugador no conectado");
  314.         if(Ingresado[id] == false) return SendClientMessage(playerid, ROJO, "Ese jugador no está ingresado");
  315.         format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", Nickname[id]);
  316.         format(DLG_INFO_STR, sizeof DLG_INFO_STR, "~.~");
  317.         if(dini_Exists(Archivo))
  318.         {
  319.             format(DLG_INFO_STR, sizeof DLG_INFO_STR, "Asesinatos: %d\n", dini_Int(Archivo, "Asesinatos"));
  320.             format(DLG_INFO_STR, sizeof DLG_INFO_STR, "%sMuertes: %d\n", DLG_INFO_STR, dini_Int(Archivo, "Muertes"));
  321.             format(DLG_INFO_STR, sizeof DLG_INFO_STR, "%sRatio: %d\n", DLG_INFO_STR, dini_Float(Archivo, "Ratio"));
  322.             format(DLG_INFO_STR, sizeof DLG_INFO_STR, "%sClan: [%s]", DLG_INFO_STR, dini_Get(Archivo, "Clan"));
  323.         }
  324.         format(string, sizeof string, "Stadísticas de %s (%d)", Nickname[id], id);
  325.         ShowPlayerDialog(playerid, DLG_PLY_INFO, DIALOG_STYLE_MSGBOX, string, DLG_INFO_STR, "Aceptar", "Cancelar");
  326.         return 1;
  327.     }
  328.     if(!strcmp(cmd, "/Topplayers", true))
  329.     {
  330.         ShowPlayerDialog(playerid, DLG_TOP_PLAYERS, DIALOG_STYLE_LIST, "Top Players", DLG_TOP_PLY_STR, "Aceptar", "Cancelar");
  331.         return 1;
  332.     }
  333.     if(!strcmp(cmd, "/Topclanes", true))
  334.     {
  335.         ShowPlayerDialog(playerid, DLG_TOP_CLANES, DIALOG_STYLE_LIST, "Top Clanes", DLG_TOP_CLAN_STR, "Aceptar", "Cancelar");
  336.         return 1;
  337.     }
  338.     if(!strcmp(cmd, "/clan", true))
  339.     {
  340.         tmp = strtok(cmdtext, idx);
  341.         if(!strlen(tmp)) return SendClientMessage(playerid, BLANCO, "Usa: /clan [info, crear, invitar, entrar, salir, expulsar, color, colorh] [TAG] [Nombre]");
  342.         if(!strcmp(tmp, "crear", true))
  343.         {
  344.             if(Ingresado[id] == false) return SendClientMessage(playerid, ROJO, "Necesitas estar logueado para usar este comando");
  345.             if(EnClan[playerid] == true) return SendClientMessage(playerid, ROJO, "Ya tienes clan");
  346.             tmp2 = strtok(cmdtext, idx);
  347.             tmp3 = strrest(cmdtext, idx);
  348.             if(!strlen(tmp2) || !strlen(tmp3)) return SendClientMessage(playerid, BLANCO, "Usa: /clan crear [TAG] [Nombre]");
  349.             if(strlen(tmp2) < 1 || strlen(tmp2) > 3) return SendClientMessage(playerid, ROJO, "Sólo de 1 a 3 caracteres");
  350.             if(strlen(tmp3) < 3 || strlen(tmp3) > 24) return SendClientMessage(playerid, ROJO, "Sólo de 3 a 24 caracteres");
  351.             if(strfind(tmp2, "[", true) != -1 || strfind(tmp2, "]", true) != -1)
  352.             {
  353.                 return SendClientMessage(playerid, ROJO, "Sin '[' ']' (corchetes) .");
  354.             }
  355.             format(Archivo, sizeof Archivo, "Clanes/%s.ini", tmp2);
  356.             if(!dini_Exists(Archivo))
  357.             {
  358.                 format(Clan_TAG[playerid], 4, "%s", tmp2);
  359.                 Clan_ID[playerid] = dini_Int("Clan.ini", "Clan_IDs")+1;
  360.                 dini_IntSet("Clan.ini", "Clan_IDs", Clan_ID[playerid]);
  361.                 dini_Create(Archivo);
  362.                 dini_IntSet(Archivo, "ID", Clan_ID[playerid]);
  363.                 dini_Set(Archivo, "Nombre", tmp3);
  364.                 dini_Set(Archivo, "TAG", tmp2);
  365.                 dini_IntSet(Archivo, "Color", id);
  366.                 dini_Set(Archivo, "Lider", Nickname[playerid]);
  367.                 dini_IntSet(Archivo, "Miembros", 1);
  368.                 dini_IntSet(Archivo, "Asesinatos", 0);
  369.                 dini_IntSet(Archivo, "Muertes", 0);
  370.                 dini_FloatSet(Archivo, "Ratio", 0.0);
  371.                 dini_Set(Archivo, "Miembro_1", Nickname[playerid]);
  372.                 for(new l = 2; l < 21; l++)
  373.                 {
  374.                     format(string, sizeof string, "Miembro_%d", l);
  375.                     dini_Set(Archivo, string, "<Vacio>");
  376.                 }
  377.                 format(Archivo, sizeof Archivo, "Jugadores/%s.ini", Nickname[playerid]);
  378.                 dini_Set(Archivo, "Clan", Clan_TAG[playerid]);
  379.                 file = fopen("Clanes.txt", io_append);
  380.                 format(string, sizeof(string), "%s;\r\n", Clan_TAG[playerid]);
  381.                 fwrite(file, string);
  382.                 fclose(file);
  383.                 format(Nick, sizeof Nick, "[%s]%s", Clan_TAG[playerid], Nickname[playerid]);
  384.                 SetPlayerName(playerid, Nick);
  385.                 SetPlayerColor(playerid, 0);
  386.                 EnClan[playerid] = true;
  387.                 format(string, sizeof string, "Has creado el clan '%s' TAG: [%s]", tmp3, tmp2);
  388.                 SendClientMessage(playerid, LIGHTBLUE, string);
  389.                 SendClientMessage(playerid, NARANJA, "Usa /clan color/colorh para cambiar el color de tu clan");
  390.             } else {
  391.                 SendClientMessage(playerid, ROJO, "El TAG ya está en uso");
  392.             }
  393.             return 1;
  394.         }
  395.         if(!strcmp(tmp, "color", true))
  396.         {
  397.             if(EnClan[playerid] == false) return SendClientMessage(playerid, ROJO, "No tienes clan");
  398.             format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  399.             if(strcmp(dini_Get(Archivo, "Lider"), Nickname[playerid]) != 0)
  400.                 return SendClientMessage(playerid, ROJO, "Necesitas ser el creador del clan para poder cambiar el color");
  401.             if(CColor[playerid] == true) {
  402.                 OcultarCombinador(playerid);
  403.                 TogglePlayerControllable(playerid, 1);
  404.                 CColor[playerid] = false;
  405.             } else {
  406.                 MostrarCombinador(playerid);
  407.                 TogglePlayerControllable(playerid, 0);
  408.                 COLORES[playerid][3] = 255;
  409.                 CColor[playerid] = true;
  410.                 SendClientMessage(playerid, NICESKY, "Usa /clan color para cancelar");
  411.                 GameTextForPlayer(playerid, "~h~Usa ~<~, ~>~, ~u~, ~d~ y ~k~~PED_SPRINT~ ~n~para cambiar el color y ~k~~PED_FIREWEAPON~ ~n~para seleccionar", 100000, 3);
  412.             }
  413.             return 1;
  414.         }
  415.         if(!strcmp(tmp, "colorh", true))
  416.         {
  417.             if(EnClan[playerid] == false) return SendClientMessage(playerid, ROJO, "No tienes clan");
  418.             if(strcmp(dini_Get(Archivo, "Lider"), Nickname[playerid]) != 0)
  419.                 return SendClientMessage(playerid, ROJO, "Necesitas ser el creador del clan para poder cambiar el color");
  420.             if(CColor[playerid] == true) return SendClientMessage(playerid, ROJO, "Cierra primero el combinador de colores.");
  421.             tmp2 = strtok(cmdtext, idx);
  422.             longitud = strlen(tmp2);
  423.             if(!longitud) return SendClientMessage(playerid, BLANCO, "Usa: /clan colorh [Código Hexadecimal]");
  424.             if(longitud > 10) return SendClientMessage(playerid, ROJO, "Demasiado grande");
  425.  
  426.             new
  427.                 rojo[3] = "00",
  428.                 azul[3] = "00",
  429.                 verde[3] = "00",
  430.                 alfa[3],
  431.                 ColorC;
  432.  
  433.             if(tmp2[0] == '#')
  434.             {
  435.                 format(string, sizeof string, "%s", tmp2[1]);
  436.                 if(!IsAHexNumber(string)) return SendClientMessage(playerid, ROJO, "Formato incorrecto. Ejemplo: #FFFFFFFF");
  437.                 format(rojo, sizeof rojo, "%c%c", tmp2[1], tmp2[2]);
  438.                 format(azul, sizeof azul, "%c%c", tmp2[3], tmp2[4]);
  439.                 format(verde, sizeof verde, "%c%c", tmp2[5], tmp2[6]);
  440.                 if(tmp2[7] != '\0')
  441.                     format(alfa, sizeof alfa, "%c%c", tmp2[7], tmp2[8]);
  442.                 else alfa = "FF";
  443.                 ColorC = RGBA(HexToInt(rojo), HexToInt(verde), HexToInt(azul), HexToInt(alfa));
  444.                 format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  445.                 dini_IntSet(Archivo, "Color", ColorC);
  446.                 for(new i = 0; i < MAX_PLAYERS; i++)
  447.                 {
  448.                     if(IsPlayerConnected(i))
  449.                         if(Clan_ID[playerid] == Clan_ID[i])
  450.                             SetPlayerColor(i, ColorC);
  451.                 }
  452.                 format(string, sizeof string, "~y~~h~ Color seleccionado~n~~p~#%s%s%s%s", rojo, verde, azul, alfa);
  453.                 GameTextForPlayer(playerid, string, 3000, 4);
  454.                 return 1;
  455.             }
  456.             else if(tmp2[0] == '0' && tmp2[1] == 'x')
  457.             {
  458.                 format(string, sizeof string, "%s", tmp2[2]);
  459.                 if(!IsAHexNumber(string)) return SendClientMessage(playerid, ROJO, "Formato incorrecto. Ejemplo: 0xFFFFFFFF");
  460.                 format(rojo, sizeof rojo, "%c%c", tmp2[2], tmp2[3]);
  461.                 format(azul, sizeof azul, "%c%c", tmp2[4], tmp2[5]);
  462.                 format(verde, sizeof verde, "%c%c", tmp2[6], tmp2[7]);
  463.                 if(tmp2[8] != '\0')
  464.                     format(alfa, sizeof alfa, "%c%c", tmp2[8], tmp2[9]);
  465.                 else alfa = "FF";
  466.                
  467.                 ColorC = RGBA(HexToInt(rojo), HexToInt(verde), HexToInt(azul), HexToInt(alfa));
  468.                 format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  469.                 dini_IntSet(Archivo, "Color", ColorC);
  470.                 for(new i = 0; i < MAX_PLAYERS; i++)
  471.                 {
  472.                     if(IsPlayerConnected(i))
  473.                         if(Clan_ID[playerid] == Clan_ID[i])
  474.                             SetPlayerColor(i, ColorC);
  475.                 }
  476.                 format(string, sizeof string, "~y~~h~ Color seleccionado~n~~p~0x%s%s%s%s", rojo, verde, azul, alfa);
  477.                 GameTextForPlayer(playerid, string, 3000, 4);
  478.                 return 1;
  479.             }
  480.             if(IsAHexNumber(tmp2))
  481.             {
  482.                 format(rojo, sizeof rojo, "%c%c", tmp2[0], tmp2[1]);
  483.                 format(azul, sizeof azul, "%c%c", tmp2[2], tmp2[3]);
  484.                 format(verde, sizeof verde, "%c%c", tmp2[4], tmp2[5]);
  485.                 if(tmp2[6] != '\0')
  486.                     format(alfa, sizeof alfa, "%c%c", tmp2[6], tmp2[7]);
  487.                 else alfa = "FF";
  488.                 ColorC = RGBA(HexToInt(rojo), HexToInt(verde), HexToInt(azul), HexToInt(alfa));
  489.                 format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  490.                 dini_IntSet(Archivo, "Color", ColorC);
  491.                 for(new i = 0; i < MAX_PLAYERS; i++)
  492.                 {
  493.                     if(IsPlayerConnected(i))
  494.                         if(Clan_ID[playerid] == Clan_ID[i])
  495.                             SetPlayerColor(i, ColorC);
  496.                 }
  497.                 format(string, sizeof string, "~y~~h~ Color seleccionado~n~~p~%s%s%s%s", rojo, verde, azul, alfa);
  498.                 GameTextForPlayer(playerid, string, 3000, 4);
  499.                 return 1;
  500.             } else return SendClientMessage(playerid, ROJO, "Formato incorrecto. Ejemplo: FFFFFFFF");
  501.         }
  502.         if(!strcmp(tmp, "invitar", true))
  503.         {
  504.             if(EnClan[playerid] == false) return SendClientMessage(playerid, ROJO, "No tienes clan");
  505.             if(!strlen(tmp2)) return SendClientMessage(playerid, BLANCO, "Usa: /clan invitar [id]");
  506.             tmp2 = strtok(cmdtext, idx);
  507.             id = strval(tmp2);
  508.             if(!IsPlayerConnected(id)) return SendClientMessage(playerid, ROJO, "Jugador no conectado");
  509.             if(Ingresado[id] == false) return SendClientMessage(playerid, ROJO, "El jugador invitado necesita estar logueado");
  510.             if(id == playerid) return SendClientMessage(playerid, ROJO, "No puedes enviarte invitación a ti mismo");
  511.             format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  512.             if(strcmp(dini_Get(Archivo, "Lider"), Nickname[playerid]) != 0)
  513.                 return SendClientMessage(playerid, ROJO, "Necesitas ser el creador del clan para poder invitar");
  514.             if(EnClan[id] == true) return SendClientMessage(playerid, ROJO, "Ese jugador ya tiene clan");
  515.             format(string, sizeof string, "* %s te ha invitado al clan '%s'", Nickname[playerid], dini_Get(Archivo, "Nombre"));
  516.             SendClientMessage(id, LIGHTBLUE, string);
  517.             SendClientMessage(id, NARANJA, "Usa /clan entrar para aceptar la invitación o /clan rechazar para rechazar la invitación.");
  518.             format(string, sizeof string, "* Has invitado a %s ", Nickname[id]);
  519.             SendClientMessage(playerid, LIGHTBLUE, string);
  520.             format(Invitacion[id], 4, "%s", Clan_TAG[playerid]);
  521.             return 1;
  522.         }
  523.         if(!strcmp(tmp, "rechazar", true))
  524.         {
  525.             if(!strlen(Invitacion[playerid])) return SendClientMessage(playerid, ROJO, "No te han invitado a ningun clan");
  526.             Invitacion[playerid][0] = 0;
  527.             return 1;
  528.         }
  529.         if(!strcmp(tmp, "entrar", true))
  530.         {
  531.             if(!strlen(Invitacion[playerid])) return SendClientMessage(playerid, ROJO, "No te han invitado a ningun clan");
  532.             if(EnClan[playerid] == true) return SendClientMessage(playerid, ROJO, "Ya tienes clan");
  533.             format(Archivo, sizeof Archivo, "Clanes/%s.ini", Invitacion[playerid]);
  534.             if(dini_Exists(Archivo))
  535.             {
  536.                 new
  537.                     IDMiembro = 2;
  538.                    
  539.                 if(dini_Int(Archivo, "Miembros") == 20) return SendClientMessage(playerid, ROJO, "El clan está lleno");
  540.                 dini_IntSet(Archivo, "Miembros", dini_Int(Archivo, "Miembros")+1);
  541.                 while(IDMiembro < 20)
  542.                 {
  543.                     format(string, sizeof string, "Miembro_%d", IDMiembro);
  544.                     if(!strcmp(dini_Get(Archivo, string), "<Vacio>"))
  545.                     {
  546.                         dini_Set(Archivo, string, Nickname[playerid]);
  547.                         break;
  548.                     }
  549.                     IDMiembro++;
  550.                 }
  551.                 format(Clan_TAG[playerid], 4, Invitacion[playerid]);
  552.                 format(Archivo, sizeof Archivo, "Jugadores/%s.ini", Nickname[playerid]);
  553.                 dini_Set(Archivo, "Clan", Clan_TAG[playerid]);
  554.                 format(Nick, sizeof Nick, "[%s]%s", Clan_TAG[playerid], Nickname[playerid]);
  555.                 SetPlayerName(playerid, Nick);
  556.                 SetPlayerColor(playerid, dini_Int(Archivo, "Color"));
  557.                 format(string, sizeof string, "* %s has entrado al clan '%s'", dini_Get(Archivo, "Nombre"));
  558.                 SendClientMessage(playerid, BLANCO, string);
  559.                 Clan_ID[playerid] = dini_Int(Archivo, "ID");
  560.                 format(string, sizeof string, "* %s ha entrado al clan ", Nickname[playerid]);
  561.                 for(new i = 0; i < MAX_PLAYERS; i++) {
  562.                     if(i == playerid || !IsPlayerConnected(i)) continue;
  563.                     if(Clan_ID[playerid] == Clan_ID[i]) SendClientMessage(i, BLANCO, string);
  564.                 }
  565.                 EnClan[playerid] = true;
  566.             } else return SendClientMessage(playerid, ROJO, "Ya no existe ese clan");
  567.             return 1;
  568.         }
  569.         if(!strcmp(tmp, "salir", true))
  570.         {
  571.             if(EnClan[playerid] == false) return SendClientMessage(playerid, ROJO, "No tienes clan");
  572.             format(string, sizeof string, "* %s ha salido del clan", Nickname[playerid]);
  573.             for(new i = 0; i < MAX_PLAYERS; i++) {
  574.                 if(i == playerid || !IsPlayerConnected(i)) continue;
  575.                 if(Clan_ID[playerid] == Clan_ID[i]) SendClientMessage(i, BLANCO, string);
  576.             }
  577.             Clan_ID[playerid] = 0;
  578.             format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  579.             file = fopen(Archivo, io_read);
  580.             while(fread(file, string))
  581.             {
  582.                 idx = strfind(string, Nickname[playerid], true);
  583.                 if(idx != -1)
  584.                 {
  585.                     strmid(string, string, 0, idx-1, 16);
  586.                     dini_Set(Archivo, string, "<Vacio>");
  587.                 }
  588.             }
  589.             fclose(file);
  590.             dini_IntSet(Archivo, "Miembros", dini_Int(Archivo, "Miembros")-1);
  591.             format(string, sizeof string, "* Saliste del clan '%s'", dini_Get(Archivo, "Nombre"));
  592.             SendClientMessage(playerid, ROJO, string);
  593.            
  594.             if(dini_Int(Archivo, "Miembros") == 0)
  595.             {
  596.                 new
  597.                     Linea = 0,
  598.                     str[16];
  599.  
  600.                 dini_Remove(Archivo);
  601.                 file = fopen("Clanes.txt", io_read);
  602.                 format(str, sizeof str, "%s;", Clan_TAG[playerid]);
  603.                 while(fread(file, string))
  604.                 {
  605.                     Linea++;
  606.                     if(strfind(string, str, true) == 0)
  607.                     {
  608.                         DeleteLine("Clanes.txt", Linea);
  609.                         break;
  610.                     }
  611.                 }
  612.                 fclose(file);
  613.                 format(string, sizeof string, "Tu clan con el TAG '%s' ha sido borrado por falta de miembros", Clan_TAG[playerid]);
  614.                 SendClientMessage(playerid, ROJO, string);
  615.             }
  616.             format(Archivo, sizeof Archivo, "Jugadores/%s.ini", Nickname[playerid]);
  617.             dini_Set(Archivo, "Clan", "<Ninguno>");
  618.             SetPlayerName(playerid, Nickname[playerid]);
  619.             SetPlayerColor(playerid, PlayerColors[playerid]);
  620.             Clan_TAG[playerid][0] = 0;
  621.             EnClan[playerid] = false;
  622.             return 1;
  623.         }
  624.         if(!strcmp(tmp, "expulsar", true))
  625.         {
  626.             if(EnClan[playerid] == false) return SendClientMessage(playerid, ROJO, "No tienes clan");
  627.             tmp2 = strtok(cmdtext, idx);
  628.             if(!strlen(tmp2)) return SendClientMessage(playerid, BLANCO, "Usa: /clan expulsar [id]");
  629.             id = strval(tmp2);
  630.             if(!IsPlayerConnected(id)) return SendClientMessage(playerid, ROJO, "Jugador no conectado");
  631.             if(id == playerid) return SendClientMessage(playerid, ROJO, "No puedes expulsarte a ti mismo");
  632.             format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  633.             if(Clan_ID[playerid] != Clan_ID[id]) return SendClientMessage(playerid, ROJO, "Ese jugador no está en tu clan");
  634.             if(strcmp(dini_Get(Archivo, "Lider"), Nickname[playerid]) != 0)
  635.                 return SendClientMessage(playerid, ROJO, "Necesitas ser el creador del clan para poder expulsar");
  636.             OnPlayerCommandText(playerid, "/clan salir");
  637.             SendClientMessage(playerid, ROJO, "Fuiste expulsado del clan");
  638.             return 1;
  639.         }
  640.         if(!strcmp(tmp, "info", true))
  641.         {
  642.             tmp2 = strtok(cmdtext, idx);
  643.             if(!strlen(tmp2)) return SendClientMessage(playerid, BLANCO, "Usa: /clan info [TAG]");
  644.             format(Archivo, sizeof Archivo, "Clanes/%s.ini", tmp2);
  645.             if(dini_Exists(Archivo))
  646.             {
  647.                 format(DLG_INFO_STR, sizeof DLG_INFO_STR, "> ID: %d\n", dini_Int(Archivo, "ID"));
  648.                 format(DLG_INFO_STR, sizeof DLG_INFO_STR, "%s> Color: %d\n", DLG_INFO_STR, dini_Int(Archivo, "Color"));
  649.                 format(DLG_INFO_STR, sizeof DLG_INFO_STR, "%s> Líder: %s\n", DLG_INFO_STR, dini_Get(Archivo, "Lider"));
  650.                 format(DLG_INFO_STR, sizeof DLG_INFO_STR, "%s> Miembros: %d\n", DLG_INFO_STR, dini_Int(Archivo, "Miembros"));
  651.                 format(DLG_INFO_STR, sizeof DLG_INFO_STR, "%s> Asesinatos: %d\n", DLG_INFO_STR, dini_Int(Archivo, "Asesinatos"));
  652.                 format(DLG_INFO_STR, sizeof DLG_INFO_STR, "%s> Muertes: %d\n", DLG_INFO_STR, dini_Int(Archivo, "Muertes"));
  653.                 format(DLG_INFO_STR, sizeof DLG_INFO_STR, "%s> Ratio: %0.0f\n", DLG_INFO_STR, dini_Float(Archivo, "Ratio"));
  654.                 for(new d = 1; d < 21; d++)
  655.                 {
  656.                     format(string, sizeof string, "Miembro_%d", d);
  657.                     format(DLG_INFO_STR, sizeof DLG_INFO_STR, "%s> Miembro %d: %s\n", DLG_INFO_STR, d, dini_Get(Archivo, string));
  658.                 }
  659.                 format(string, sizeof string, "Información '%s' [%s]", dini_Get(Archivo, "Nombre"), dini_Get(Archivo, "TAG"));
  660.                 ShowPlayerDialog(playerid, DLG_CLAN_INFO, DIALOG_STYLE_MSGBOX, string, DLG_INFO_STR, "Aceptar", "Cancelar");
  661.             } else return SendClientMessage(playerid, ROJO, "No existe ese clan");
  662.             return 1;
  663.         }
  664.         return 1;
  665.     }
  666.     return 0;
  667. }
  668.  
  669. public OnPlayerUpdate(playerid)
  670. {
  671.     if(CColor[playerid] == true)
  672.     {
  673.         new
  674.             keys,
  675.             updown,
  676.             leftright,
  677.             Archivo[64];
  678.            
  679.         GetPlayerKeys(playerid, keys, updown, leftright);
  680.        
  681.         if(updown < 0) CSelec[playerid]--;//ARRIBA
  682.         else if(updown > 0) CSelec[playerid]++;//ABAJO
  683.         if(CSelec[playerid] > 4) CSelec[playerid] = 1;
  684.         else if(CSelec[playerid] < 1) CSelec[playerid] = 4;
  685.         if(keys & KEY_FIRE)
  686.         {
  687.             new
  688.                 ColorC = RGBA(COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  689.                
  690.             format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  691.             dini_IntSet(Archivo, "Color", ColorC);
  692.             CColor[playerid] = false;
  693.             COLORES[playerid][0] = 0;//ROJO
  694.             COLORES[playerid][1] = 0;//VERDE
  695.             COLORES[playerid][2] = 0;//AZUL
  696.             COLORES[playerid][3] = 255;//ALPHA
  697.             SetTimerEx("OcultarCombinador", 500, 0, "i", playerid);
  698.             for(new i = 0; i < MAX_PLAYERS; i++)
  699.             {
  700.                 if(IsPlayerConnected(i))
  701.                     if(Clan_ID[playerid] == Clan_ID[i])
  702.                         SetPlayerColor(i, ColorC);
  703.             }
  704.             TogglePlayerControllable(playerid, 1);
  705.             GameTextForPlayer(playerid, "~y~~h~ Color seleccionado", 3000, 4);
  706.         }
  707.         if(leftright > 0)//DERECHA
  708.         {
  709.             if(CSelec[playerid] == 1)//ROJO
  710.             {
  711.                 if(keys & KEY_SPRINT) COLORES[playerid][0] += 5;
  712.                 else COLORES[playerid][0]++;
  713.                 if(COLORES[playerid][0] > 255) COLORES[playerid][0] = 0;
  714.             }
  715.             if(CSelec[playerid] == 2)//VERDE
  716.             {
  717.                 if(keys & KEY_SPRINT) COLORES[playerid][1] += 5;
  718.                 else COLORES[playerid][1]++;
  719.                 if(COLORES[playerid][1] > 255) COLORES[playerid][1] = 0;
  720.             }
  721.             if(CSelec[playerid] == 3)//AZUL
  722.             {
  723.                 if(keys & KEY_SPRINT) COLORES[playerid][2] += 5;
  724.                 else COLORES[playerid][2]++;
  725.                 if(COLORES[playerid][2] > 255) COLORES[playerid][2] = 0;
  726.             }
  727.             if(CSelec[playerid] == 4)//ALPHA
  728.             {
  729.                 if(keys & KEY_SPRINT) COLORES[playerid][3] += 5;
  730.                 else COLORES[playerid][3]++;
  731.                 if(COLORES[playerid][3] > 255) COLORES[playerid][3] = 0;
  732.             }
  733.        
  734.         }
  735.         if(leftright < 0)//IZQUIERDA
  736.         {
  737.             if(CSelec[playerid] == 1)//ROJO
  738.             {
  739.                 if(keys & KEY_SPRINT) COLORES[playerid][0] -= 5;
  740.                 else COLORES[playerid][0]--;
  741.                 if(COLORES[playerid][0] < 0) COLORES[playerid][0] = 255;
  742.             }
  743.             if(CSelec[playerid] == 2)//VERDE
  744.             {
  745.                 if(keys & KEY_SPRINT) COLORES[playerid][1] -= 5;
  746.                 else COLORES[playerid][1]--;
  747.                 if(COLORES[playerid][1] < 0) COLORES[playerid][1] = 255;
  748.             }
  749.             if(CSelec[playerid] == 3)//AZUL
  750.             {
  751.                 if(keys & KEY_SPRINT) COLORES[playerid][2] -= 5;
  752.                 else COLORES[playerid][2]--;
  753.                 if(COLORES[playerid][2] < 0) COLORES[playerid][2] = 255;
  754.             }
  755.             if(CSelec[playerid] == 4)//ALHPA
  756.             {
  757.                 if(keys & KEY_SPRINT) COLORES[playerid][3] -= 5;
  758.                 else COLORES[playerid][3]--;
  759.                 if(COLORES[playerid][3] < 0) COLORES[playerid][3] = 255;
  760.             }
  761.         }
  762.         ActualizarCombinador(playerid);
  763.     }
  764.     return 1;
  765. }
  766.  
  767. forward ActualizarCombinador(playerid);
  768. public ActualizarCombinador(playerid)
  769. {
  770.     new
  771.         str[128],
  772.         ColorS = RGBA(COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  773.  
  774.     if(CSelec[playerid] == 1) {
  775.         format(str, sizeof str, "~w~>~r~ ROJO   ~<~ %03d ~>~ ~n~~g~ VERDE ~<~ %03d ~>~ ~n~~b~ AZUL   ~<~ %03d ~>~ ~n~~w~ ALPHA ~<~ %03d ~>~",
  776.         COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  777.     }
  778.     if(CSelec[playerid] == 2) {
  779.         format(str, sizeof str, "~r~ ROJO   ~<~ %03d ~>~ ~n~~w~>~g~ VERDE ~<~ %03d ~>~ ~n~~b~ AZUL   ~<~ %03d ~>~ ~n~~w~ ALPHA ~<~ %03d ~>~",
  780.         COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  781.     }
  782.     if(CSelec[playerid] == 3) {
  783.         format(str, sizeof str, "~r~ ROJO   ~<~ %03d ~>~ ~n~~g~ VERDE ~<~ %03d ~>~ ~n~~w~>~b~ AZUL   ~<~ %03d ~>~ ~n~~w~ ALPHA ~<~ %03d ~>~",
  784.         COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  785.     }
  786.     if(CSelec[playerid] == 4) {
  787.         format(str, sizeof str, "~r~ ROJO   ~<~ %03d ~>~ ~n~~g~ VERDE ~<~ %03d ~>~ ~n~~b~ AZUL   ~<~ %03d ~>~ ~n~~w~>~w~ ALPHA ~<~ %03d ~>~",
  788.         COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  789.     }
  790.     TextDrawSetString(Comb[playerid], str);
  791.    
  792.     format(str, sizeof str, "~y~0x%x%x%x%x", COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  793.     TextDrawSetString(NumColor[playerid], str);
  794.    
  795.     TextDrawHideForPlayer(playerid, Color[playerid]);
  796.     TextDrawDestroy(Color[playerid]);
  797.    
  798.     Color[playerid] = TextDrawCreate(9.000000, 255.000000, "CAJA");
  799.     TextDrawBackgroundColor(Color[playerid], 0);
  800.     TextDrawFont(Color[playerid], 1);
  801.     TextDrawLetterSize(Color[playerid], 1.630000, 2.099999);
  802.     TextDrawColor(Color[playerid], 0);
  803.     TextDrawSetProportional(Color[playerid], 1);
  804.     TextDrawUseBox(Color[playerid], 1);
  805.     TextDrawBoxColor(Color[playerid], ColorS);
  806.     TextDrawTextSize(Color[playerid], 153.000000, 0.000000);
  807.    
  808.     TextDrawShowForPlayer(playerid, Color[playerid]);
  809. }
  810.  
  811. forward MostrarCombinador(playerid);
  812. public MostrarCombinador(playerid)
  813. {
  814.     NumColor[playerid] = TextDrawCreate(9.000000, 237.000000, "~y~0x00000000");
  815.     TextDrawBackgroundColor(NumColor[playerid], 255);
  816.     TextDrawFont(NumColor[playerid], 1);
  817.     TextDrawLetterSize(NumColor[playerid], 0.500000, 1.000000);
  818.     TextDrawColor(NumColor[playerid], -1);
  819.     TextDrawSetOutline(NumColor[playerid], 0);
  820.     TextDrawSetProportional(NumColor[playerid], 1);
  821.     TextDrawSetShadow(NumColor[playerid], 1);
  822.     TextDrawUseBox(NumColor[playerid], 1);
  823.     TextDrawBoxColor(NumColor[playerid], 1684300900);
  824.     TextDrawTextSize(NumColor[playerid], 153.000000, 0.000000);
  825.  
  826.     Color[playerid] = TextDrawCreate(9.000000, 255.000000, "CAJA");
  827.     TextDrawBackgroundColor(Color[playerid], 0);
  828.     TextDrawFont(Color[playerid], 1);
  829.     TextDrawLetterSize(Color[playerid], 1.630000, 2.099999);
  830.     TextDrawColor(Color[playerid], 0);
  831.     TextDrawSetProportional(Color[playerid], 1);
  832.     TextDrawUseBox(Color[playerid], 1);
  833.     TextDrawBoxColor(Color[playerid], 0);
  834.     TextDrawTextSize(Color[playerid], 153.000000, 0.000000);
  835.  
  836.     CComb[playerid] = TextDrawCreate(9.000000, 283.000000, "CAJA");
  837.     TextDrawBackgroundColor(CComb[playerid], 0);
  838.     TextDrawFont(CComb[playerid], 1);
  839.     TextDrawLetterSize(CComb[playerid], 1.630000, 5.100001);
  840.     TextDrawColor(CComb[playerid], 0);
  841.     TextDrawSetOutline(CComb[playerid], 0);
  842.     TextDrawSetProportional(CComb[playerid], 1);
  843.     TextDrawSetShadow(CComb[playerid], 1);
  844.     TextDrawUseBox(CComb[playerid], 1);
  845.     TextDrawBoxColor(CComb[playerid], 1684300900);
  846.     TextDrawTextSize(CComb[playerid], 153.000000, 0.000000);
  847.  
  848.     Comb[playerid] = TextDrawCreate(9.000000, 280.000000, "~r~ ROJO   ~<~ 255 ~>~ ~n~~g~ VERDE ~<~ 255 ~>~ ~n~~b~ AZUL   ~<~ 255 ~>~ ~n~~w~ ALPHA ~<~ 255 ~>~");
  849.     TextDrawBackgroundColor(Comb[playerid], 255);
  850.     TextDrawFont(Comb[playerid], 2);
  851.     TextDrawLetterSize(Comb[playerid], 0.400000, 1.400000);
  852.     TextDrawColor(Comb[playerid], -1);
  853.     TextDrawSetOutline(Comb[playerid], 0);
  854.     TextDrawSetProportional(Comb[playerid], 1);
  855.     TextDrawSetShadow(Comb[playerid], 1);
  856.  
  857.     TextDrawShowForPlayer(playerid, NumColor[playerid]);
  858.     TextDrawShowForPlayer(playerid, Color[playerid]);
  859.     TextDrawShowForPlayer(playerid, CComb[playerid]);
  860.     TextDrawShowForPlayer(playerid, Comb[playerid]);
  861. }
  862.  
  863. forward OcultarCombinador(playerid);
  864. public OcultarCombinador(playerid)
  865. {
  866.     TextDrawHideForPlayer(playerid, NumColor[playerid]);
  867.     TextDrawHideForPlayer(playerid, Color[playerid]);
  868.     TextDrawHideForPlayer(playerid, CComb[playerid]);
  869.     TextDrawHideForPlayer(playerid, Comb[playerid]);
  870.  
  871.     TextDrawDestroy(NumColor[playerid]);
  872.     TextDrawDestroy(Color[playerid]);
  873.     TextDrawDestroy(CComb[playerid]);
  874.     TextDrawDestroy(Comb[playerid]);
  875. }
  876.  
  877. forward ActualizarListaJugadores();
  878. public ActualizarListaJugadores()
  879. {
  880.     new
  881.         File:file,
  882.         bool:Existe = false,
  883.         string[128],
  884.         str[32];
  885.  
  886.     for(new i = 0; i < MAX_PLAYERS; i++)
  887.     {
  888.         if(IsPlayerConnected(i))
  889.         {
  890.             if(Ingresado[i] == true)
  891.             {
  892.                 format(str, sizeof(str), "%s;", Nickname[i]);
  893.                 file = fopen("Jugadores.txt", io_read);
  894.                 while(fread(file, string))
  895.                 {
  896.                     if(strfind(string, str, true) == 0)
  897.                     {
  898.                         Existe = true;
  899.                     }
  900.                 }
  901.                 fclose(file);
  902.                 if(Existe == false)
  903.                 {
  904.                     file = fopen("Jugadores.txt", io_append);
  905.                     format(string, sizeof(string), "%s;\r\n", Nickname[i]);
  906.                     fwrite(file, string);
  907.                     fclose(file);
  908.                 }
  909.             }
  910.         }
  911.         Existe = false;
  912.     }
  913. }
  914.  
  915.  
  916. forward ActualizarTopClanes();
  917. public ActualizarTopClanes()
  918. {
  919.     new
  920.         File:file,
  921.         Archivo[64],
  922.         string[128],
  923.         Linea,
  924.         Lugar,
  925.         Float:MAX_VALOR = -1.0;
  926.  
  927.     //EXTRAER DATOS DEL ARCHIVO "Clanes.txt"
  928.     file = fopen("Clanes.txt", io_read);
  929.     while(fread(file, string))
  930.     {
  931.         new
  932.             v = strfind(string, ";", true);
  933.            
  934.         strmid(NOMBRE[Linea], string, 0, v, 24);
  935.         format(Archivo, sizeof Archivo, "Clanes/%s.ini", NOMBRE[Linea]);
  936.         if(dini_Exists(Archivo))
  937.         {
  938.             VALOR[Linea] = dini_Float(Archivo, "Ratio");
  939.         }
  940.         Linea++;
  941.     }
  942.     fclose(file);
  943.     //SACAR LUGARES Y GUARDARLOS
  944.     Lugar = 1;
  945.     while(Lugar < MAX_TOP_CLANES+1)
  946.     {
  947.         for(new i = 0; i < MAX_DATOS; i++)
  948.         {
  949.             if(EnTop[i] == false)
  950.             {
  951.                 if(VALOR[i] > MAX_VALOR)
  952.                 {
  953.                     MAX_VALOR = VALOR[i];
  954.                     TopC[Lugar] = i;
  955.                 }
  956.             }
  957.         }
  958.         strmid(TopInfoC[Lugar][NickTOP], NOMBRE[TopC[Lugar]], 0, strlen(NOMBRE[TopC[Lugar]]), 24);
  959.         format(Archivo, sizeof Archivo, "Clanes/%s.ini", TopInfoC[Lugar][NickTOP]);
  960.         TopInfoC[Lugar][AsesinatosTOP] =  dini_Int(Archivo, "Asesinatos");
  961.         TopInfoC[Lugar][MuertesTOP] = dini_Int(Archivo, "Muertes");
  962.         TopInfoC[Lugar][RatioTOP] = dini_Float(Archivo, "Ratio");
  963.         EnTop[TopC[Lugar]] = true;
  964.         MAX_VALOR = -1;
  965.         Lugar++;
  966.     }
  967.     //RESETEAR DATOS:
  968.     for(new s = 0; s < MAX_DATOS; s++)
  969.     {
  970.         EnTop[s] = false;
  971.         NOMBRE[s][0] = 0;
  972.         VALOR[s] = 0.0;
  973.     }
  974.     //GUARDAR DATOS EN UNA CADENA DE CARACTERES
  975.     format(DLG_TOP_CLAN_STR, sizeof DLG_TOP_CLAN_STR, "");
  976.     Lugar = 1;
  977.     while(Lugar < MAX_TOP_CLANES+1)
  978.     {
  979.         format(DLG_TOP_CLAN_STR, sizeof DLG_TOP_CLAN_STR,
  980.         "%s| %02d | %s | Asesinatos: %d | Muertes: %d | Ratio: %0.0f|\n",
  981.         DLG_TOP_CLAN_STR, Lugar, TopInfoC[Lugar][NickTOP], TopInfoC[Lugar][AsesinatosTOP],
  982.         TopInfoC[Lugar][MuertesTOP], TopInfoC[Lugar][RatioTOP]);
  983.         Lugar++;
  984.     }
  985.     SetTimer("ActualizarTopClanes", 62000, 0);
  986. }
  987.  
  988. forward ActualizarTopPlayers();
  989. public ActualizarTopPlayers()
  990. {
  991.     new
  992.         File:file,
  993.         Archivo[64],
  994.         string[128],
  995.         Linea,
  996.         Lugar,
  997.         Float:MAX_VALOR = -1.0;
  998.  
  999.     //EXTRAER DATOS DEL ARCHIVO "Jugadores.txt"
  1000.     file = fopen("Jugadores.txt", io_read);
  1001.     while(fread(file, string))
  1002.     {
  1003.         new
  1004.             v = strfind(string, ";", true);
  1005.            
  1006.         strmid(NOMBRE[Linea], string, 0, v, 24);
  1007.         format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", NOMBRE[Linea]);
  1008.         if(dini_Exists(Archivo))
  1009.         {
  1010.             VALOR[Linea] = dini_Float(Archivo, "Ratio");
  1011.         }
  1012.         Linea++;
  1013.     }
  1014.     fclose(file);
  1015.     //SACAR LUGARES Y GUARDARLOS
  1016.     Lugar = 1;
  1017.     while(Lugar < MAX_TOP_PLAYERS+1)
  1018.     {
  1019.         for(new i = 0; i < MAX_DATOS; i++)
  1020.         {
  1021.             if(EnTop[i] == false)
  1022.             {
  1023.                 if(VALOR[i] > MAX_VALOR)
  1024.                 {
  1025.                     MAX_VALOR = VALOR[i];
  1026.                     TopP[Lugar] = i;
  1027.                 }
  1028.             }
  1029.         }
  1030.         strmid(TopInfoP[Lugar][NickTOP], NOMBRE[TopP[Lugar]], 0, strlen(NOMBRE[TopP[Lugar]]), 24);
  1031.         format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", TopInfoP[Lugar][NickTOP]);
  1032.         TopInfoP[Lugar][AsesinatosTOP] =  dini_Int(Archivo, "Asesinatos");
  1033.         TopInfoP[Lugar][MuertesTOP] = dini_Int(Archivo, "Muertes");
  1034.         TopInfoP[Lugar][RatioTOP] = dini_Float(Archivo, "Ratio");
  1035.         EnTop[TopP[Lugar]] = true;
  1036.         MAX_VALOR = -1;
  1037.         Lugar++;
  1038.     }
  1039.     //RESETEAR DATOS:
  1040.     for(new s = 0; s < MAX_DATOS; s++)
  1041.     {
  1042.         EnTop[s] = false;
  1043.         NOMBRE[s][0] = 0;
  1044.         VALOR[s] = 0.0;
  1045.     }
  1046.     //GUARDAR DATOS EN UNA CADENA DE CARACTERES
  1047.     format(DLG_TOP_PLY_STR, sizeof(DLG_TOP_PLY_STR),"");
  1048.     Lugar = 1;
  1049.     while(Lugar < MAX_TOP_PLAYERS+1)
  1050.     {
  1051.         format(DLG_TOP_PLY_STR, sizeof(DLG_TOP_PLY_STR),
  1052.         "%s| %02d | %s | Asesinatos: %d | Muertes: %d | Ratio: %0.0f|\n",
  1053.         DLG_TOP_PLY_STR, Lugar, TopInfoP[Lugar][NickTOP], TopInfoP[Lugar][AsesinatosTOP],
  1054.         TopInfoP[Lugar][MuertesTOP], TopInfoP[Lugar][RatioTOP]);
  1055.         Lugar++;
  1056.     }
  1057.     SetTimer("ActualizarTopPlayers", 60000, 0);
  1058.     SetTimer("ActualizarListaJugadores", 10000, 0);
  1059. }
  1060.  
  1061. stock Registrar(playerid, pass[])
  1062. {
  1063.     new
  1064.         Archivo[64],
  1065.         str[128];
  1066.  
  1067.     format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", NickName(playerid));
  1068.     if(!dini_Exists(Archivo))
  1069.     {
  1070.         dini_Create(Archivo);
  1071.         dini_Set(Archivo, "Contrasena", pass);
  1072.         dini_IntSet(Archivo, "Asesinatos", 0);
  1073.         dini_IntSet(Archivo, "Muertes", 0);
  1074.         dini_FloatSet(Archivo, "Ratio", 0.0);
  1075.         dini_Set(Archivo, "Clan", "<Ninguno>");
  1076.         format(str, sizeof(str), "Nick '%s' registrado. Contrasena: '%s' ", NickName(playerid), pass);
  1077.         SendClientMessage(playerid, NICESKY, str);
  1078.         Registrado[playerid] = true;
  1079.         SendClientMessage(playerid, NARANJA, "Ahora usa /login [contraseña]");
  1080.     }
  1081. }
  1082.  
  1083. stock Login(playerid, pass[])
  1084. {
  1085.     new
  1086.         Archivo[64],
  1087.         Nick[MAX_PLAYER_NAME];
  1088.  
  1089.     format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", NickName(playerid));
  1090.     if(dini_Exists(Archivo))
  1091.     {
  1092.         if(!strcmp(dini_Get(Archivo, "Contrasena"), pass, false))
  1093.         {
  1094.             strmid(Nickname[playerid], NickName(playerid), 0, MAX_PLAYER_NAME, MAX_PLAYER_NAME);
  1095.             Asesinatos[playerid] = dini_Int(Archivo, "Asesinatos");
  1096.             Muertes[playerid] = dini_Int(Archivo, "Muertes");
  1097.             Ratio[playerid] = dini_Float(Archivo, "Ratio");
  1098.             Ingresado[playerid] = true;
  1099.             format(Archivo, sizeof Archivo, "Clanes/%s.ini", dini_Get(Archivo, "Clan"));
  1100.             if(dini_Exists(Archivo))
  1101.             {
  1102.                 format(Clan_TAG[playerid], 4, dini_Get(Archivo, "TAG"));
  1103.                 format(Nick, sizeof Nick, "[%s]%s", Clan_TAG[playerid], Nickname[playerid]);
  1104.                 SetPlayerName(playerid, Nick);
  1105.                 SetPlayerColor(playerid, dini_Int(Archivo, "Color"));
  1106.                 Clan_ID[playerid] = dini_Int(Archivo, "ID");
  1107.                 EnClan[playerid] = true;
  1108.             }
  1109.             SendClientMessage(playerid, NICESKY, "Logueado Correctamente");
  1110.         } else SendClientMessage(playerid, ROJO, "Contraseña Incorrecta");
  1111.     }
  1112. }
  1113.  
  1114. stock NickName(playerid)
  1115. {
  1116.     new
  1117.         NickP[MAX_PLAYER_NAME];
  1118.  
  1119.     GetPlayerName(playerid, NickP, MAX_PLAYER_NAME);
  1120.     return NickP;
  1121. }
  1122.  
  1123. //Por Zamaroht
  1124. stock RGBA(red, green, blue, alpha)
  1125. {
  1126.     return (red * 16777216) + (green * 65536) + (blue * 256) + alpha;
  1127. }
  1128.  
  1129. //Por Zoutdaxv
  1130. stock IsAHexNumber(string[])
  1131. {
  1132.     new
  1133.         longitud = strlen(string);
  1134.  
  1135.     if(longitud == 0) return false;
  1136.    
  1137.     for(new s = 0; s < longitud; s++)
  1138.     {
  1139.         if(string[s] < 48 || string[s] > 57 && string[s] < 65 || string[s] > 70)
  1140.         {
  1141.             return false;
  1142.         }
  1143.     }
  1144.     return true;
  1145. }
  1146.  
  1147. //Por Dracoblue
  1148. stock HexToInt(string[])
  1149. {
  1150.     if(string[0] == 0) return 0;
  1151.  
  1152.     new
  1153.         i = strlen(string),
  1154.         cur = 1,
  1155.         res = 0;
  1156.  
  1157.     for( ; i > 0; i--)
  1158.     {
  1159.         if(string[i-1] < 58) res = res + cur * (string[i-1] - 48);
  1160.         else res = res + cur * (string[i-1] - 55);
  1161.         cur = cur * 16;
  1162.     }
  1163.     return res;
  1164. }
  1165.  
  1166. //Por Zoutdaxv
  1167. stock DeleteLine(filename[], Line)
  1168. {
  1169.     new
  1170.         string[128],
  1171.         temp[64],
  1172.         File:file,
  1173.         File:filetemp,
  1174.         l = 0;
  1175.  
  1176.     if(!fexist(filename)) return 0;
  1177.     format(temp, sizeof(temp), "%s.zzz", filename);
  1178.     filetemp = fopen(temp, io_write);
  1179.     file = fopen(filename, io_read);
  1180.     while(fread(file, string))
  1181.     {
  1182.         l++;
  1183.         if(l == Line) continue;
  1184.         fwrite(filetemp, string);
  1185.     }
  1186.     fclose(file);
  1187.     fclose(filetemp);
  1188.  
  1189.     file = fopen(filename, io_write);
  1190.     filetemp = fopen(temp, io_read);
  1191.     while(fread(filetemp, string))
  1192.     {
  1193.         fwrite(file, string);
  1194.     }
  1195.     fclose(file);
  1196.     fclose(filetemp);
  1197.     fremove(temp);
  1198.     return 1;
  1199. }
  1200.  
  1201. stock strtok(const string[], &index)
  1202. {
  1203.     new length = strlen(string);
  1204.     while ((index < length) && (string[index] <= ' '))
  1205.     {
  1206.         index++;
  1207.     }
  1208.  
  1209.     new offset = index;
  1210.     new result[20];
  1211.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  1212.     {
  1213.         result[index - offset] = string[index];
  1214.         index++;
  1215.     }
  1216.     result[index - offset] = EOS;
  1217.     return result;
  1218. }
  1219.  
  1220. stock strrest(const string[], &index)
  1221. {
  1222.     new length = strlen(string);
  1223.     while ((index < length) && (string[index] <= ' '))
  1224.     {
  1225.         index++;
  1226.     }
  1227.     new offset = index;
  1228.     new result[24];
  1229.     while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
  1230.     {
  1231.         result[index - offset] = string[index];
  1232.         index++;
  1233.     }
  1234.     result[index - offset] = EOS;
  1235.     return result;
  1236. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement