MrMegaTx

XD

Nov 28th, 2011
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 74.73 KB | None | 0 0
  1. /*********** Sistema Registro & Clanes con Tops DINI & [C]Admin ***************/
  2. //==============================================================================
  3. // # Sistema Registro & Clanes con Tops DINI & [C]Admin
  4. // # Autor: Zoutdaxv. .ConecCionMex. .Infierno
  5. // # Versión: 0.4
  6. // # Fecha: 20/Feb/2010
  7. // # Actualizado: 05/Jun/2010
  8. // # Creditos:
  9. // - Infierno Sistema de Clanes en DINI
  10. // - » RyDeR «: idea In Game ColorPicker (Sin copiar & pegar).
  11. // - Zamaroht: TDE & Función RGB.
  12. // - ConecCionMex y CristianDJ[C]Admin Sistema de Admistracion
  13. //==============================================================================
  14. #include <a_samp>
  15. #include <dini>
  16. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  17. //==============================================================================
  18. #define DLG_TOP_PLAYERS 1500
  19. #define DLG_TOP_CLANES 1501
  20. #define DLG_PLY_INFO 1503
  21. #define DLG_CLAN_INFO 1504
  22. //==============================================================================
  23. /* -= Colores =- */
  24. #define Azul 0x375FFFFF
  25. #define Rojo 0xFF0000FF
  26. #define Verde 0x00FF00FF
  27. #define Amarillo 0xFFFF00AA5
  28. #define Naranja 0xFF8000FF
  29. #define ROJO 0xAA3333AA
  30. #define NARANJA 0xF97804FF
  31. #define BLANCO 0xEFEFF7AA
  32. #define LIGHTBLUE 0x00C2ECFF
  33. #define NICESKY 0x99FFFFAA
  34. //==============================================================================
  35. //TOP PLAYERS & TOP CLANES
  36. enum info
  37. {
  38. NickTOP[32],
  39. AsesinatosTOP,
  40. MuertesTOP,
  41. Float:RatioTOP,
  42. Nivel,
  43. Tsay,
  44. Congelado,
  45. CongelarTiempo,
  46. Carcel,
  47. CarcelTiempo
  48. };
  49. new TopInfo[11][info];
  50. new Conteo;
  51. new Menu:armas;
  52. new SaltosBici[MAX_PLAYERS];
  53. new CarcelTimer[MAX_PLAYERS];
  54. new CongelarTimer[MAX_PLAYERS];
  55. new sendername[MAX_PLAYER_NAME];
  56. new PlayerInfo[MAX_PLAYERS][info];
  57. new Top[11];
  58. new NOMBRE[3000][32];
  59. new Float:VALOR[3000];
  60. new EnTop[3000];
  61. //==============================================================================
  62. //Strings diálogos:
  63. new DLG_TOP_PLY_STR[1024];
  64. new DLG_TOP_CLAN_STR[1024];
  65. new DLG_INFO_PLY_STR[1024];
  66. new DLG_INFO_CLAN_STR[1024];
  67. //==============================================================================
  68. //JUGADORES:
  69. new bool:Registrado[MAX_PLAYERS] = false;
  70. new bool:Ingresado[MAX_PLAYERS] = false;
  71. new Nickname[MAX_PLAYERS][MAX_PLAYER_NAME];
  72. new Asesinatos[MAX_PLAYERS];
  73. new Muertes[MAX_PLAYERS];
  74. new Float:Ratio[MAX_PLAYERS];
  75. //Combinador de colores:
  76. new bool:CColor[MAX_PLAYERS] = false;
  77. new CSelec[MAX_PLAYERS] = 1;
  78. new COLORES[MAX_PLAYERS][4];//0 ROJO, 1 VERDE, 2 AZUL, 3 Transparencia
  79. //==============================================================================
  80. //TextDraws Combinador de colores
  81. new Text:NumColor[MAX_PLAYERS];
  82. new Text:Color[MAX_PLAYERS];
  83. new Text:CComb[MAX_PLAYERS];
  84. new Text:Comb[MAX_PLAYERS];
  85. //==============================================================================
  86. //CLANES:
  87. new Clan_TAG[MAX_PLAYERS][4];
  88. new Clan_ID[MAX_PLAYERS];
  89. new Invitacion[MAX_PLAYERS][32];
  90. new bool:EnClan[MAX_PLAYERS];
  91. //==============================================================================
  92. new PlayerColors[200] = {
  93. 0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,
  94. 0xFF1493FF,0xF4A460FF,0xEE82EEFF,0xFFD720FF,0x8b4513FF,0x4949A0FF,0x148b8bFF,
  95. 0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,
  96. 0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,0x5C1ACCFF,
  97. 0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,0x275222FF,0xF09F5BFF,
  98. 0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,
  99. 0xE9AB2FFF,0xAF2FF3FF,0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,
  100. 0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,0x4B8987FF,0x491B9EFF,
  101. 0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,
  102. 0x48C000FF,0x2A51E2FF,0xE3AC12FF,0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,
  103. 0x42ACF5FF,0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,
  104. 0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,
  105. 0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,0x9F945CFF,0xDCDE3DFF,0x10C9C5FF,
  106. 0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,
  107. 0xD8C762FF,0xD8C762FF,0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,
  108. 0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,0xEE82EEFF,0xFFD720FF,0x8b4513FF,
  109. 0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0x534081FF,
  110. 0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,
  111. 0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,
  112. 0x275222FF,0xF09F5BFF,0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,
  113. 0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,0x057F94FF,0xB98519FF,0x388EEAFF,
  114. 0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,
  115. 0x4B8987FF,0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,
  116. 0x3C1C0DFF,0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF,0xFC42A8FF,0x2FC827FF,
  117. 0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,
  118. 0x94436EFF,0xC1F7ECFF,0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,0x184D3BFF,
  119. 0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,0x9F945CFF,
  120. 0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,
  121. 0xE59338FF,0xEEDC2DFF,0xD8C762FF,0xD8C762FF
  122. };
  123.  
  124. public OnFilterScriptInit()
  125. {
  126. new
  127. Archivo[64];
  128.  
  129. print("\n/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/");
  130. print("/=/=/=/=/=Sistema De Clanes-Dini-=/=/=/=/");
  131. print("/=/=/=/=/=/=/=/= -Mas- =/=/=/=/=/=/=/=/=/");
  132. print("/=/=/= -Sistema de Administracion- =/=/=/");
  133. print("/=/=/=/=-Infierno + ConecCionMex-=/=/=/=/");
  134. print("/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/\n");
  135. SetTimer("ActualizarListaJugadores", 1500, 0);
  136. SetTimer("ActualizarTopPlayers", 3500, 0);
  137. SetTimer("ActualizarTopClanes", 5000, 0);
  138.  
  139. format(Archivo, sizeof Archivo, "Clan.ini");
  140. if(!dini_Exists(Archivo)) {
  141. dini_Create(Archivo);
  142. dini_IntSet(Archivo, "Clanes_Creados", 0);
  143. }
  144. if(!fexist("Jugadores.txt")) {
  145. new
  146. File:file = fopen("Jugadores.txt", io_write);
  147.  
  148. fclose(file);
  149. }
  150. if(!fexist("Clanes.txt")) {
  151. new
  152. File:file = fopen("Clanes.txt", io_write);
  153.  
  154. fclose(file);
  155. }
  156. return 1;
  157. }
  158.  
  159. //==============================================================================
  160. public OnPlayerRequestSpawn(playerid)
  161. {
  162. SaltosBici[playerid] = 0;
  163. return 1;
  164. }
  165.  
  166. public OnPlayerConnect(playerid)
  167. {
  168. new
  169. Archivo[64];
  170.  
  171. GetPlayerName(playerid, Nickname[playerid], MAX_PLAYER_NAME);
  172. if(strfind(Nickname[playerid], "[", true) != -1 || strfind(Nickname[playerid], "]", true) != -1)
  173. {
  174. SendClientMessage(playerid, ROJO, "Tu nick no puede contener corchetes");
  175. return Kick(playerid);
  176. }
  177. //Verificar registro:
  178. format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", Nickname[playerid]);
  179. if(dini_Exists(Archivo)) Registrado[playerid] = true;
  180. SetPlayerColor(playerid, PlayerColors[playerid]);
  181.  
  182. return 1;
  183. }
  184.  
  185. public OnPlayerDisconnect(playerid, reason)
  186. {
  187. new file[MAX_PLAYERS];
  188.  
  189. Invitacion[playerid][0] = 0;
  190. Clan_ID[playerid] = 0;
  191. Clan_TAG[playerid][0] = 0;
  192. EnClan[playerid] = false;
  193. Registrado[playerid] = false;
  194. Ingresado[playerid] = false;
  195. Asesinatos[playerid] = 0;
  196. Muertes[playerid] = 0;
  197. Ratio[playerid] = 0.0;
  198. dini_IntSet(file, "Nivel", PlayerInfo[playerid][Nivel]);
  199. //==========================//
  200. new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
  201. GetPlayerName(playerid, pname, sizeof(pname));
  202. switch(reason)
  203. {
  204. case 0: format(string, sizeof(string), "%s Ha salido Del Server.[[(Crash]]", pname);
  205. case 1: format(string, sizeof(string), "%s Ha salido Del Server. ", pname);
  206. case 2: format(string, sizeof(string), "%s Ha salido Del Server. [[Kick/Ban]]", pname);
  207. }
  208. SendClientMessageToAll(Amarillo, string);
  209. //===================================
  210. new Nombre[MAX_PLAYERS]; GetPlayerName(playerid, Nombre, sizeof(Nombre));
  211. format(file, sizeof(file), "Sadmin/Jugadores/%s.ini", Nombre);
  212. return 1;
  213. }
  214.  
  215. public OnPlayerDeath(playerid, killerid, reason)
  216. {
  217. new
  218. Archivo[64],
  219. TempMuertes,
  220. TempAsesinatos;
  221.  
  222. Muertes[playerid]++;
  223. Ratio[playerid] = float(Asesinatos[playerid]) / float(Muertes[playerid]);
  224.  
  225. if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
  226. {
  227. Asesinatos[killerid]++;
  228. if(Muertes[killerid] == 0) Ratio[killerid] = float(Asesinatos[playerid]);
  229. else Ratio[killerid] = float(Asesinatos[killerid]) / float(Muertes[killerid]);
  230. }
  231. if(IsPlayerConnected(playerid) && Ingresado[playerid] == true)
  232. {
  233. format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", Nickname[playerid]);
  234. if(dini_Exists(Archivo))
  235. {
  236. dini_IntSet(Archivo, "Muertes", Muertes[playerid]);
  237. dini_FloatSet(Archivo, "Ratio", Ratio[playerid]);
  238. }
  239. if(EnClan[playerid] == true)
  240. {
  241. format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  242. if(dini_Exists(Archivo))
  243. {
  244. dini_IntSet(Archivo, "Muertes", dini_Int(Archivo, "Muertes")+1);
  245. dini_FloatSet(Archivo, "Ratio", float(dini_Int(Archivo, "Asesinatos")) / float(dini_Int(Archivo, "Muertes")));
  246. }
  247. }
  248. }
  249. if(IsPlayerConnected(killerid) && Ingresado[killerid] == true && killerid != INVALID_PLAYER_ID)
  250. {
  251. format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", Nickname[killerid]);
  252. if(dini_Exists(Archivo))
  253. {
  254. dini_IntSet(Archivo, "Asesinatos", Asesinatos[killerid]);
  255. dini_FloatSet(Archivo, "Ratio", Ratio[killerid]);
  256. }
  257. if(EnClan[killerid] == true)
  258. {
  259. format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[killerid]);
  260. if(dini_Exists(Archivo))
  261. {
  262. TempMuertes = dini_Int(Archivo, "Muertes");
  263. TempAsesinatos = dini_Int(Archivo, "Asesinatos");
  264. dini_IntSet(Archivo, "Asesinatos", TempAsesinatos+1);
  265. if(TempMuertes == 0) dini_FloatSet(Archivo, "Ratio", float(TempAsesinatos));
  266. else dini_FloatSet(Archivo, "Ratio", float(TempAsesinatos) / float(TempMuertes));
  267. }
  268. }
  269. }
  270. return 1;
  271. }
  272.  
  273. public OnPlayerText(playerid, text[])
  274. {
  275. new
  276. Nick[MAX_PLAYER_NAME],
  277. texto[128];
  278.  
  279. if(text[0] == '!' && EnClan[playerid] == true)
  280. {
  281. GetPlayerName(playerid, Nick, MAX_PLAYER_NAME);
  282. format(texto, sizeof texto, "%s: %s", Nick, text[1]);
  283. for(new i = 0; i < MAX_PLAYERS; i++)
  284. {
  285. if(IsPlayerConnected(i))
  286. {
  287. if(EnClan[i] == EnClan[playerid])
  288. {
  289. SendClientMessage(playerid, LIGHTBLUE, texto);
  290. }
  291. }
  292. }
  293. return 0;
  294. }
  295. return 1;
  296. }
  297.  
  298. public OnPlayerCommandText(playerid, cmdtext[])
  299. {
  300. new
  301. cmd[20],
  302. tmp[20],
  303. tmp2[20],
  304. tmp3[24],
  305. string[64],
  306. Archivo[64],
  307. Nick[MAX_PLAYER_NAME],
  308. longitud,
  309. id,
  310. File:file,
  311. idx;
  312.  
  313. cmd = strtok(cmdtext, idx);
  314.  
  315. if(!strcmp("/kill", cmd, true))
  316. {
  317. SetPlayerHealth(playerid, 0.0);
  318. return 1;
  319. }
  320. if(!strcmp("/register", cmd, true))
  321. {
  322. if(Registrado[playerid] == true) return SendClientMessage(playerid, ROJO, "Ya estás registrado");
  323. tmp = strtok(cmdtext, idx);
  324. longitud = strlen(tmp);
  325. if(longitud == 0) return SendClientMessage(playerid, BLANCO, "Uso /register [Contraseña]");
  326. if(longitud < 3 || longitud > 16)
  327. {
  328. return SendClientMessage(playerid, ROJO, "La contraseña debe tener de 3 a 16 caracteres");
  329. }
  330. Registrar(playerid, tmp);
  331. return 1;
  332. }
  333. if(!strcmp("/login", cmd, true))
  334. {
  335. if(Registrado[playerid] == false) return SendClientMessage(playerid, ROJO, "No estás registrado");
  336. if(Ingresado[playerid] == true) return SendClientMessage(playerid, ROJO, "Ya estás logueado");
  337. tmp = strtok(cmdtext, idx);
  338. longitud = strlen(tmp);
  339. if(longitud == 0) return SendClientMessage(playerid, BLANCO, "Uso /login [Contraseña]");
  340. Login(playerid, tmp);
  341. return 1;
  342. }
  343. if(!strcmp(cmd, "/stats", true))
  344. {
  345. tmp = strtok(cmdtext, idx);
  346. if(!strlen(tmp)) return SendClientMessage(playerid, BLANCO, "Usa: /stats [id]");
  347. id = strval(tmp);
  348. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, ROJO, "Jugador no conectado");
  349. if(Ingresado[id] == false) return SendClientMessage(playerid, ROJO, "Ese jugador no está ingresado");
  350. format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", Nickname[id]);
  351. format(DLG_INFO_PLY_STR, sizeof DLG_INFO_PLY_STR, "~.~");
  352. if(dini_Exists(Archivo))
  353. {
  354. format(DLG_INFO_PLY_STR, sizeof DLG_INFO_PLY_STR, "Asesinatos: %d\n", dini_Int(Archivo, "Asesinatos"));
  355. format(DLG_INFO_PLY_STR, sizeof DLG_INFO_PLY_STR, "%sMuertes: %d\n", DLG_INFO_PLY_STR, dini_Int(Archivo, "Muertes"));
  356. format(DLG_INFO_PLY_STR, sizeof DLG_INFO_PLY_STR, "%sRatio: %d\n", DLG_INFO_PLY_STR, dini_Float(Archivo, "Ratio"));
  357. format(DLG_INFO_PLY_STR, sizeof DLG_INFO_PLY_STR, "%sClan: [%s]", DLG_INFO_PLY_STR, dini_Get(Archivo, "Clan"));
  358. }
  359. format(string, sizeof string, "Stadísticas de %s (%d)", Nickname[id], id);
  360. ShowPlayerDialog(playerid, DLG_PLY_INFO, DIALOG_STYLE_MSGBOX, string, DLG_INFO_PLY_STR, "Aceptar", "Cancelar");
  361. return 1;
  362. }
  363. if(!strcmp(cmd, "/Topplayers", true))
  364. {
  365. ShowPlayerDialog(playerid, DLG_TOP_PLAYERS, DIALOG_STYLE_LIST, "Top Players", DLG_TOP_PLY_STR, "Aceptar", "Cancelar");
  366. return 1;
  367. }
  368. if(!strcmp(cmd, "/Topclanes", true))
  369. {
  370. ShowPlayerDialog(playerid, DLG_TOP_CLANES, DIALOG_STYLE_LIST, "Top Clanes", DLG_TOP_CLAN_STR, "Aceptar", "Cancelar");
  371. return 1;
  372. }
  373. if(!strcmp(cmd, "/clan", true))
  374. {
  375. tmp = strtok(cmdtext, idx);
  376. if(!strlen(tmp)) return SendClientMessage(playerid, BLANCO, "Usa: /clan [info, crear, invitar, entrar, salir, expulsar, color, colorh] [Nombre] [TAG]");
  377. if(!strcmp(tmp, "crear", true))
  378. {
  379. if(Ingresado[id] == false) return SendClientMessage(playerid, ROJO, "Necesitas estar logueado para usar este comando");
  380. if(EnClan[playerid] == true) return SendClientMessage(playerid, ROJO, "Ya tienes clan");
  381. tmp2 = strtok(cmdtext, idx);
  382. tmp3 = strrest(cmdtext, idx);
  383. if(!strlen(tmp2) || !strlen(tmp3)) return SendClientMessage(playerid, BLANCO, "Usa: /clan crear [TAG] [Nombre]");
  384. if(strlen(tmp2) < 1 || strlen(tmp2) > 3) return SendClientMessage(playerid, ROJO, "Sólo de 1 a 3 caracteres");
  385. if(strlen(tmp3) < 3 || strlen(tmp3) > 24) return SendClientMessage(playerid, ROJO, "Sólo de 3 a 24 caracteres");
  386. if(strfind(tmp2, "[", true) != -1 || strfind(tmp2, "]", true) != -1)
  387. {
  388. return SendClientMessage(playerid, ROJO, "Sin '[' ']' (corchetes) .");
  389. }
  390. format(Archivo, sizeof Archivo, "Clanes/%s.ini", tmp2);
  391. if(!dini_Exists(Archivo))
  392. {
  393. format(Clan_TAG[playerid], 4, "%s", tmp2);
  394. Clan_ID[playerid] = dini_Int("Clan.ini", "Clanes_Creados")+1;
  395. dini_IntSet("Clan.ini", "Clanes_Creados", Clan_ID[playerid]);
  396. dini_Create(Archivo);
  397. dini_IntSet(Archivo, "ID", Clan_ID[playerid]);
  398. dini_Set(Archivo, "Nombre", tmp3);
  399. dini_Set(Archivo, "TAG", tmp2);
  400. dini_IntSet(Archivo, "Color", id);
  401. dini_Set(Archivo, "Lider", Nickname[playerid]);
  402. dini_IntSet(Archivo, "Miembros", 1);
  403. dini_IntSet(Archivo, "Asesinatos", 0);
  404. dini_IntSet(Archivo, "Muertes", 0);
  405. dini_FloatSet(Archivo, "Ratio", 0.0);
  406. dini_Set(Archivo, "Miembro_1", Nickname[playerid]);
  407. for(new l = 2; l < 21; l++)
  408. {
  409. format(string, sizeof string, "Miembro_%d", l);
  410. dini_Set(Archivo, string, "<Vacio>");
  411. }
  412. format(Archivo, sizeof Archivo, "Jugadores/%s.ini", Nickname[playerid]);
  413. dini_Set(Archivo, "Clan", Clan_TAG[playerid]);
  414. file = fopen("Clanes.txt", io_append);
  415. format(string, sizeof(string), "%s;\r\n", Clan_TAG[playerid]);
  416. fwrite(file, string);
  417. fclose(file);
  418. format(Nick, sizeof Nick, "[%s]%s", Clan_TAG[playerid], Nickname[playerid]);
  419. SetPlayerName(playerid, Nick);
  420. SetPlayerColor(playerid, 0);
  421. EnClan[playerid] = true;
  422. format(string, sizeof string, "Has creado el clan '%s' TAG: [%s]", tmp3, tmp2);
  423. SendClientMessage(playerid, LIGHTBLUE, string);
  424. SendClientMessage(playerid, NARANJA, "Usa /clan color para cambiar el color de tu clan");
  425. } else {
  426. SendClientMessage(playerid, ROJO, "El TAG ya está en uso");
  427. }
  428. return 1;
  429. }
  430. if(!strcmp(tmp, "color", true))
  431. {
  432. if(EnClan[playerid] == false) return SendClientMessage(playerid, ROJO, "No tienes clan");
  433. format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  434. if(strcmp(dini_Get(Archivo, "Lider"), Nickname[playerid]) != 0) return SendClientMessage(playerid, ROJO, "Necesitas ser el creador del clan para poder cambiar el color");
  435. if(CColor[playerid] == true) {
  436. OcultarCombinador(playerid);
  437. TogglePlayerControllable(playerid, 1);
  438. CColor[playerid] = false;
  439. } else {
  440. MostrarCombinador(playerid);
  441. TogglePlayerControllable(playerid, 0);
  442. COLORES[playerid][3] = 255;
  443. CColor[playerid] = true;
  444. SendClientMessage(playerid, NICESKY, "Usa /clan color para cancelar");
  445. GameTextForPlayer(playerid, "~w~~h~Presiona ~k~~GO_FORWARD~, ~k~~GO_BACK~, ~n~~w~~h~~k~~GO_LEFT~, ~k~~GO_RIGHT~ y ~k~~PED_SPRINT~ ~w~~h~para cambiar el color ~n~~w~~h~y ~k~~PED_FIREWEAPON~ para seleccionar el color", 7000, 3);
  446. }
  447. return 1;
  448. }
  449. if(!strcmp(tmp, "colorh", true))
  450. {
  451. if(EnClan[playerid] == false) return SendClientMessage(playerid, ROJO, "No tienes clan");
  452. if(strcmp(dini_Get(Archivo, "Lider"), Nickname[playerid]) != 0) return SendClientMessage(playerid, ROJO, "Necesitas ser el creador del clan para poder cambiar el color");
  453. if(CColor[playerid] == true) return SendClientMessage(playerid, ROJO, "Cierra primero el combinador de colores.");
  454. tmp2 = strtok(cmdtext, idx);
  455. longitud = strlen(tmp2);
  456. if(!longitud) return SendClientMessage(playerid, BLANCO, "Usa: /clan colorh [Código Hexadecimal]");
  457. if(longitud > 10) return SendClientMessage(playerid, ROJO, "Demasiado grande");
  458.  
  459. new
  460. rojo[3] = "00",
  461. azul[3] = "00",
  462. verde[3] = "00",
  463. alfa[3],
  464. ColorC;
  465.  
  466. if(tmp2[0] == '#')
  467. {
  468. format(string, sizeof string, "%s", tmp2[1]);
  469. if(!IsAHexNumber(string)) return SendClientMessage(playerid, ROJO, "Formato incorrecto. Ejemplo: #FFFFFFFF");
  470. format(rojo, sizeof rojo, "%c%c", tmp2[1], tmp2[2]);
  471. format(azul, sizeof azul, "%c%c", tmp2[3], tmp2[4]);
  472. format(verde, sizeof verde, "%c%c", tmp2[5], tmp2[6]);
  473. if(tmp2[7] != '\0')
  474. format(alfa, sizeof alfa, "%c%c", tmp2[7], tmp2[8]);
  475. else alfa = "FF";
  476.  
  477. ColorC = RGBA(HexToInt(rojo), HexToInt(verde), HexToInt(azul), HexToInt(alfa));
  478. format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  479. dini_IntSet(Archivo, "Color", ColorC);
  480. for(new i = 0; i < MAX_PLAYERS; i++)
  481. {
  482. if(IsPlayerConnected(i))
  483. if(Clan_ID[playerid] == Clan_ID[i])
  484. SetPlayerColor(i, ColorC);
  485. }
  486. format(string, sizeof string, "~y~~h~ Color seleccionado~n~~p~#%s%s%s%s", rojo, verde, azul, alfa);
  487. GameTextForPlayer(playerid, string, 3000, 4);
  488. return 1;
  489. }
  490. else if(tmp2[0] == '0' && tmp2[1] == 'x')
  491. {
  492. format(string, sizeof string, "%s", tmp2[2]);
  493. if(!IsAHexNumber(string)) return SendClientMessage(playerid, ROJO, "Formato incorrecto. Ejemplo: 0xFFFFFFFF");
  494. format(rojo, sizeof rojo, "%c%c", tmp2[2], tmp2[3]);
  495. format(azul, sizeof azul, "%c%c", tmp2[4], tmp2[5]);
  496. format(verde, sizeof verde, "%c%c", tmp2[6], tmp2[7]);
  497. if(tmp[8] != '\0')
  498. format(alfa, sizeof alfa, "%c%c", tmp2[8], tmp2[9]);
  499. else alfa = "FF";
  500.  
  501. ColorC = RGBA(HexToInt(rojo), HexToInt(verde), HexToInt(azul), HexToInt(alfa));
  502. format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  503. dini_IntSet(Archivo, "Color", ColorC);
  504. for(new i = 0; i < MAX_PLAYERS; i++)
  505. {
  506. if(IsPlayerConnected(i))
  507. if(Clan_ID[playerid] == Clan_ID[i])
  508. SetPlayerColor(i, ColorC);
  509. }
  510. format(string, sizeof string, "~y~~h~ Color seleccionado~n~~p~0x%s%s%s%s", rojo, verde, azul, alfa);
  511. GameTextForPlayer(playerid, string, 3000, 4);
  512. return 1;
  513. }
  514. if(IsAHexNumber(tmp2))
  515. {
  516. format(rojo, sizeof rojo, "%c%c", tmp2[0], tmp2[1]);
  517. format(azul, sizeof azul, "%c%c", tmp2[2], tmp2[3]);
  518. format(verde, sizeof verde, "%c%c", tmp2[4], tmp2[5]);
  519. if(tmp[6] != '\0')
  520. format(alfa, sizeof alfa, "%c%c", tmp2[6], tmp2[7]);
  521. else alfa = "FF";
  522.  
  523. ColorC = RGBA(HexToInt(rojo), HexToInt(verde), HexToInt(azul), HexToInt(alfa));
  524. format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  525. dini_IntSet(Archivo, "Color", ColorC);
  526. for(new i = 0; i < MAX_PLAYERS; i++)
  527. {
  528. if(IsPlayerConnected(i))
  529. if(Clan_ID[playerid] == Clan_ID[i])
  530. SetPlayerColor(i, ColorC);
  531. }
  532. format(string, sizeof string, "~y~~h~ Color seleccionado~n~~p~%s%s%s%s", rojo, verde, azul, alfa);
  533. GameTextForPlayer(playerid, string, 3000, 4);
  534. return 1;
  535. } else return SendClientMessage(playerid, ROJO, "Formato incorrecto. Ejemplo: FFFFFFFF");
  536. }
  537. if(!strcmp(tmp, "invitar", true))
  538. {
  539. if(EnClan[playerid] == false) return SendClientMessage(playerid, ROJO, "No tienes clan");
  540. if(!strlen(tmp2)) return SendClientMessage(playerid, BLANCO, "Usa: /clan invitar [id]");
  541. tmp2 = strtok(cmdtext, idx);
  542. id = strval(tmp2);
  543. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, ROJO, "Jugador no conectado");
  544. if(Ingresado[id] == false) return SendClientMessage(playerid, ROJO, "El jugador invitado necesita estar logueado");
  545. if(id == playerid) return SendClientMessage(playerid, ROJO, "No puedes enviarte invitación a ti mismo");
  546. format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  547. if(strcmp(dini_Get(Archivo, "Lider"), Nickname[playerid]) != 0) return SendClientMessage(playerid, ROJO, "Necesitas ser el creador del clan para poder invitar");
  548. if(EnClan[id] == true) return SendClientMessage(playerid, ROJO, "Ese jugador ya tiene clan");
  549. format(string, sizeof string, "* %s te ha invitado al clan '%s'", Nickname[playerid], dini_Get(Archivo, "Nombre"));
  550. SendClientMessage(id, LIGHTBLUE, string);
  551. SendClientMessage(id, NARANJA, "Usa /clan entrar para aceptar la invitación o /clan rechazar para rechazar la invitación.");
  552. format(string, sizeof string, "* Has invitado a %s ", Nickname[id]);
  553. SendClientMessage(playerid, LIGHTBLUE, string);
  554. format(Invitacion[id], 4, "%s", Clan_TAG[playerid]);
  555. return 1;
  556. }
  557. if(!strcmp(tmp, "rechazar", true))
  558. {
  559. if(!strlen(Invitacion[playerid])) return SendClientMessage(playerid, ROJO, "No te han invitado a ningun clan");
  560. Invitacion[playerid][0] = 0;
  561. return 1;
  562. }
  563. if(!strcmp(tmp, "entrar", true))
  564. {
  565. if(!strlen(Invitacion[playerid])) return SendClientMessage(playerid, ROJO, "No te han invitado a ningun clan");
  566. if(EnClan[playerid] == true) return SendClientMessage(playerid, ROJO, "Ya tienes clan");
  567. format(Archivo, sizeof Archivo, "Clanes/%s.ini", Invitacion[playerid]);
  568. if(dini_Exists(Archivo))
  569. {
  570. new
  571. IDMiembro = 2;
  572.  
  573. if(dini_Int(Archivo, "Miembros") == 20) return SendClientMessage(playerid, ROJO, "El clan está lleno");
  574. dini_IntSet(Archivo, "Miembros", dini_Int(Archivo, "Miembros")+1);
  575. while(IDMiembro < 20)
  576. {
  577. format(string, sizeof string, "Miembro_%d", IDMiembro);
  578. if(!strcmp(dini_Get(Archivo, string), "<Vacio>"))
  579. {
  580. dini_Set(Archivo, string, Nickname[playerid]);
  581. break;
  582. }
  583. IDMiembro++;
  584. }
  585. format(Clan_TAG[playerid], 4, Invitacion[playerid]);
  586. format(Archivo, sizeof Archivo, "Jugadores/%s.ini", Nickname[playerid]);
  587. dini_Set(Archivo, "Clan", Clan_TAG[playerid]);
  588. format(Nick, sizeof Nick, "[%s]%s", Clan_TAG[playerid], Nickname[playerid]);
  589. SetPlayerName(playerid, Nick);
  590. SetPlayerColor(playerid, dini_Int(Archivo, "Color"));
  591. format(string, sizeof string, "* %s has entrado al clan '%s'", dini_Get(Archivo, "Nombre"));
  592. SendClientMessage(playerid, BLANCO, string);
  593. Clan_ID[playerid] = dini_Int(Archivo, "ID");
  594. format(string, sizeof string, "* %s ha entrado al clan ", Nickname[playerid]);
  595. for(new i = 0; i < MAX_PLAYERS; i++) {
  596. if(i == playerid || !IsPlayerConnected(i)) continue;
  597. if(Clan_ID[playerid] == Clan_ID[i]) SendClientMessage(i, BLANCO, string);
  598. }
  599. EnClan[playerid] = true;
  600. } else return SendClientMessage(playerid, ROJO, "Ya no existe ese clan");
  601. return 1;
  602. }
  603. if(!strcmp(tmp, "salir", true))
  604. {
  605. if(EnClan[playerid] == false) return SendClientMessage(playerid, ROJO, "No tienes clan");
  606. format(string, sizeof string, "* %s ha salido del clan", Nickname[playerid]);
  607. for(new i = 0; i < MAX_PLAYERS; i++) {
  608. if(i == playerid || !IsPlayerConnected(i)) continue;
  609. if(Clan_ID[playerid] == Clan_ID[i]) SendClientMessage(i, BLANCO, string);
  610. }
  611. Clan_ID[playerid] = 0;
  612. format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  613. file = fopen(Archivo, io_read);
  614. while(fread(file, string))
  615. {
  616. idx = strfind(string, Nickname[playerid], true);
  617. if(idx != -1)
  618. {
  619. strmid(string, string, 0, idx-1, 16);
  620. dini_Set(Archivo, string, "<Vacio>");
  621. }
  622. }
  623. fclose(file);
  624. dini_IntSet(Archivo, "Miembros", dini_Int(Archivo, "Miembros")-1);
  625. format(string, sizeof string, "* Saliste del clan '%s'", dini_Get(Archivo, "Nombre"));
  626. SendClientMessage(playerid, ROJO, string);
  627. format(Archivo, sizeof Archivo, "Jugadores/%s.ini", Nickname[playerid]);
  628. dini_Set(Archivo, "Clan", "<Ninguno>");
  629. SetPlayerName(playerid, Nickname[playerid]);
  630. SetPlayerColor(playerid, PlayerColors[playerid]);
  631. EnClan[playerid] = false;
  632. return 1;
  633. }
  634. if(!strcmp(tmp, "expulsar", true))
  635. {
  636. if(EnClan[playerid] == false) return SendClientMessage(playerid, ROJO, "No tienes clan");
  637. tmp2 = strtok(cmdtext, idx);
  638. if(!strlen(tmp2)) return SendClientMessage(playerid, BLANCO, "Usa: /clan expulsar [id]");
  639. id = strval(tmp2);
  640. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, ROJO, "Jugador no conectado");
  641. if(id == playerid) return SendClientMessage(playerid, ROJO, "No puedes expulsarte a ti mismo");
  642. format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  643. if(Clan_ID[playerid] != Clan_ID[id]) return SendClientMessage(playerid, ROJO, "Ese jugador no está en tu clan");
  644. if(strcmp(dini_Get(Archivo, "Lider"), Nickname[playerid]) != 0) return SendClientMessage(playerid, ROJO, "Necesitas ser el creador del clan para poder expulsar");
  645. OnPlayerCommandText(playerid, "/clan salir");
  646. SendClientMessage(playerid, ROJO, "Fuiste expulsado del clan");
  647. return 1;
  648. }
  649. if(!strcmp(tmp, "info", true))
  650. {
  651. tmp2 = strtok(cmdtext, idx);
  652. if(!strlen(tmp2)) return SendClientMessage(playerid, BLANCO, "Usa: /clan info [TAG]");
  653. format(Archivo, sizeof Archivo, "Clanes/%s.ini", tmp2);
  654. if(dini_Exists(Archivo))
  655. {
  656. format(DLG_INFO_CLAN_STR, sizeof DLG_INFO_CLAN_STR, "> ID: %d\n", dini_Int(Archivo, "ID"));
  657. format(DLG_INFO_CLAN_STR, sizeof DLG_INFO_CLAN_STR, "%s> Color: %d\n", DLG_INFO_CLAN_STR, dini_Int(Archivo, "Color"));
  658. format(DLG_INFO_CLAN_STR, sizeof DLG_INFO_CLAN_STR, "%s> Líder: %s\n", DLG_INFO_CLAN_STR, dini_Get(Archivo, "Lider"));
  659. format(DLG_INFO_CLAN_STR, sizeof DLG_INFO_CLAN_STR, "%s> Miembros: %d\n", DLG_INFO_CLAN_STR, dini_Int(Archivo, "Miembros"));
  660. format(DLG_INFO_CLAN_STR, sizeof DLG_INFO_CLAN_STR, "%s> Asesinatos: %d\n", DLG_INFO_CLAN_STR, dini_Int(Archivo, "Asesinatos"));
  661. format(DLG_INFO_CLAN_STR, sizeof DLG_INFO_CLAN_STR, "%s> Muertes: %d\n", DLG_INFO_CLAN_STR, dini_Int(Archivo, "Muertes"));
  662. format(DLG_INFO_CLAN_STR, sizeof DLG_INFO_CLAN_STR, "%s> Ratio: %0.0f\n", DLG_INFO_CLAN_STR, dini_Float(Archivo, "Ratio"));
  663. for(new d = 1; d < 21; d++)
  664. {
  665. format(string, sizeof string, "Miembro_%d", d);
  666. format(DLG_INFO_CLAN_STR, sizeof DLG_INFO_CLAN_STR, "%s> Miembro %d: %s\n", DLG_INFO_CLAN_STR, d, dini_Get(Archivo, string));
  667. }
  668. format(string, sizeof string, "Información '%s' [%s]", dini_Get(Archivo, "Nombre"), dini_Get(Archivo, "TAG"));
  669. ShowPlayerDialog(playerid, DLG_CLAN_INFO, DIALOG_STYLE_MSGBOX, string, DLG_INFO_CLAN_STR, "Aceptar", "Cancelar");
  670. } else return SendClientMessage(playerid, ROJO, "No existe ese clan");
  671. return 1;
  672. }
  673. return 1;
  674. }
  675.  
  676. if(strcmp(cmdtext,"/saltarbici",true)==0)
  677. {
  678. if(SaltosBici[playerid] > 0)
  679. {
  680. SaltosBici[playerid] = 0;
  681. SendClientMessage(playerid,Amarillo,"Super saltos en bici desactivado.");
  682. }
  683. else
  684. {
  685. SaltosBici[playerid] = 1;
  686. SendClientMessage(playerid,Amarillo,"Super saltos en bici activado. Usa /saltarbici para desactivarlo.");
  687. }
  688. return 1;
  689. }
  690.  
  691. //======= Comandos DCMD: =======
  692. dcmd(acmds, 5, cmdtext);
  693. dcmd(kill , 4,cmdtext);
  694. dcmd(reportar , 8,cmdtext);
  695. dcmd(admins, 6, cmdtext);
  696. dcmd(conteo, 6, cmdtext);
  697. dcmd(armas, 5, cmdtext);
  698. dcmd(anuncio, 7, cmdtext);
  699. dcmd(fix, 3, cmdtext);
  700. dcmd(ir, 2, cmdtext);
  701. dcmd(traer, 5, cmdtext);
  702. dcmd(sayon, 5, cmdtext);
  703. dcmd(sayoff, 6, cmdtext);
  704. dcmd(carcel, 6, cmdtext);
  705. dcmd(liberar, 7 ,cmdtext);
  706. dcmd(congelar, 8, cmdtext);
  707. dcmd(descongelar, 11, cmdtext);
  708. dcmd(kick, 4, cmdtext);
  709. dcmd(ban, 3, cmdtext);
  710. dcmd(Nivel, 5, cmdtext);
  711. return 0;
  712. }
  713.  
  714. //===================== Comandos DCMD para Administradores =====================
  715.  
  716. dcmd_conteo(playerid,params[])
  717. {
  718. #pragma unused params
  719. if (Conteo == 1) return SendClientMessage(playerid, Rojo, "Ya hay un Conteo en Progreso.");
  720. new nombre[MAX_PLAYER_NAME], string[100];
  721. GetPlayerName(playerid, nombre, sizeof(nombre));
  722. format(string, sizeof(string), "* %s ha iniciado un conteo.", nombre);
  723. Conteo = 1;
  724. SetTimerEx("Conteo5", 500, false, "d", playerid);
  725. SendClientMessageToAll(Verde, string);
  726. return 1;
  727. }
  728.  
  729. //=========----------------------=========//
  730. dcmd_acmds(playerid,params[])
  731. {
  732. #pragma unused params
  733. if(PlayerInfo[playerid][Nivel] == 1)
  734. {
  735. SendClientMessage(playerid, Verde, "Comandos de administrador:");
  736. SendClientMessage(playerid, Azul, "[Admin]Nivel 1: /sayon /sayoff ");
  737. }
  738. else if(PlayerInfo[playerid][Nivel] == 2)
  739. {
  740. SendClientMessage(playerid, Verde, "Comandos de administrador:");
  741. SendClientMessage(playerid, Azul, "[Admin]Nivel 1: /sayon /sayoff");
  742. SendClientMessage(playerid, Azul, "[Admin]Nivel 2: /anuncio - /fix /kick");
  743. }
  744. else if(PlayerInfo[playerid][Nivel] == 3)
  745. {
  746. SendClientMessage(playerid, Verde, "Comandos de administrador:");
  747. SendClientMessage(playerid, Azul, "[Admin]Nivel 1: /sayon /sayoff");
  748. SendClientMessage(playerid, Azul, "[Admin]Nivel 2: /anuncio - /fix /kick");
  749. SendClientMessage(playerid, Azul, "[Admin]Nivel 3: /armas /traer /ban");
  750. }
  751. else if(PlayerInfo[playerid][Nivel] == 4)
  752. {
  753. SendClientMessage(playerid, Verde, "Comandos de administrador:");
  754. SendClientMessage(playerid, Azul, "[Admin]Nivel 1: /sayon /sayoff");
  755. SendClientMessage(playerid, Azul, "[Admin]Nivel 2:/anuncio /fix /kick");
  756. SendClientMessage(playerid, Azul, "[Admin]Nivel 3: /armas /traer /ban");
  757. SendClientMessage(playerid, Azul, "[Admin]Nivel 4: /ir /carcel /liberar ");
  758. }
  759. else if(PlayerInfo[playerid][Nivel] == 5)
  760. {
  761. SendClientMessage(playerid, Verde, "Comandos de administrador:");
  762. SendClientMessage(playerid, Azul, "[Admin]Nivel 1: /sayon /sayoff");
  763. SendClientMessage(playerid, Azul, "[Admin]Nivel 2: /anuncio - /fix /kick");
  764. SendClientMessage(playerid, Azul, "[Admin]Nivel 3: /armas /traer /ban");
  765. SendClientMessage(playerid, Azul, "[Admin]Nivel 4: /ir /carcel /liberar");
  766. SendClientMessage(playerid, Azul, "[Admin]Nivel 5: /nivel /congelar /descongelar");
  767. }
  768. else return SendClientMessage(playerid, Rojo, "[[Info]] Lo sentimos no eres Admin");
  769. return 1;
  770. }
  771.  
  772. dcmd_kill(playerid,params[])
  773. {
  774. #pragma unused params
  775. SendClientMessage(playerid,Rojo,"Por que mierda te matas acaso estas loco o.O");
  776. SetPlayerHealth(playerid, 0.0);
  777. return 1;
  778. }
  779.  
  780. dcmd_reportar(playerid,params[])
  781. {
  782. #pragma unused params
  783. new razon[250], string[250], giveplayerid, giveplayer[MAX_PLAYER_NAME], idx, cmd[256];
  784. cmd = strtok(params, idx);
  785. if(!strlen(cmd))
  786. {
  787. SendClientMessage(playerid, Naranja, "Usa: /reportar [ID] [Razon]");
  788. return 1;
  789. }
  790. giveplayerid = strval(cmd);
  791. razon = strrest(params,idx);
  792. if(!strlen(razon))
  793. {
  794. SendClientMessage(playerid,Naranja,"Usa: /reportar [ID] [Razon]");
  795. return 1;
  796. }
  797. if (IsPlayerConnected(giveplayerid))
  798. {
  799. GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  800. GetPlayerName(playerid, sendername, sizeof(sendername));
  801. SendClientMessage(playerid,Amarillo,"[[Info]]Tu reporte ha sido enviado con Exito a los Administradores en Linea.");
  802. SendClientMessage(playerid,Amarillo,"[[Info]]No repitas el reporte o seras castigado.");
  803. SendClientMessage(playerid,Amarillo,"[[Info]]Si reportaste al ID incorrecto Avisa.");
  804. format(string,sizeof(string),"* [Reporte:] %s [ID: %d] reportó a %s [ID: %d]. Razón: %s",sendername,playerid,giveplayer,giveplayerid,razon);
  805. MsgAdmins(Azul,string,1);
  806. } else {
  807. format(string, sizeof(string), "[[Info]] Jugador no Conectado");
  808. SendClientMessage(playerid, Rojo, string);
  809. }
  810. return 1;
  811. }
  812.  
  813. dcmd_admins(playerid,params[])
  814. {
  815. #pragma unused params
  816. new Count,i,name[24],string[256];
  817. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Nivel] >= 3) Count++;
  818. if(!Count) return SendClientMessage(playerid, Rojo, "No hay Administradores conectados..");
  819.  
  820. if(Count == 1)
  821. {
  822. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Nivel] >= 3) break;
  823. GetPlayerName(i,name,24); format(string,256,"%s (Nivel: %d)",name,PlayerInfo[i][Nivel]);
  824. return ShowPlayerDialog(playerid, 500, DIALOG_STYLE_MSGBOX, "Administradores conectados", string, " Ok ", " Salir ");
  825. }
  826.  
  827. if(Count >= 1)
  828. {
  829. new bool:First = false;
  830. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Nivel] >= 3)
  831. {
  832. GetPlayerName(i,name,24);
  833. if(!First)
  834. {
  835. format(string,256,"%s (Nivel: %d)\n",name,PlayerInfo[i][Nivel]); First = true;
  836. }
  837. else format(string,256,"%s %s (Nivel: %d)",string,name,PlayerInfo[i][Nivel]);
  838. }
  839. return ShowPlayerDialog(playerid, 500, DIALOG_STYLE_MSGBOX, "Administradores conectados", string, " Ok ", " Salir ");
  840. }
  841. return 1;
  842. }
  843.  
  844. dcmd_armas(playerid,params[])
  845. {
  846. #pragma unused params
  847. if(PlayerInfo[playerid][Nivel] >= 3)
  848. {
  849. if(IsPlayerInAnyVehicle(playerid)) {
  850. TogglePlayerControllable(playerid,false); return ShowMenuForPlayer(armas,playerid);
  851. } else return ShowMenuForPlayer(armas,playerid);
  852. } else return SendClientMessage(playerid,Rojo,"[[Info]] Lo sentimos no eres Admin");
  853. }
  854.  
  855. dcmd_anuncio(playerid,params[])
  856. {
  857. if(PlayerInfo[playerid][Nivel] >= 2)
  858. {
  859. new texto;
  860. if(sscanf(params, "pz", texto))
  861. {
  862. SendClientMessage(playerid, Naranja, "Usa: /anuncio <Texto>");
  863. }
  864. else
  865. {
  866. GameTextForAll(params ,4000, 6);
  867. }
  868. } else {
  869. SendClientMessage(playerid, Rojo,"[[Info]] Lo sentimos no eres Admin");
  870. }
  871. return 1;
  872. }
  873.  
  874. dcmd_fix(playerid,params[])
  875. {
  876. #pragma unused params
  877. if(PlayerInfo[playerid][Nivel] > 2)
  878. {
  879. if (IsPlayerInAnyVehicle(playerid)) {
  880. SetVehicleHealth(GetPlayerVehicleID(playerid),1250.0);
  881. return SendClientMessage(playerid,Azul,"[[Info:]]> Vehículo Reparado Correctamente.");
  882. } else return SendClientMessage(playerid,Rojo,"[[Info]] No estas en un vehiculo.");
  883. } else return SendClientMessage(playerid,Rojo,"[[Info]] Lo sentimos no eres Admin");
  884. }
  885.  
  886. dcmd_ir(playerid,params[])
  887. {
  888. if(PlayerInfo[playerid][Nivel] >= 4)
  889. {
  890. if(!strlen(params)) return SendClientMessage(playerid, Naranja,"Usa: /ir <ID>");
  891. new Nick, string[128];
  892. Nick = strval(params);
  893. if(IsPlayerConnected(Nick) && Nick != INVALID_PLAYER_ID && Nick != playerid)
  894. {
  895. new Float:x, Float:y, Float:z; GetPlayerPos(Nick,x,y,z); SetPlayerInterior(playerid,GetPlayerInterior(Nick));
  896. SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(Nick));
  897. if(GetPlayerState(playerid) == 2)
  898. {
  899. SetVehiclePos(GetPlayerVehicleID(playerid),x+5,y,z); LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(Nick));
  900. SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(Nick));
  901. } else SetPlayerPos(playerid,x+2,y,z);
  902. format(string,sizeof(string),"Has sido teletransportado hasta %s.",Nick);
  903. return SendClientMessage(playerid, Azul,string);
  904. } else return SendClientMessage(playerid, Rojo, "[[Info]] Jugador no Conectado");
  905. } else return SendClientMessage(playerid, Rojo,"[[Info]] Lo sentimos no eres Admin");
  906. }
  907. //=========----------------------=========//
  908. dcmd_traer(playerid,params[])
  909. {
  910. if(PlayerInfo[playerid][Nivel] >= 3)
  911. {
  912. if(!strlen(params)) return SendClientMessage(playerid, Azul, "Usa: /Traer <ID>");
  913. new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
  914. player1 = strval(params);
  915. if(PlayerInfo[player1][Nivel] && PlayerInfo[playerid][Nivel]) return SendClientMessage(playerid, Rojo,"ERROR: No puedes usar este comando sobre este Administrador.");
  916. if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid)
  917. {
  918. new Float:x, Float:y, Float:z; GetPlayerPos(playerid,x,y,z); SetPlayerInterior(player1,GetPlayerInterior(playerid));
  919. SetPlayerVirtualWorld(player1,GetPlayerVirtualWorld(playerid));
  920. if(GetPlayerState(player1) == 2)
  921. {
  922. new VehicleID = GetPlayerVehicleID(player1);
  923. SetVehiclePos(VehicleID,x+3,y,z); LinkVehicleToInterior(VehicleID,GetPlayerInterior(playerid));
  924. SetVehicleVirtualWorld(GetPlayerVehicleID(player1),GetPlayerVirtualWorld(playerid));
  925. } else SetPlayerPos(player1,x+2,y,z);
  926. GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
  927. format(string,sizeof(string),"Has sido teletransportado por el administrador %s hacia su posición.",adminname); SendClientMessage(player1,Azul,string);
  928. format(string,sizeof(string),"Has teletransportado a %s hacia tu posición.", playername); return SendClientMessage(playerid,Amarillo,string);
  929. } else return SendClientMessage(playerid, Rojo, "[[Info]] Jugador no Conectado");
  930. } else return SendClientMessage(playerid, Rojo,"[[Info]] Lo sentimos no eres Admin");
  931. }
  932.  
  933. //=========----------------------=========//
  934.  
  935. dcmd_carcel(playerid,params[])
  936. {
  937. if(PlayerInfo[playerid][Nivel] >= 4)
  938. {
  939. new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index);
  940. if(!strlen(params)) return SendClientMessage(playerid, Amarillo, "* Usa: /carcel <ID> <Tiempo> <Razón>");
  941. new player1, Nombreplayerid[MAX_PLAYER_NAME], Adminnombre[MAX_PLAYER_NAME], string[128];
  942. player1 = strval(tmp);
  943.  
  944. if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
  945. {
  946. if(PlayerInfo[player1][Carcel] == 0)
  947. {
  948. GetPlayerName(player1, Nombreplayerid, sizeof(Nombreplayerid)); GetPlayerName(playerid, Adminnombre, sizeof(Adminnombre));
  949. new Ctiempo = strval(tmp2);
  950. if(Ctiempo == 0) Ctiempo = 9999;
  951.  
  952. PlayerInfo[player1][CarcelTiempo] = Ctiempo*1000*60;
  953. SetTimerEx("playeridCarcel",5000,0,"d",player1);
  954. SetTimerEx("Carcel1",1000,0,"d",player1);
  955.  
  956. PlayerInfo[player1][Carcel] = 1;
  957.  
  958. if(Ctiempo == 9999)
  959. {
  960. if(!strlen(params[strlen(tmp2)+1])) format(string,sizeof(string),"Administrador %s ha encarcelado a %s ",Adminnombre, Nombreplayerid);
  961. else format(string,sizeof(string),"Administrador %s ha encarcelado a %s | Razón %s",Adminnombre, Nombreplayerid, params[strlen(tmp)+1] );
  962. } else {
  963. if(!strlen(tmp3)) format(string,sizeof(string),"Administrador %s ha encarcelado a %s durante %d minutos", Adminnombre, Nombreplayerid, Ctiempo);
  964. else format(string,sizeof(string),"Administrador %s ha encarcelado a %s durante %d minutos | Razón: %s", Adminnombre, Nombreplayerid, Ctiempo, params[strlen(tmp2)+strlen(tmp)+1] );
  965. }
  966. return SendClientMessageToAll(Rojo,string);
  967. } else return SendClientMessage(playerid, Rojo, "[[Info]]Jugador ya en Carcel.");
  968. } else return SendClientMessage(playerid, Rojo, "[[Info]] Jugador no Conectado.");
  969. } else return SendClientMessage(playerid, Rojo,"[[Info]] Lo sentimos no eres Admin.");
  970. }
  971. //=========----------------------=========//
  972. dcmd_liberar(playerid,params[])
  973. {
  974. if(PlayerInfo[playerid][Nivel] >= 4)
  975. {
  976. new tmp[256], Index; tmp = strtok(params,Index);
  977. if(!strlen(params)) return SendClientMessage(playerid, Rojo, "Usa: /Desencarcelar <ID>");
  978. new player1, Nombreplayerid[MAX_PLAYER_NAME], Adminnombre[MAX_PLAYER_NAME], string[128];
  979. player1 = strval(tmp);
  980.  
  981. if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
  982. {
  983. if(PlayerInfo[player1][Carcel] == 1)
  984. {
  985. GetPlayerName(player1, Nombreplayerid, sizeof(Nombreplayerid)); GetPlayerName(playerid, Adminnombre, sizeof(Adminnombre));
  986. format(string,sizeof(string),"El Administrador %s te ha desencarcelado.", Adminnombre); SendClientMessage(player1,Naranja,string);
  987. format(string,sizeof(string),"Administrador %s ha desencarcelado a %s",Adminnombre, Nombreplayerid);
  988. SacarCarcel(player1);
  989. return SendClientMessageToAll(Rojo,string);
  990. } else return SendClientMessage(playerid, Rojo, "[[Info]]Jugador no en carcel.");
  991. } else return SendClientMessage(playerid, Rojo, "[[Info]] Jugador no Conectado.");
  992. } else return SendClientMessage(playerid, Rojo,"[[Info]] Lo sentimos no eres Admin");
  993. }
  994.  
  995. dcmd_congelar(playerid,params[])
  996. {
  997. if(PlayerInfo[playerid][Nivel] >= 5)
  998. {
  999. new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index);
  1000. if(!strlen(params)) return SendClientMessage(playerid, Naranja, "Usa: /Congelar <ID> <Minutos> <Razón>");
  1001. new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
  1002. player1 = strval(tmp);
  1003.  
  1004. if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
  1005. {
  1006. if(PlayerInfo[player1][Congelado] == 0)
  1007. {
  1008. GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
  1009. new Ctiempo = strval(tmp2);
  1010. if(Ctiempo == 0) Ctiempo = 9999;
  1011.  
  1012. TogglePlayerControllable(player1,false); PlayerInfo[player1][Congelado] = 1; PlayerPlaySound(player1,1057,0.0,0.0,0.0);
  1013. PlayerInfo[player1][CongelarTiempo] = Ctiempo*1000*60;
  1014. CongelarTimer[player1] = SetTimerEx("Descongelame",PlayerInfo[player1][CongelarTiempo],0,"d",player1);
  1015.  
  1016. if(Ctiempo == 9999)
  1017. {
  1018. if(!strlen(params[strlen(tmp2)+1])) format(string,sizeof(string),"[Admin] %s ha congelado a %s ",adminname, playername);
  1019. else format(string,sizeof(string),"[Admin] %s ha congelado a %s | Razón %s",adminname, playername, params[strlen(tmp)+1] );
  1020. } else {
  1021. if(!strlen(tmp3)) format(string,sizeof(string),"[Admin] %s ha congelado a %s durante %d minutos.",adminname, playername, Ctiempo);
  1022. else format(string,sizeof(string),"[Admin] %s ha congelado a %s durante %d minutos | Razón: %s",adminname, playername, Ctiempo, params[strlen(tmp2)+strlen(tmp)+1] );
  1023. }
  1024. return SendClientMessageToAll(Amarillo,string);
  1025. } else return SendClientMessage(playerid, Rojo, "[[Info]] Jugador ya Congelado");
  1026. } else return SendClientMessage(playerid, Rojo, "[[Info]] Jugador no Conectado");
  1027. } else return SendClientMessage(playerid, Rojo,"[[Info]] Lo sentimos no eres Admin");
  1028. }
  1029. //=========----------------------=========//
  1030. dcmd_descongelar(playerid,params[])
  1031. {
  1032. if(PlayerInfo[playerid][Nivel] >= 5)
  1033. {
  1034. if(!strlen(params)) return SendClientMessage(playerid, Naranja, "Usa: /Descongelar <ID>");
  1035. new player1, string[128];
  1036. player1 = strval(params);
  1037.  
  1038. if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
  1039. {
  1040. if(PlayerInfo[player1][Congelado] == 1)
  1041. {
  1042. Descongelame(player1);
  1043. format(string,sizeof(string)," [[Info]] [Admin] %s te ha descongelado.",playerid); SendClientMessage(player1, Naranja,string);
  1044. format(string,sizeof(string),"[[Info]] [Admin] %s ha descongelado a %s", playerid, player1);
  1045. return SendClientMessageToAll(Amarillo,string);
  1046. } else return SendClientMessage(playerid, Rojo, "[[Info]] Jugador no Congelado");
  1047. } else return SendClientMessage(playerid, Rojo, "[[Info]] Jugador no Conectado");
  1048. } else return SendClientMessage(playerid, Rojo,"[[Info]] Lo sentimos no eres Admin");
  1049. }
  1050.  
  1051. dcmd_kick(playerid,params[])
  1052. {
  1053. if(PlayerInfo[playerid][Nivel] >= 2)
  1054. {
  1055. new id;
  1056. new razon;
  1057. if(sscanf(params, "uz", id, razon))
  1058. {
  1059. SendClientMessage(playerid, Naranja, "Usa: /Kick <ID> <Razón>");
  1060. }
  1061. else if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) return SendClientMessage(playerid, Rojo, "[[Info]] Jugador no Conectado");
  1062. else
  1063. {
  1064. new string[256],Nombre[24],ANombre[24]; GetPlayerName(playerid,Nombre,24); GetPlayerName(id,ANombre,24);
  1065. format(string,256,"[[Info]] %s ha sido kickeado por un Admin | [Razón: %s].",Nombre,razon);
  1066. SendClientMessageToAll(Amarillo,string);
  1067. Kick(playerid);
  1068. }
  1069. } else {
  1070. SendClientMessage(playerid, Rojo,"[[Info]] Lo sentimos no eres Admin");
  1071. }
  1072. return 1;
  1073. }
  1074. dcmd_ban(playerid,params[])
  1075. {
  1076. if(PlayerInfo[playerid][Nivel] >= 4)
  1077. {
  1078. new id;
  1079. new razon;
  1080. if(sscanf(params, "uz", id, razon))
  1081. {
  1082. SendClientMessage(playerid, Naranja, "Usa: /Ban <ID> <Razón>");
  1083. }
  1084. else if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) return SendClientMessage(playerid, Rojo, "[[Info]] Jugador no Conectado");
  1085. else
  1086. {
  1087. new string[256],Nombre[24],ANombre[24]; GetPlayerName(playerid,Nombre,24); GetPlayerName(id,ANombre,24);
  1088. format(string,256,"[[Info]] %s ha sido Baneado por un Admin | [Razón: %s].",Nombre,razon);
  1089. SendClientMessageToAll(Amarillo,string);
  1090. Ban(playerid);
  1091. }
  1092. } else {
  1093. SendClientMessage(playerid, Rojo,"[[Info]] Lo sentimos no eres Admin");
  1094. }
  1095. return 1;
  1096. }
  1097.  
  1098. //=========----------------------=========//
  1099. dcmd_sayon(playerid, params[])
  1100. {
  1101. #pragma unused params
  1102. if(PlayerInfo[playerid][Nivel] >= 1)
  1103. {
  1104. PlayerInfo[playerid][Tsay] = 1;
  1105. SendClientMessage(playerid, Verde, "Comando /Say activado.");
  1106. } else {
  1107. SendClientMessage(playerid, Rojo,"[[Info]] Lo sentimos no eres Admin");
  1108. }
  1109. return 1;
  1110. }
  1111. //=========----------------------=========//
  1112. dcmd_sayoff(playerid, params[])
  1113. {
  1114. #pragma unused params
  1115. if(PlayerInfo[playerid][Nivel] >= 1)
  1116. {
  1117. PlayerInfo[playerid][Tsay] = 0;
  1118. SendClientMessage(playerid, Rojo, "Comando /Say desactivado.");
  1119. } else {
  1120. SendClientMessage(playerid, Rojo,"[[Info]] Lo sentimos no eres Admin.");
  1121. }
  1122. return 1;
  1123. }
  1124.  
  1125. dcmd_Nivel(playerid, params[])
  1126. {
  1127. if(PlayerInfo[playerid][Nivel] < 5) return SendClientMessage(playerid, Rojo, "[[Info]] Lo sentimos no eres Admin");
  1128.  
  1129. new id, nivel, string[72];
  1130.  
  1131. if(sscanf(params, "ud", id, nivel)) return SendClientMessage(playerid, Naranja, "Uso: /Nivel [id][Nivel]");
  1132. else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, Rojo, "[[Info]] Jugador no Conectado");
  1133. else if(playerid == id) return SendClientMessage(playerid, Rojo, "[[Info]] No puedes cambiar tu propio Nivel!");
  1134. else if(nivel < 1 || nivel > 5) return SendClientMessage(playerid, Rojo, "[[Info]] El Nivel tiene qe ser de 1 a 5");
  1135. else if(PlayerInfo[id][Nivel] >= PlayerInfo[playerid][Nivel]) return SendClientMessage(playerid, Rojo, "[[Info]]No puedes modificar a este jugador");
  1136.  
  1137. new
  1138. Name[24];
  1139.  
  1140. PlayerInfo[playerid][Nivel] = nivel;
  1141. GetPlayerName(playerid, Name, 24);
  1142. format(string, sizeof(string), "[Admin] %s Te puso [Admin] Nivel: %d!", Name, nivel);
  1143. SendClientMessage(id, Amarillo, string);
  1144. GetPlayerName(id, Name, 24);
  1145. format(string, sizeof(string), "Le has dado a %s, [Admin] Nivel: %d!", Name, nivel);
  1146. SendClientMessage(playerid, Azul, string);
  1147. return 1;
  1148. }
  1149. //============================================================================//
  1150.  
  1151. public OnPlayerUpdate(playerid)
  1152. {
  1153. if(CColor[playerid] == true)
  1154. {
  1155. new
  1156. keys,
  1157. updown,
  1158. leftright,
  1159. Archivo[64];
  1160.  
  1161. GetPlayerKeys(playerid, keys, updown, leftright);
  1162.  
  1163. if(updown < 0) CSelec[playerid]--;//ARRIBA
  1164. else if(updown > 0) CSelec[playerid]++;//ABAJO
  1165. if(CSelec[playerid] > 4) CSelec[playerid] = 1;
  1166. else if(CSelec[playerid] < 1) CSelec[playerid] = 4;
  1167. if(keys & KEY_FIRE)
  1168. {
  1169. new
  1170. ColorC = RGBA(COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  1171.  
  1172. format(Archivo, sizeof Archivo, "Clanes/%s.ini", Clan_TAG[playerid]);
  1173. dini_IntSet(Archivo, "Color", ColorC);
  1174. CColor[playerid] = false;
  1175. COLORES[playerid][0] = 0;//ROJO
  1176. COLORES[playerid][1] = 0;//VERDE
  1177. COLORES[playerid][2] = 0;//AZUL
  1178. COLORES[playerid][3] = 255;//ALPHA
  1179. SetTimerEx("OcultarCombinador", 500, 0, "i", playerid);
  1180. for(new i = 0; i < MAX_PLAYERS; i++)
  1181. {
  1182. if(IsPlayerConnected(i))
  1183. if(Clan_ID[playerid] == Clan_ID[i])
  1184. SetPlayerColor(i, ColorC);
  1185. }
  1186. TogglePlayerControllable(playerid, 1);
  1187. GameTextForPlayer(playerid, "~y~~h~ Color seleccionado", 3000, 4);
  1188. }
  1189. if(leftright > 0)//DERECHA
  1190. {
  1191. if(CSelec[playerid] == 1)//ROJO
  1192. {
  1193. if(keys & KEY_SPRINT) COLORES[playerid][0] += 5;
  1194. else COLORES[playerid][0]++;
  1195. if(COLORES[playerid][0] > 255) COLORES[playerid][0] = 0;
  1196. }
  1197. if(CSelec[playerid] == 2)//VERDE
  1198. {
  1199. if(keys & KEY_SPRINT) COLORES[playerid][1] += 5;
  1200. else COLORES[playerid][1]++;
  1201. if(COLORES[playerid][1] > 255) COLORES[playerid][1] = 0;
  1202. }
  1203. if(CSelec[playerid] == 3)//AZUL
  1204. {
  1205. if(keys & KEY_SPRINT) COLORES[playerid][2] += 5;
  1206. else COLORES[playerid][2]++;
  1207. if(COLORES[playerid][2] > 255) COLORES[playerid][2] = 0;
  1208. }
  1209. if(CSelec[playerid] == 4)//ALPHA
  1210. {
  1211. if(keys & KEY_SPRINT) COLORES[playerid][3] += 5;
  1212. else COLORES[playerid][3]++;
  1213. if(COLORES[playerid][3] > 255) COLORES[playerid][3] = 0;
  1214. }
  1215.  
  1216. }
  1217. if(leftright < 0)//IZQUIERDA
  1218. {
  1219. if(CSelec[playerid] == 1)//ROJO
  1220. {
  1221. if(keys & KEY_SPRINT) COLORES[playerid][0] -= 5;
  1222. else COLORES[playerid][0]--;
  1223. if(COLORES[playerid][0] < 0) COLORES[playerid][0] = 255;
  1224. }
  1225. if(CSelec[playerid] == 2)//VERDE
  1226. {
  1227. if(keys & KEY_SPRINT) COLORES[playerid][1] -= 5;
  1228. else COLORES[playerid][1]--;
  1229. if(COLORES[playerid][1] < 0) COLORES[playerid][1] = 255;
  1230. }
  1231. if(CSelec[playerid] == 3)//AZUL
  1232. {
  1233. if(keys & KEY_SPRINT) COLORES[playerid][2] -= 5;
  1234. else COLORES[playerid][2]--;
  1235. if(COLORES[playerid][2] < 0) COLORES[playerid][2] = 255;
  1236. }
  1237. if(CSelec[playerid] == 4)//ALHPA
  1238. {
  1239. if(keys & KEY_SPRINT) COLORES[playerid][3] -= 5;
  1240. else COLORES[playerid][3]--;
  1241. if(COLORES[playerid][3] < 0) COLORES[playerid][3] = 255;
  1242. }
  1243. }
  1244. ActualizarCombinador(playerid);
  1245. }
  1246. return 1;
  1247. }
  1248.  
  1249. forward ActualizarCombinador(playerid);
  1250. public ActualizarCombinador(playerid)
  1251. {
  1252. new
  1253. str[128],
  1254. ColorS = RGBA(COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  1255.  
  1256. if(CSelec[playerid] == 1) {
  1257. format(str, sizeof str, "~w~>~r~ ROJO ~<~ %03d ~>~ ~n~~g~ VERDE ~<~ %03d ~>~ ~n~~b~ AZUL ~<~ %03d ~>~ ~n~~w~ ALPHA ~<~ %03d ~>~",
  1258. COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  1259. }
  1260. if(CSelec[playerid] == 2) {
  1261. format(str, sizeof str, "~r~ ROJO ~<~ %03d ~>~ ~n~~w~>~g~ VERDE ~<~ %03d ~>~ ~n~~b~ AZUL ~<~ %03d ~>~ ~n~~w~ ALPHA ~<~ %03d ~>~",
  1262. COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  1263. }
  1264. if(CSelec[playerid] == 3) {
  1265. format(str, sizeof str, "~r~ ROJO ~<~ %03d ~>~ ~n~~g~ VERDE ~<~ %03d ~>~ ~n~~w~>~b~ AZUL ~<~ %03d ~>~ ~n~~w~ ALPHA ~<~ %03d ~>~",
  1266. COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  1267. }
  1268. if(CSelec[playerid] == 4) {
  1269. format(str, sizeof str, "~r~ ROJO ~<~ %03d ~>~ ~n~~g~ VERDE ~<~ %03d ~>~ ~n~~b~ AZUL ~<~ %03d ~>~ ~n~~w~>~w~ ALPHA ~<~ %03d ~>~",
  1270. COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  1271. }
  1272. TextDrawSetString(Comb[playerid], str);
  1273.  
  1274. format(str, sizeof str, "~y~0x%x%x%x%x", COLORES[playerid][0], COLORES[playerid][1], COLORES[playerid][2], COLORES[playerid][3]);
  1275. TextDrawSetString(NumColor[playerid], str);
  1276.  
  1277. TextDrawHideForPlayer(playerid, Color[playerid]);
  1278. TextDrawDestroy(Color[playerid]);
  1279. Color[playerid] = TextDrawCreate(9.000000, 255.000000, "CAJA");
  1280. TextDrawBackgroundColor(Color[playerid], 0);
  1281. TextDrawFont(Color[playerid], 1);
  1282. TextDrawLetterSize(Color[playerid], 1.630000, 2.099999);
  1283. TextDrawColor(Color[playerid], 0);
  1284. TextDrawSetProportional(Color[playerid], 1);
  1285. TextDrawUseBox(Color[playerid], 1);
  1286. TextDrawBoxColor(Color[playerid], ColorS);
  1287. TextDrawTextSize(Color[playerid], 153.000000, 0.000000);
  1288. TextDrawShowForPlayer(playerid, Color[playerid]);
  1289. }
  1290.  
  1291. forward MostrarCombinador(playerid);
  1292. public MostrarCombinador(playerid)
  1293. {
  1294. NumColor[playerid] = TextDrawCreate(9.000000, 237.000000, "~y~0x00000000");
  1295. TextDrawBackgroundColor(NumColor[playerid], 255);
  1296. TextDrawFont(NumColor[playerid], 1);
  1297. TextDrawLetterSize(NumColor[playerid], 0.500000, 1.000000);
  1298. TextDrawColor(NumColor[playerid], -1);
  1299. TextDrawSetOutline(NumColor[playerid], 0);
  1300. TextDrawSetProportional(NumColor[playerid], 1);
  1301. TextDrawSetShadow(NumColor[playerid], 1);
  1302. TextDrawUseBox(NumColor[playerid], 1);
  1303. TextDrawBoxColor(NumColor[playerid], 1684300900);
  1304. TextDrawTextSize(NumColor[playerid], 153.000000, 0.000000);
  1305.  
  1306. Color[playerid] = TextDrawCreate(9.000000, 255.000000, "CAJA");
  1307. TextDrawFont(Color[playerid], 1);
  1308. TextDrawLetterSize(Color[playerid], 1.630000, 2.099999);
  1309. TextDrawColor(Color[playerid], 0);
  1310. TextDrawSetProportional(Color[playerid], 1);
  1311. TextDrawUseBox(Color[playerid], 1);
  1312. TextDrawBoxColor(Color[playerid], 0);
  1313. TextDrawTextSize(Color[playerid], 153.000000, 0.000000);
  1314.  
  1315. CComb[playerid] = TextDrawCreate(9.000000, 283.000000, "CAJA");
  1316. TextDrawBackgroundColor(CComb[playerid], 0);
  1317. TextDrawFont(CComb[playerid], 1);
  1318. TextDrawLetterSize(CComb[playerid], 1.630000, 5.100001);
  1319. TextDrawColor(CComb[playerid], 0);
  1320. TextDrawSetOutline(CComb[playerid], 0);
  1321. TextDrawSetProportional(CComb[playerid], 1);
  1322. TextDrawSetShadow(CComb[playerid], 1);
  1323. TextDrawUseBox(CComb[playerid], 1);
  1324. TextDrawBoxColor(CComb[playerid], 1684300900);
  1325. TextDrawTextSize(CComb[playerid], 153.000000, 0.000000);
  1326.  
  1327. Comb[playerid] = TextDrawCreate(9.000000, 280.000000, "~r~ ROJO ~<~ 255 ~>~ ~n~~g~ VERDE ~<~ 255 ~>~ ~n~~b~ AZUL ~<~ 255 ~>~ ~n~~w~ ALPHA ~<~ 255 ~>~");
  1328. TextDrawBackgroundColor(Comb[playerid], 255);
  1329. TextDrawFont(Comb[playerid], 2);
  1330. TextDrawLetterSize(Comb[playerid], 0.400000, 1.400000);
  1331. TextDrawColor(Comb[playerid], -1);
  1332. TextDrawSetOutline(Comb[playerid], 0);
  1333. TextDrawSetProportional(Comb[playerid], 1);
  1334. TextDrawSetShadow(Comb[playerid], 1);
  1335.  
  1336. TextDrawShowForPlayer(playerid, NumColor[playerid]);
  1337. TextDrawShowForPlayer(playerid, Color[playerid]);
  1338. TextDrawShowForPlayer(playerid, CComb[playerid]);
  1339. TextDrawShowForPlayer(playerid, Comb[playerid]);
  1340. }
  1341.  
  1342. forward OcultarCombinador(playerid);
  1343. public OcultarCombinador(playerid)
  1344. {
  1345. TextDrawHideForPlayer(playerid, NumColor[playerid]);
  1346. TextDrawHideForPlayer(playerid, Color[playerid]);
  1347. TextDrawHideForPlayer(playerid, CComb[playerid]);
  1348. TextDrawHideForPlayer(playerid, Comb[playerid]);
  1349.  
  1350. TextDrawDestroy(NumColor[playerid]);
  1351. TextDrawDestroy(Color[playerid]);
  1352. TextDrawDestroy(CComb[playerid]);
  1353. TextDrawDestroy(Comb[playerid]);
  1354. }
  1355.  
  1356. forward ActualizarListaJugadores();
  1357. public ActualizarListaJugadores()
  1358. {
  1359. new
  1360. File:file,
  1361. bool:Existe = false,
  1362. string[128],
  1363. str[32];
  1364.  
  1365. for(new i = 0; i < MAX_PLAYERS; i++)
  1366. {
  1367. if(IsPlayerConnected(i))
  1368. {
  1369. if(Ingresado[i] == true)
  1370. {
  1371. format(str, sizeof(str), "%s;", Nickname[i]);
  1372. file = fopen("Jugadores.txt", io_read);
  1373. while(fread(file, string))
  1374. {
  1375. if(strfind(string, str, true) == 0)
  1376. {
  1377. Existe = true;
  1378. }
  1379. }
  1380. fclose(file);
  1381. if(Existe == false)
  1382. {
  1383. file = fopen("Jugadores.txt", io_append);
  1384. format(string, sizeof(string), "%s;\r\n", Nickname[i]);
  1385. fwrite(file, string);
  1386. fclose(file);
  1387. }
  1388. }
  1389. }
  1390. Existe = false;
  1391. }
  1392. }
  1393.  
  1394.  
  1395. forward ActualizarTopClanes();
  1396. public ActualizarTopClanes()
  1397. {
  1398. new
  1399. File:file,
  1400. Archivo[64],
  1401. string[128],
  1402. Linea,
  1403. Lugar,
  1404. Float:MAX_VALOR = -1.0;
  1405.  
  1406. file = fopen("Clanes.txt", io_read);
  1407. while(fread(file, string))
  1408. {
  1409. new
  1410. v = strfind(string, ";", true);
  1411.  
  1412. strmid(NOMBRE[Linea], string, 0, v, 32);
  1413. format(Archivo, sizeof(Archivo), "Clanes/%s.ini", NOMBRE[Linea]);
  1414. if(dini_Exists(Archivo))
  1415. {
  1416. VALOR[Linea] = dini_Float(Archivo, "Ratio");
  1417. }
  1418. Linea++;
  1419. }
  1420. fclose(file);
  1421.  
  1422. Lugar = 1;
  1423. while(Lugar < 11)
  1424. {
  1425. for(new i = 0; i < 3000; i++)
  1426. {
  1427. if(EnTop[i] == 0)
  1428. {
  1429. if(VALOR[i] > MAX_VALOR)
  1430. {
  1431. MAX_VALOR = VALOR[i];
  1432. Top[Lugar] = i;
  1433. }
  1434. }
  1435. }
  1436. strmid(TopInfo[Lugar][NickTOP], NOMBRE[Top[Lugar]], 0, 32, 32);
  1437. format(Archivo, sizeof(Archivo), "Clanes/%s.ini", TopInfo[Lugar][NickTOP]);
  1438. TopInfo[Lugar][AsesinatosTOP] = dini_Int(Archivo, "Asesinatos");
  1439. TopInfo[Lugar][MuertesTOP] = dini_Int(Archivo, "Muertes");
  1440. TopInfo[Lugar][RatioTOP] = dini_Float(Archivo, "Ratio");
  1441. EnTop[Top[Lugar]] = 1;
  1442. MAX_VALOR = -1;
  1443. Lugar++;
  1444. }
  1445.  
  1446. for(new s = 0; s < 3000; s++) EnTop[s] = 0;
  1447. format(DLG_TOP_CLAN_STR, sizeof(DLG_TOP_CLAN_STR),"");
  1448. Lugar = 1;
  1449. while(Lugar < 11)
  1450. {
  1451. format(DLG_TOP_CLAN_STR, sizeof(DLG_TOP_CLAN_STR),
  1452. "%s| %02d | %s | Asesinatos: %d | Muertes: %d | Ratio: %0.0f|\n",
  1453. DLG_TOP_CLAN_STR, Lugar, TopInfo[Lugar][NickTOP], TopInfo[Lugar][AsesinatosTOP],
  1454. TopInfo[Lugar][MuertesTOP], TopInfo[Lugar][RatioTOP]);
  1455. Lugar++;
  1456. }
  1457. SetTimer("ActualizarTopClanes", 62000, 0);
  1458. }
  1459.  
  1460. forward ActualizarTopPlayers();
  1461. public ActualizarTopPlayers()
  1462. {
  1463. new
  1464. File:file,
  1465. Archivo[64],
  1466. string[128],
  1467. Linea,
  1468. Lugar,
  1469. Float:MAX_VALOR = -1.0;
  1470.  
  1471. file = fopen("Jugadores.txt", io_read);
  1472.  
  1473. while(fread(file, string))
  1474. {
  1475. new
  1476. v = strfind(string, ";", true);
  1477.  
  1478. strmid(NOMBRE[Linea], string, 0, v, 32);
  1479. format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", NOMBRE[Linea]);
  1480. if(dini_Exists(Archivo))
  1481. {
  1482. VALOR[Linea] = dini_Float(Archivo, "Ratio");
  1483. }
  1484. Linea++;
  1485. }
  1486. fclose(file);
  1487.  
  1488. Lugar = 1;
  1489. while(Lugar < 11)
  1490. {
  1491. for(new i = 0; i < 3000; i++)
  1492. {
  1493. if(EnTop[i] == 0)
  1494. {
  1495. if(VALOR[i] > MAX_VALOR)
  1496. {
  1497. MAX_VALOR = VALOR[i];
  1498. Top[Lugar] = i;
  1499. }
  1500. }
  1501. }
  1502. strmid(TopInfo[Lugar][NickTOP], NOMBRE[Top[Lugar]], 0, 32, 32);
  1503. format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", TopInfo[Lugar][NickTOP]);
  1504. TopInfo[Lugar][AsesinatosTOP] = dini_Int(Archivo, "Asesinatos");
  1505. TopInfo[Lugar][MuertesTOP] = dini_Int(Archivo, "Muertes");
  1506. TopInfo[Lugar][RatioTOP] = dini_Float(Archivo, "Ratio");
  1507. EnTop[Top[Lugar]] = 1;
  1508. MAX_VALOR = -1;
  1509. Lugar++;
  1510. }
  1511.  
  1512. for(new s = 0; s < 3000; s++) EnTop[s] = 0;
  1513. format(DLG_TOP_PLY_STR, sizeof(DLG_TOP_PLY_STR),"");
  1514. Lugar = 1;
  1515. while(Lugar < 11)
  1516. {
  1517. format(DLG_TOP_PLY_STR, sizeof(DLG_TOP_PLY_STR),
  1518. "%s| %02d | %s | Asesinatos: %d | Muertes: %d | Ratio: %0.0f|\n",
  1519. DLG_TOP_PLY_STR, Lugar, TopInfo[Lugar][NickTOP], TopInfo[Lugar][AsesinatosTOP],
  1520. TopInfo[Lugar][MuertesTOP], TopInfo[Lugar][RatioTOP]);
  1521. Lugar++;
  1522. }
  1523. SetTimer("ActualizarTopPlayers", 60000, 0);
  1524. SetTimer("ActualizarListaJugadores", 10000, 0);
  1525. }
  1526.  
  1527. stock Registrar(playerid, pass[])
  1528. {
  1529. new
  1530. Archivo[64],
  1531. str[128];
  1532.  
  1533. format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", NickName(playerid));
  1534. if(!dini_Exists(Archivo))
  1535. {
  1536. dini_Create(Archivo);
  1537. dini_Set(Archivo, "Contrasena", pass);
  1538. dini_IntSet(Archivo, "Asesinatos", 0);
  1539. dini_IntSet(Archivo, "Muertes", 0);
  1540. dini_IntSet(Archivo, "Nivel", 0);
  1541. PlayerInfo[playerid][Nivel] = dini_Int(Archivo, "Nivel");
  1542. dini_FloatSet(Archivo, "Ratio", 0.0);
  1543. dini_Set(Archivo, "Clan", "<Ninguno>");
  1544. format(str, sizeof(str), "Nick '%s' registrado. Contrasena: '%s' ", NickName(playerid), pass);
  1545. SendClientMessage(playerid, NICESKY, str);
  1546. Registrado[playerid] = true;
  1547. SendClientMessage(playerid, NARANJA, "Ahora usa /login [contraseña]");
  1548. }
  1549. }
  1550.  
  1551. stock Login(playerid, pass[])
  1552. {
  1553. new
  1554. Archivo[64],
  1555. Nick[MAX_PLAYER_NAME];
  1556.  
  1557. format(Archivo, sizeof(Archivo), "Jugadores/%s.ini", NickName(playerid));
  1558. if(dini_Exists(Archivo))
  1559. {
  1560. if(!strcmp(dini_Get(Archivo, "Contrasena"), pass, false))
  1561. {
  1562. strmid(Nickname[playerid], NickName(playerid), 0, MAX_PLAYER_NAME, MAX_PLAYER_NAME);
  1563. PlayerInfo[playerid][Nivel] = dini_Int(Archivo, "Nivel");
  1564. Asesinatos[playerid] = dini_Int(Archivo, "Asesinatos");
  1565. Muertes[playerid] = dini_Int(Archivo, "Muertes");
  1566. Ratio[playerid] = dini_Float(Archivo, "Ratio");
  1567. Ingresado[playerid] = true;
  1568. format(Archivo, sizeof Archivo, "Clanes/%s.ini", dini_Get(Archivo, "Clan"));
  1569. if(dini_Exists(Archivo))
  1570. {
  1571. format(Clan_TAG[playerid], 4, dini_Get(Archivo, "TAG"));
  1572. format(Nick, sizeof Nick, "[%s]%s", Clan_TAG[playerid], NickName(playerid));
  1573. SetPlayerName(playerid, Nick);
  1574. SetPlayerColor(playerid, dini_Int(Archivo, "Color"));
  1575. Clan_ID[playerid] = dini_Int(Archivo, "ID");
  1576. EnClan[playerid] = true;
  1577. }
  1578. SendClientMessage(playerid, NICESKY, "Logueado Correctamente");
  1579. } else SendClientMessage(playerid, ROJO, "Contraseña Incorrecta");
  1580. }
  1581. }
  1582.  
  1583. stock NickName(playerid)
  1584. {
  1585. new
  1586. NickP[MAX_PLAYER_NAME];
  1587.  
  1588. GetPlayerName(playerid, NickP, MAX_PLAYER_NAME);
  1589. return NickP;
  1590. }
  1591.  
  1592. //Por Zamaroht
  1593. stock RGBA(red, green, blue, alpha)
  1594. {
  1595. return (red * 16777216) + (green * 65536) + (blue * 256) + alpha;
  1596. }
  1597.  
  1598. //Por Zoutdaxv
  1599. stock IsAHexNumber(string[])
  1600. {
  1601. new
  1602. longitud = strlen(string);
  1603.  
  1604. for(new s = 0; s < longitud; s++)
  1605. {
  1606. if(string[s] < 48 || string[s] > 57 && string[s] < 65 || string[s] > 70)
  1607. {
  1608. return false;
  1609. }
  1610. }
  1611. return true;
  1612. }
  1613.  
  1614. //Por Dracoblue
  1615. stock HexToInt(string[])
  1616. {
  1617. if(string[0] == 0) return 0;
  1618.  
  1619. new
  1620. i = strlen(string),
  1621. cur = 1,
  1622. res = 0;
  1623.  
  1624. for( ; i > 0; i--)
  1625. {
  1626. if(string[i-1] < 58) res = res + cur * (string[i-1] - 48);
  1627. else res = res + cur * (string[i-1] - 55);
  1628. cur = cur * 16;
  1629. }
  1630. return res;
  1631. }
  1632.  
  1633. stock strtok(const string[], &index)
  1634. {
  1635. new length = strlen(string);
  1636. while ((index < length) && (string[index] <= ' '))
  1637. {
  1638. index++;
  1639. }
  1640.  
  1641. new offset = index;
  1642. new result[20];
  1643. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  1644. {
  1645. result[index - offset] = string[index];
  1646. index++;
  1647. }
  1648. result[index - offset] = EOS;
  1649. return result;
  1650. }
  1651.  
  1652. stock strrest(const string[], &index)
  1653. {
  1654. new length = strlen(string);
  1655. while ((index < length) && (string[index] <= ' '))
  1656. {
  1657. index++;
  1658. }
  1659. new offset = index;
  1660. new result[24];
  1661. while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
  1662. {
  1663. result[index - offset] = string[index];
  1664. index++;
  1665. }
  1666. result[index - offset] = EOS;
  1667. return result;
  1668. }
  1669.  
  1670.  
  1671. forward MsgAdmins(color,const string[],level);
  1672. public MsgAdmins(color,const string[],level)
  1673. {
  1674. for(new i = 0; i < MAX_PLAYERS; i++)
  1675. {
  1676. if(IsPlayerConnected(i))
  1677. {
  1678. if (PlayerInfo[i][Nivel] >= level)
  1679. {
  1680. SendClientMessage(i, color, string);
  1681. }
  1682. }
  1683. }
  1684. return 1;
  1685. }
  1686. public OnPlayerSelectedMenuRow(playerid, row)
  1687. {
  1688. new Menu:current;
  1689. current = GetPlayerMenu(playerid);
  1690. if(current == armas)
  1691. {
  1692. switch(row)
  1693. {
  1694. case 0: { GivePlayerWeapon(playerid,22,800);}
  1695. case 1: { GivePlayerWeapon(playerid,28,800);}
  1696. case 2: { GivePlayerWeapon(playerid,26,800);}
  1697. case 3: { GivePlayerWeapon(playerid,16,800);}
  1698. case 4: { GivePlayerWeapon(playerid,41,800); SendClientMessage(playerid,Rojo,"No Abuses de Esta Arma");}
  1699. case 5: { GivePlayerWeapon(playerid,37,800); SendClientMessage(playerid,Rojo,"No Abuses de Esta Arma");}
  1700. case 6: { GivePlayerWeapon(playerid,36,800); SendClientMessage(playerid,Rojo,"No Abuses de Esta Arma");}
  1701. case 7: { GivePlayerWeapon(playerid,35,800); SendClientMessage(playerid,Rojo,"No Abuses de Esta Arma");}
  1702. case 8: { GivePlayerWeapon(playerid,38,800); SendClientMessage(playerid,Rojo,"No Abuses de Esta Arma");}
  1703. }
  1704. }
  1705. return 1;
  1706. }
  1707.  
  1708. stock sscanf(string[], format[], {Float,_}:...)
  1709. {
  1710. #if defined isnull
  1711. if (isnull(string))
  1712. #else
  1713. if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  1714. #endif
  1715. {
  1716. return format[0];
  1717. }
  1718. #pragma tabsize 4
  1719. new
  1720. formatPos = 0,
  1721. stringPos = 0,
  1722. paramPos = 2,
  1723. paramCount = numargs(),
  1724. delim = ' ';
  1725. while (string[stringPos] && string[stringPos] <= ' ')
  1726. {
  1727. stringPos++;
  1728. }
  1729. while (paramPos < paramCount && string[stringPos])
  1730. {
  1731. switch (format[formatPos++])
  1732. {
  1733. case '\0':
  1734. {
  1735. return 0;
  1736. }
  1737. case 'i', 'd':
  1738. {
  1739. new
  1740. neg = 1,
  1741. num = 0,
  1742. ch = string[stringPos];
  1743. if (ch == '-')
  1744. {
  1745. neg = -1;
  1746. ch = string[++stringPos];
  1747. }
  1748. do
  1749. {
  1750. stringPos++;
  1751. if ('0' <= ch <= '9')
  1752. {
  1753. num = (num * 10) + (ch - '0');
  1754. }
  1755. else
  1756. {
  1757. return -1;
  1758. }
  1759. }
  1760. while ((ch = string[stringPos]) > ' ' && ch != delim);
  1761. setarg(paramPos, 0, num * neg);
  1762. }
  1763. case 'h', 'x':
  1764. {
  1765. new
  1766. num = 0,
  1767. ch = string[stringPos];
  1768. do
  1769. {
  1770. stringPos++;
  1771. switch (ch)
  1772. {
  1773. case 'x', 'X':
  1774. {
  1775. num = 0;
  1776. continue;
  1777. }
  1778. case '0' .. '9':
  1779. {
  1780. num = (num << 4) | (ch - '0');
  1781. }
  1782. case 'a' .. 'f':
  1783. {
  1784. num = (num << 4) | (ch - ('a' - 10));
  1785. }
  1786. case 'A' .. 'F':
  1787. {
  1788. num = (num << 4) | (ch - ('A' - 10));
  1789. }
  1790. default:
  1791. {
  1792. return -1;
  1793. }
  1794. }
  1795. }
  1796. while ((ch = string[stringPos]) > ' ' && ch != delim);
  1797. setarg(paramPos, 0, num);
  1798. }
  1799. case 'c':
  1800. {
  1801. setarg(paramPos, 0, string[stringPos++]);
  1802. }
  1803. case 'f':
  1804. {
  1805. setarg(paramPos, 0, _:floatstr(string[stringPos]));
  1806. }
  1807. case 'p':
  1808. {
  1809. delim = format[formatPos++];
  1810. continue;
  1811. }
  1812. case '\'':
  1813. {
  1814. new
  1815. end = formatPos - 1,
  1816. ch;
  1817. while ((ch = format[++end]) && ch != '\'') {}
  1818. if (!ch)
  1819. {
  1820. return -1;
  1821. }
  1822. format[end] = '\0';
  1823. if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  1824. {
  1825. if (format[end + 1])
  1826. {
  1827. return -1;
  1828. }
  1829. return 0;
  1830. }
  1831. format[end] = '\'';
  1832. stringPos = ch + (end - formatPos);
  1833. formatPos = end + 1;
  1834. }
  1835. case 'u':
  1836. {
  1837. new
  1838. end = stringPos - 1,
  1839. id = 0,
  1840. bool:num = true,
  1841. ch;
  1842. while ((ch = string[++end]) && ch != delim)
  1843. {
  1844. if (num)
  1845. {
  1846. if ('0' <= ch <= '9')
  1847. {
  1848. id = (id * 10) + (ch - '0');
  1849. }
  1850. else
  1851. {
  1852. num = false;
  1853. }
  1854. }
  1855. }
  1856. if (num && IsPlayerConnected(id))
  1857. {
  1858. setarg(paramPos, 0, id);
  1859. }
  1860. else
  1861. {
  1862. #if !defined foreach
  1863. #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  1864. #define __SSCANF_FOREACH__
  1865. #endif
  1866. string[end] = '\0';
  1867. num = false;
  1868. new
  1869. name[MAX_PLAYER_NAME];
  1870. id = end - stringPos;
  1871. foreach (Player, playerid)
  1872. {
  1873. GetPlayerName(playerid, name, sizeof (name));
  1874. if (!strcmp(name, string[stringPos], true, id))
  1875. {
  1876. setarg(paramPos, 0, playerid);
  1877. num = true;
  1878. break;
  1879. }
  1880. }
  1881. if (!num)
  1882. {
  1883. setarg(paramPos, 0, INVALID_PLAYER_ID);
  1884. }
  1885. string[end] = ch;
  1886. #if defined __SSCANF_FOREACH__
  1887. #undef foreach
  1888. #undef __SSCANF_FOREACH__
  1889. #endif
  1890. }
  1891. stringPos = end;
  1892. }
  1893. case 's', 'z':
  1894. {
  1895. new
  1896. i = 0,
  1897. ch;
  1898. if (format[formatPos])
  1899. {
  1900. while ((ch = string[stringPos++]) && ch != delim)
  1901. {
  1902. setarg(paramPos, i++, ch);
  1903. }
  1904. if (!i)
  1905. {
  1906. return -1;
  1907. }
  1908. }
  1909. else
  1910. {
  1911. while ((ch = string[stringPos++]))
  1912. {
  1913. setarg(paramPos, i++, ch);
  1914. }
  1915. }
  1916. stringPos--;
  1917. setarg(paramPos, i, '\0');
  1918. }
  1919. default:
  1920. {
  1921. continue;
  1922. }
  1923. }
  1924. while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  1925. {
  1926. stringPos++;
  1927. }
  1928. while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  1929. {
  1930. stringPos++;
  1931. }
  1932. paramPos++;
  1933. }
  1934. do
  1935. {
  1936. if ((delim = format[formatPos++]) > ' ')
  1937. {
  1938. if (delim == '\'')
  1939. {
  1940. while ((delim = format[formatPos++]) && delim != '\'') {}
  1941. }
  1942. else if (delim != 'z')
  1943. {
  1944. return delim;
  1945. }
  1946. }
  1947. }
  1948. while (delim > ' ');
  1949. return 0;
  1950. }
  1951.  
  1952. forward Descongelame(player1);
  1953. public Descongelame(player1)
  1954. {
  1955. KillTimer( CongelarTimer[player1] );
  1956. TogglePlayerControllable(player1,true); PlayerInfo[player1][Congelado] = 0;
  1957. PlayerPlaySound(player1,1057,0.0,0.0,0.0); GameTextForPlayer(player1,"~g~Descongelado",3000,3);
  1958. }
  1959. forward SacarCarcel(player1);
  1960. public SacarCarcel(player1)
  1961. {
  1962. KillTimer( CarcelTimer[player1] );
  1963. PlayerInfo[player1][CarcelTiempo] = 0; PlayerInfo[player1][Carcel] = 0;
  1964. SetPlayerInterior(player1,0); SetPlayerPos(player1, 0.0, 0.0, 0.0); SpawnPlayer(player1);
  1965. PlayerPlaySound(player1,1057,0.0,0.0,0.0);
  1966. GameTextForPlayer(player1,"~g~Liberado",3000,3);
  1967. }
  1968. //=========----------------------=========//
  1969. forward Carcel1(player1);
  1970. public Carcel1(player1)
  1971. {
  1972. TogglePlayerControllable(player1,false);
  1973. new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z);
  1974. ResetPlayerWeapons(player1);
  1975. SetPlayerCameraPos(player1,x+10,y,z+10);SetPlayerCameraLookAt(player1,x,y,z);
  1976. SetTimerEx("Carcel2",1000,0,"d",player1);
  1977. }
  1978. //=========----------------------=========//
  1979. forward Carcel2(player1);
  1980. public Carcel2(player1)
  1981. {
  1982. new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z);
  1983. ResetPlayerWeapons(player1);
  1984. SetPlayerCameraPos(player1,x+7,y,z+5); SetPlayerCameraLookAt(player1,x,y,z);
  1985. if(GetPlayerState(player1) == PLAYER_STATE_ONFOOT) SetPlayerSpecialAction(player1,SPECIAL_ACTION_HANDSUP);
  1986. GameTextForPlayer(player1,"~r~Atrapado",3000,3);
  1987. SetTimerEx("Carcel3",1000,0,"d",player1);
  1988. }
  1989. //=========----------------------=========//
  1990. forward Carcel3(player1);
  1991. public Carcel3(player1)
  1992. {
  1993. new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z);
  1994. ResetPlayerWeapons(player1);
  1995. SetPlayerCameraPos(player1,x+3,y,z); SetPlayerCameraLookAt(player1,x,y,z);
  1996. SetTimerEx("CarcelPlayer",1000,0,"d",player1);
  1997. }
  1998. //=========----------------------=========//
  1999. forward CarcelPlayer(player1);
  2000. public CarcelPlayer(player1)
  2001. {
  2002. TogglePlayerControllable(player1,true);
  2003. SetPlayerPos(player1,197.6661,173.8179,1003.0234);
  2004. ResetPlayerWeapons(player1);
  2005. SetPlayerInterior(player1,3);
  2006. SetCameraBehindPlayer(player1);
  2007. CarcelTimer[player1] = SetTimerEx("SacarCarcel",PlayerInfo[player1][CarcelTiempo],0,"d",player1);
  2008. PlayerInfo[player1][Carcel] = 1;
  2009. }
  2010.  
  2011. //=====================[Conteo]=====================//
  2012. forward Conteo5(playerid);
  2013. forward Conteo4(playerid);
  2014. forward Conteo3(playerid);
  2015. forward Conteo2(playerid);
  2016. forward Conteo1(playerid);
  2017. forward ConteoGo(playerid);
  2018. public Conteo5(playerid)
  2019. {
  2020. SetTimerEx("Conteo4", 1000, false, "d", playerid);
  2021. for(new i = 0; i < MAX_PLAYERS; i++)
  2022. {
  2023. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2024. }
  2025. GameTextForAll("~r~5!", 1000, 4);
  2026. return 1;
  2027. }
  2028.  
  2029. public Conteo4(playerid)
  2030. {
  2031. SetTimerEx("Conteo3", 1000, false, "d", playerid);
  2032. for(new i = 0; i < MAX_PLAYERS; i++)
  2033. {
  2034. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2035. }
  2036. GameTextForAll("~g~4!", 1000, 4);
  2037. return 1;
  2038. }
  2039.  
  2040. public Conteo3(playerid)
  2041. {
  2042. SetTimerEx("Conteo2", 1000, false, "d", playerid);
  2043. for(new i = 0; i < MAX_PLAYERS; i++)
  2044. {
  2045. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2046. }
  2047. GameTextForAll("~b~3!", 1000, 4);
  2048. return 1;
  2049. }
  2050.  
  2051. public Conteo2(playerid)
  2052. {
  2053. SetTimerEx("Conteo1", 1000, false, "d", playerid);
  2054. for(new i = 0; i < MAX_PLAYERS; i++)
  2055. {
  2056. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2057. }
  2058. GameTextForAll("~y~2!", 1000, 4);
  2059. return 1;
  2060. }
  2061.  
  2062. public Conteo1(playerid)
  2063. {
  2064. SetTimerEx("ConteoGo", 1000, false, "d", playerid);
  2065. for(new i = 0; i < MAX_PLAYERS; i++)
  2066. {
  2067. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2068. }
  2069. GameTextForAll("~p~1!", 1000, 4);
  2070. return 1;
  2071. }
  2072.  
  2073. public ConteoGo(playerid)
  2074. {
  2075. Conteo = 0;
  2076. for(new i = 0; i < MAX_PLAYERS; i++)
  2077. {
  2078. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  2079. }
  2080. GameTextForAll("~g~G~g~o~w~o~r~o~p~!", 1500, 4);
  2081. return 1;
  2082. }
  2083.  
  2084. stock JugadorEnBici(playerid)
  2085. {
  2086. if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  2087. {
  2088. if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 481 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 509 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 510) return 1;
  2089. }
  2090. return 0;
  2091. }
  2092. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  2093. {
  2094. if ((oldkeys & (KEY_ACTION | KEY_ACTION)) == (KEY_ACTION | KEY_ACTION))
  2095. {
  2096. if(SaltosBici[playerid] == 1 && JugadorEnBici(playerid))
  2097. {
  2098. new Float:x,Float:y,Float:z;
  2099. GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
  2100. SetTimerEx("SaltosBiciTimer",150,0,"d",playerid);
  2101. SaltosBici[playerid] = 2;
  2102. }
  2103. }
  2104. return 0;
  2105. }
  2106. forward SaltosBiciTimer(playerid);
  2107. public SaltosBiciTimer(playerid)
  2108. {
  2109. if(IsPlayerConnected(playerid) && JugadorEnBici(playerid))
  2110. {
  2111. if(SaltosBici[playerid] == 2)
  2112. {
  2113. new Float:x,Float:y,Float:z;
  2114. GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
  2115. if(z < 0) return SaltosBici[playerid] = 1;
  2116. SetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z+(z*4));
  2117. SetTimerEx("SaltosBiciTimer",4000,0,"d",playerid);
  2118. SaltosBici[playerid] = 3;
  2119. }
  2120. else if(SaltosBici[playerid] == 3) SaltosBici[playerid] = 1;
  2121. }
  2122. return 1;
  2123. }
  2124. public OnPlayerStateChange(playerid, newstate, oldstate)
  2125. {
  2126. if(newstate == PLAYER_STATE_ONFOOT)
  2127. {
  2128. if(SaltosBici[playerid] > 1) SaltosBici[playerid] = 1;
  2129. }
  2130. return 1;
  2131. }
  2132.  
Advertisement
Add Comment
Please, Sign In to add comment