Guest User

Clans System by Harvey

a guest
Jun 1st, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 38.08 KB | None | 0 0
  1. // -----------------------------------------------------------------------------
  2. /*
  3. |--- Filterscript Clan System - Gang system");
  4. |--  Script v1.01 Credits Harvey");
  5. |-- Date 2020                   ");
  6. https://www.facebook.com/B28345/
  7. */
  8. // -----------------------------------------------------------------------------
  9. #include <a_samp>
  10. #include <MXini>
  11. #include <file>
  12. #include  <zcmd>
  13. //CQB Shield System//
  14. #define RED 0xFF0000FF
  15. #define GREEN 0x00A200FF
  16. #define BLUE 0x0000DAFF
  17. #define ORANGE 0xFFB400FF
  18. #define WHITE 0xFFFFFFAA
  19. #define COLOR_BLUE 0x33CCFFAA
  20. #define red 0xFF0000AA
  21. #define COLOR_GRAD1 0xB4B5B7FF
  22. #define COLOR_WHITE 0xFFFFFFAA
  23. #define FILTERSCRIPT
  24. #define Dialog_Default  12033
  25. //Gangs
  26. #define MAX_GANGS 500
  27. //------------------------
  28. //Name System
  29. new Text3D:playertarget[MAX_PLAYERS];
  30. //Shield System
  31. new ShieldObject[MAX_PLAYERS];
  32. new HasShield[MAX_PLAYERS];
  33. //------------------------
  34. //Other Variables
  35. new tgang[MAX_PLAYERS],inigangname[MAX_GANGS][256],col[MAX_GANGS][256],gangskin[MAX_PLAYERS],id[MAX_PLAYERS] = -1;
  36. new GangName[MAX_GANGS][256],Gang[MAX_GANGS],GangLvl[MAX_PLAYERS],GName[MAX_GANGS][256];
  37. new GColor[MAX_GANGS][10],PGang[MAX_PLAYERS],Float:GSpawnX[MAX_GANGS],Float:GSpawnY[MAX_GANGS],Float:GSpawnZ[MAX_GANGS],GSkin[MAX_GANGS][7];
  38.  
  39.  
  40. public OnFilterScriptInit()
  41. {
  42.     printf( "Started Gangs Filterscript");
  43.     ShowNameTags(false);
  44.     return 1;
  45. }
  46.  
  47. public OnFilterScriptExit()
  48. {
  49.     for(new i; i<MAX_PLAYERS; i++){SaveAccount(i);}
  50.     printf( "Ended Gangs Filterscript");
  51.     return true;
  52. }
  53.  
  54. enum AutoPlayer
  55. {
  56.     pVehicle
  57. };
  58. new AccInfo[MAX_PLAYERS][AutoPlayer];
  59.  
  60.  
  61. forward VehicleSpawner(playerid,model);
  62. forward RespawnVehicle(vehicleid);
  63. forward DeleteVehicle(vehicleid);
  64.  
  65.  
  66. ShowPlayerDefaultDialog( playerid )
  67. {
  68. ShowPlayerDialog( playerid, 10, DIALOG_STYLE_LIST, "Vehiculos", "Aviones\nHelicopteros\nMotos\nTodoterreno\nServicio Publico\nBarcos", "Aceptar", "Cancelar" );
  69. return 1;
  70. }
  71.  
  72. //------------------------------------------------------------------
  73. //------------------------------------------------------------------
  74. //------------------------------------------------------------------
  75. //------------------------------------------------------------------
  76.  
  77.  
  78. public OnPlayerDisconnect(playerid, reason)
  79. {
  80. SaveAccount(playerid);
  81. DestroyObject(ShieldObject[playerid]);//sistema de Shield CQB
  82. if(AccInfo[playerid][pVehicle] != -1) DeleteVehicle(AccInfo[playerid][pVehicle]);
  83. Delete3DTextLabel(playertarget[playerid]);//sistema de nombre//
  84. return true;
  85. }
  86.  
  87. public OnPlayerRequestClass(playerid, classid)
  88. {
  89. PGang[playerid] = 0;
  90. GangLvl[playerid] = 0;
  91. LoadAccount(playerid);
  92. return true;
  93. }
  94.  
  95. public OnPlayerSpawn(playerid)
  96. {
  97. SetTimerEx("Spawn", 0, false, "i", playerid);
  98. HasShield[playerid] = 0;//Sistema de escudo CQB
  99. return true;
  100. }
  101. ///---------------------------------------------------------------------------------------------
  102. ///---------------------------------------------------------------------------------------------
  103. ///---------------------------------------------------------------------------------------------
  104. ///-------------------------------Sistema de escudo CQB-----------------------------------------
  105. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  106. {
  107.     if(newkeys == KEY_JUMP)
  108.     {
  109.         if(HasShield[playerid] == 1)
  110.         {
  111.             new Float: X, Float: Y, Float: Z;
  112.             GetPlayerPos(playerid,X,Y,Z);
  113.             SetPlayerPos(playerid,X,Y,Z);
  114.             ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
  115.             SetTimerEx("TAnim", 500, 0, "i", playerid);
  116.         }
  117.     }
  118.     if(newkeys == KEY_FIRE)
  119.     {
  120.         if(HasShield[playerid] == 1)
  121.         {
  122.             ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
  123.             SetTimerEx("TAnim", 500, 0, "i", playerid);
  124.         }
  125.     }
  126.     if(newkeys == KEY_CROUCH)
  127.     {
  128.         if(HasShield[playerid] == 1)
  129.         {
  130.             new Float: X, Float: Y, Float: Z;
  131.             GetPlayerPos(playerid,X,Y,Z);
  132.             SetPlayerPos(playerid,X,Y,Z);
  133.             ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
  134.             SetTimerEx("TAnim", 500, 0, "i", playerid);
  135.         }
  136.     }
  137.     if(newkeys == KEY_SECONDARY_ATTACK)
  138.     {
  139.             if(HasShield[playerid] == 1)
  140.             {
  141.             HasShield[playerid] = 0;
  142.             DestroyObject(ShieldObject[playerid]);
  143.             SendClientMessage(playerid,RED,"Has dejado el escudo.");
  144.             ClearAnimations(playerid);
  145.         }
  146.     }
  147.     return 1;
  148. }
  149.  
  150. forward TAnim(playerid);
  151. public TAnim(playerid)
  152. {
  153.     ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
  154.     return 1;
  155. }
  156. ///---------------------------------------------------------------------------------------------
  157. ///---------------------------------------------------------------------------------------------
  158. ///---------------------------------------------------------------------------------------------
  159. ///---------------------------------------------------------------------------------------------
  160. ///---------------------------------------------------------------------------------------------
  161. public OnPlayerDeath(playerid, killerid, reason)
  162. {
  163.     if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
  164.  
  165.     HasShield[playerid] = 0;///Sistema de escudo CQB
  166.     DestroyObject(ShieldObject[playerid]);//Sistema de escudo CQB
  167.     //Sistema de nombre//-------------------------------------------------------------------------------
  168.     new text[256], Nplayer[MAX_PLAYER_NAME];
  169.     GetPlayerName(playerid, Nplayer, MAX_PLAYER_NAME);
  170.     format(text,sizeof(text),"{%06x}%s{FFFFFF}[%d]\n%s\n%s", GetPlayerColor(playerid) >>> 8, Nplayer, playerid);
  171.     Update3DTextLabelText(playertarget[playerid], 0xFFFFFFFF, text);
  172.     //--------------
  173.     return true;
  174. }
  175. public OnPlayerText(playerid, text[])
  176. {
  177.             new string[256];
  178.             format(string, sizeof(string), "[Equipo: %s] {FFFFFF}%s[ID: %d]: %s",GName[PGang[playerid]], PlayerName(playerid), playerid, text);
  179.             printf("%s", string);
  180.             if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { ApplyAnimation(playerid, "PED", "IDLE_CHAT", 4.1, 0, 1, 1, 0, 1000, 1);}
  181.             for(new i; i<MAX_PLAYERS; i++)
  182.             {
  183.  
  184.                 if(PGang[i] == PGang[playerid])
  185.                 {
  186.                 SendClientMessage(i, GetPlayerColor(playerid), string);
  187.                 }
  188.             }
  189.             return 0;
  190. }
  191. //-----------------------------------------------------------------------------------------------------------
  192. //-----------------------------------------------------------------------------------------------------------
  193. //-----------------------------------------------------------------------------------------------------------
  194. //-----------------------------------------------------------------------------------------------------------
  195. //Comandos
  196. //----------------------------------------------------------------
  197. COMMAND:clancmds(playerid, params[])
  198. {
  199. new Str[2024];
  200. strcat(Str,"{FF0000}» /invitar {00BFFF} Esta funcion es para invitar a un jugador a tú equipo!\n");
  201. strcat(Str,"{FF0000}» /clanskins {00BFFF} Cambia la skins dependiendo del rango que tenga el usuario!\n");
  202. strcat(Str,"{FF0000}» /darrango {00BFFF}Con esta funcion se le puede dar rango a un miembro del equipo!\n");
  203. strcat(Str,"{FF0000}» /expulsar {00BFFF}Con esta funcion kickeas a un miembro del equipo!\n");
  204. strcat(Str,"{FF0000}» /salirclan {00BFFF}Con esta funcion abandonas tú equipo !\n");
  205. ShowPlayerDialog( playerid, Dialog_Default, DIALOG_STYLE_MSGBOX, "Comandos para editar tú equipo:", Str, "Aceptar", "");
  206. return 1;
  207. }
  208. COMMAND:creditos(playerid, params[])
  209. {
  210. new Str[2024];
  211. strcat(Str,"{FF0000}» Sistema de clanes creado por Harvey no robes creditos!\n");
  212. ShowPlayerDialog( playerid, Dialog_Default, DIALOG_STYLE_MSGBOX, "Comandos para editar tú equipo:", Str, "Aceptar", "");
  213. return 1;
  214. }
  215. CMD:v(playerid, params[])
  216. {
  217. if(PGang[playerid] != 0 && GangLvl[playerid] >= 1)
  218. {
  219. if(IsPlayerInRangeOfPoint(playerid, 100.0, GSpawnX[ PGang[playerid] ], GSpawnY[ PGang[playerid] ], GSpawnZ[ PGang[playerid] ]))
  220. //or
  221. for(new i; i<MAX_GANGS; i++)
  222. {
  223. if(PGang[playerid] == i && IsPlayerInRangeOfPoint(playerid, 100.0, GSpawnX[i], GSpawnY[i], GSpawnZ[i]))
  224. ShowPlayerDefaultDialog(playerid);
  225. }
  226. else
  227. {
  228. SendClientMessage(playerid, 0xFF0000FF, "No te encuentras en tú base para sacar un vehiculo.");
  229. }
  230. }else return SendClientMessage(playerid, 0xFF0000FF, "Necesitas ser soldado para sacar un vehiculo.!");
  231. return 1;
  232. }
  233. //-----------------------------------------------------
  234. CMD:equipo(playerid, params[])
  235. {
  236.        if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "No eres administrador para usar este comando");
  237.        {
  238.        ShowPlayerDialog(playerid, 1001, DIALOG_STYLE_LIST, "{FF0000}[Equipo]{FFFFFF} - Clan Menu", "\
  239.       Crea un equipo\
  240.       \nEdita tú equipo\
  241.       \nEnviar invitación - Clan\
  242.       \nAbandonar Clan\
  243.       ", "Aceptar", "Cancelar");
  244.        }
  245.        return 1;
  246. }
  247.  
  248. CMD:invitar(playerid, params[])
  249. {
  250. if(PGang[playerid] != 0 && GangLvl[playerid] >= 4)
  251. {
  252. ShowPlayerDialog(playerid, 3001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Invite", "Agrega una id para enviar la invitación:", "Aceptar", "Cancelar");
  253. }else return SendClientMessage(playerid, 0xFF0000FF, "No perteneces a ningun equipo, Para invitar a un jugador es necesario tener rango nivel 4.");
  254. return 1;
  255. }
  256. CMD:clanskins(playerid, params[])
  257. {
  258. if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
  259. {
  260. ShowPlayerDialog(playerid, 8001, DIALOG_STYLE_LIST, "{FF0000}[Equipo]{FFFFFF} - Uniformes del equipo", "Uniforme (Soldado) Nivel 1\nUniforme (Cabo) Nivel 2\nUniforme (Sargento) Nivel 3\nUniforme (Teniente) Nivel 4\nUniforme (Capitán) Nivel 5\nUniforme (Mayor General) Nivel 6", "Aceptar", "Cancelar");
  261. }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el skin de tú equipo necesitas ser nivel 6 .");
  262. return 1;
  263. }
  264. CMD:darrango(playerid, params[])
  265. {
  266. if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
  267. {
  268. ShowPlayerDialog(playerid, 9001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Dar rango", "Coloca la id del jugador:", "Aceptar", "Cancelar");
  269. }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el rango necesitas tener nivel 6.");
  270. return 1;
  271. }
  272. CMD:expulsar(playerid, params[])
  273. {
  274. if(PGang[playerid] != 0 && GangLvl[playerid] >= 5)
  275. {
  276. ShowPlayerDialog(playerid, 4001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Expulsar miembro", "Coloca la id del jugador para expulsar:", "Aceptar", "Cancelar");
  277. }else return SendClientMessage(playerid, 0xFF0000FF, "Para expulsar a un jugador es necesario tener rango nivel 5.");
  278. return 1;
  279. }
  280. CMD:salirclan(playerid, params[])
  281. {
  282. if(PGang[playerid] > 0)
  283. {
  284. ShowPlayerDialog(playerid, 6001, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - salir clan", "Estás seguro de salir de tú equipo?", "Si", "No");
  285. }else return SendClientMessage(playerid, 0xFF0000FF, "Abandonaste tú equipo.!");
  286. return 1;
  287. }
  288.  
  289. CMD:shield(playerid, params[])
  290. {
  291.     if(PGang[playerid] != 0 && GangLvl[playerid] >= 1)
  292.     {
  293.         switch(HasShield[playerid])
  294.         {
  295.             case 0://False (They didn't have a Shield before using CMD:shield)
  296.             {
  297.                 DestroyObject(ShieldObject[playerid]);
  298.                 ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
  299.                 ShieldObject[playerid] = CreateObject(1533,2470.573,-1660.366,14.271,0.0,0.0,-90.000); //
  300.                 AttachObjectToPlayer(ShieldObject[playerid],playerid,-0.8,0.5,-1.65,0.0,0,0.0);
  301.                 ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
  302.                 SetTimerEx("TAnim", 500, 0, "i", playerid);
  303.                 HasShield[playerid] = 1;
  304.                 SendClientMessage(playerid,RED,"You are now using a Shield.");
  305.                 return 1;
  306.             }
  307.             case 1://True (They had a Shield before using CMD:shield)
  308.             {
  309.                 DestroyObject(ShieldObject[playerid]);
  310.                 ClearAnimations(playerid);
  311.                 HasShield[playerid] = 0;
  312.                 SendClientMessage(playerid,RED,"You no longer are using a Shield.");
  313.                 return 1;
  314.             }
  315.         }
  316.     }
  317.     else
  318.     {
  319.         SendClientMessage(playerid, 0xFF0000FF, "You need to be a Team Member to use a Shield.");
  320.         return 1;
  321.     }
  322.     return 1;
  323. }
  324. //-----------------------------------------------------------------------------------------------------------
  325. //-----------------------------------------------------------------------------------------------------------
  326. //-----------------------------------------------------------------------------------------------------------
  327. //-----------------------------------------------------------------------------------------------------------
  328. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  329. {
  330.     new string[256];
  331.     if(dialogid == 1001)
  332.     {
  333.         if(response)
  334.         {
  335.             switch(listitem)
  336.             {
  337.                 case 0:
  338.                 {
  339.                     if(PGang[playerid] == 0 && GetPlayerScore(playerid) >= 0 )
  340.                     {
  341.                         ShowPlayerDialog(playerid, 2001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", "Ingrese el título en la barra:", "Aceptar", "Cancelar");
  342.                     }else return SendClientMessage(playerid, 0xFF0000FF, "Para poder crear tú equipo es necesario tener la cuenta rcon");
  343.                 }
  344.                 case 1:
  345.                 {
  346.                     if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
  347.                     {
  348.                         ShowPlayerDialog(playerid, 1005, DIALOG_STYLE_LIST, "{FF0000}[Equipo]{FFFFFF} - Gang Menu", "Editar id de skin por rango\nColoca el spawn para tú equipo\nAsignar rango\nKick miembro equipo\nCambiar color de equipo\nCambia el nombre de tú equipo\nEliminar clan", "Aceptar", "Cancelar");
  349.                     }else return SendClientMessage(playerid, 0xFF0000FF, "No perteneces a ningun equipo.");
  350.                 }
  351.                 case 2:
  352.                 {
  353.                     if(PGang[playerid] != 0 && GangLvl[playerid] >= 4)
  354.                     {
  355.                         ShowPlayerDialog(playerid, 3001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Invite", "Agrega una id para enviar la invitación:", "Aceptar", "Cancelar");
  356.                     }else return SendClientMessage(playerid, 0xFF0000FF, "No perteneces a ningun equipo, Para invitar a un jugador es necesario tener rango nivel 4.");
  357.                 }
  358.                 case 3:
  359.                 {
  360.                     if(PGang[playerid] > 0)
  361.                     {
  362.                         ShowPlayerDialog(playerid, 6001, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - Gang Exit", "Estás seguro de salir de tú equipo?", "Si", "No");
  363.                     }else return SendClientMessage(playerid, 0xFF0000FF, "Abandonaste tú equipo!");
  364.                 }
  365.             }
  366.         }
  367.     }
  368.     else if(dialogid == 1005)
  369.     {
  370.         if(response)
  371.         {
  372.         switch(listitem)
  373.             {
  374.                 case 0:
  375.                 {
  376.                     if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
  377.                     {
  378.                         ShowPlayerDialog(playerid, 8001, DIALOG_STYLE_LIST, "{FF0000}[Equipo]{FFFFFF} - Equipo Skin", "Nivel 1\nNivel 2\nNivel 3\nNivel 4\nNivel 5\nNivel 6", "Aceptar", "Cancelar");
  379.                     }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el skin de tú equipo necesitas ser nivel 6 .");
  380.                 }
  381.                 case 1:
  382.                 {
  383.                     if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
  384.                     {
  385.                         ShowPlayerDialog(playerid, 7001, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - Equipo Spawn", "(Acepta) - para colocar tú nueva posición spawn?", "Aceptar", "Cancelar");
  386.                     }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el spawn del equipo necesitas ser nivel 6.");
  387.                 }
  388.                 case 2:
  389.                 {
  390.                     if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
  391.                     {
  392.                         ShowPlayerDialog(playerid, 9001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Equipo Rango", "Coloca la id del jugador:", "Aceptar", "Cancelar");
  393.                     }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el rango necesitas tener nivel 6.");
  394.                 }
  395.                 case 3:
  396.                 {
  397.                     if(PGang[playerid] != 0 && GangLvl[playerid] >= 5)
  398.                     {
  399.                         ShowPlayerDialog(playerid, 4001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Equipo Kick", "Coloca la id del jugador para kickearlo:", "Aceptar", "Cancelar");
  400.                     }else return SendClientMessage(playerid, 0xFF0000FF, "Para kickear a un jugador es necesario tener rango nivel 5.");
  401.                 }
  402.                 case 4:
  403.                 {
  404.                     if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
  405.                     {
  406.                         ShowPlayerDialog(playerid, 5001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Color de equipo", "Son 6 digitos para asignar un color a su equipo RRGGBB:", "Aceptar", "Cancelar");
  407.                     }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el color de tu equipo necesitas terne nivel 6");
  408.                 }
  409.                 case 5:
  410.                 {
  411.                     if(PGang[playerid] != 0 && GetPlayerMoney(playerid) >= 5 && GangLvl[playerid] == 6)
  412.                     {
  413.                         ShowPlayerDialog(playerid, 10010, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} Cambio de nombre", "Coloca tú nuevo nombre\naquí abajo:", "Aceptar", "Cancelar");
  414.                     }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el nombre de tú equipo necesitas esta cantidad de dinero 5$");
  415.                 }
  416.                 case 6:
  417.                 {
  418.                     if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
  419.                     {
  420.                         ShowPlayerDialog(playerid, 7041, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - Gang Delete", "Estás seguro de eliminar tú equipo?", "Sí", "No");
  421.                     }else return SendClientMessage(playerid, 0xFF0000FF, "Para eliminar tu equipo necesitas tener nivel 6.");
  422.                 }
  423.             }
  424.         }
  425.     }
  426.     else if(dialogid == 2001)
  427.     {
  428.         if(response)
  429.         {
  430.             if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", "Ingrese un nombre:", "Aceptar", "Cancelar");
  431.             format(GangName[playerid], 256, inputtext);
  432.             ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", "Ingrese un color para su equipo:", "Aceptar", "Cancelar");
  433.         }
  434.     }
  435.     else if(dialogid == 2002)
  436.     {
  437.         if(response)
  438.         {
  439.             if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", "Ingrese un color para su equipo:", "Aceptar", "Cancelar");
  440.             if(strlen(inputtext) != 6)
  441.             {
  442.                 SendClientMessage(playerid, 0xFF0000, "Son 6 digitos para asignar un color a su equipo RRGGBB!");
  443.                 return ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", "Ingrese un color para su equipo:", "Aceptar", "Cancelar");
  444.             }
  445.             new f[256],year,month,day,lolo[128]; getdate(year, month, day);
  446.             format(f, 256, "Gangs/%i.ini",GetFreeGang());
  447.             new cfile = ini_createFile(f);
  448.             if(cfile == INI_OK)
  449.             {
  450.                 GangLvl[playerid] = 6;
  451.                 PGang[playerid] = GetFreeGang();
  452.                 format(GName[PGang[playerid]], 256, GangName[playerid]);
  453.                 format(GColor[PGang[playerid]], 10, "%s00", inputtext);
  454.                 format(lolo, sizeof(lolo),"%d/%d/%d",day, month, year);
  455.                 new hex[MAX_PLAYERS];
  456.                 hex[playerid] = HexToInt(GColor[PGang[playerid]]);
  457.                 SetPlayerColor(playerid, hex[playerid]);
  458.                 Gang[GetFreeGang()] = 1;
  459.                 //GivePlayerMoney(playerid, -1000000);
  460.                 format(string, sizeof(string), "{FFFF00}La primera etapa de construcción!\r\n{FFFF00}Su equipo es: %s\r\n{FFFF00}Color asignado: {%s}%s\r\n{FFFF00}Fecha de creación: {FFFFFF}%s", GName[PGang[playerid]], inputtext,GColor[PGang[playerid]],lolo);
  461.                 ShowPlayerDialog(playerid, 1002, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", string, "Aceptar", "Cancelar");
  462.                 ini_setString(cfile, "Gang name", GName[PGang[playerid]]);
  463.                 ini_setString(cfile, "Gang color", GColor[PGang[playerid]]);
  464.                 ini_setString(cfile, "founded", lolo);
  465.                 ini_setFloat(cfile, "SpawnX", 0.0);
  466.                 ini_setFloat(cfile, "SpawnY", 0.0);
  467.                 ini_setFloat(cfile, "SpawnZ", 0.0);
  468.                 ini_setInteger(cfile, "Skin1", 0);
  469.                 ini_setInteger(cfile, "Skin2", 0);
  470.                 ini_setInteger(cfile, "Skin2", 0);
  471.                 ini_setInteger(cfile, "Skin3", 0);
  472.                 ini_setInteger(cfile, "Skin4", 0);
  473.                 ini_setInteger(cfile, "Skin5", 0);
  474.                 ini_setInteger(cfile, "Skin6", 0);
  475.                 ini_closeFile(cfile);
  476.             }
  477.         }
  478.     }
  479.     else if(dialogid == 3001)
  480.     {
  481.         if(response)
  482.         {
  483.             if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 3001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Invite", "Ingrese la identificación del jugador, que desea agregar:", "Aceptar", "Cancelar");
  484.             if(IsPlayerConnected(strval(inputtext)))
  485.             {
  486.                 if(PGang[strval(inputtext)] == 0)
  487.                 {
  488.                     format(string, sizeof(string), "%s te invito a unirte al clan '%s'", PlayerName(playerid), GName[PGang[playerid]]);
  489.                     ShowPlayerDialog(strval(inputtext), 3002, DIALOG_STYLE_MSGBOX, "Te acaban de invitar a unirte a un equipo", string, "Aceptar", "Cancelar");
  490.                     format(string, sizeof(string), "'%s' enviaste una invitación de equipo", PlayerName(playerid), PlayerName(id[playerid]));
  491.                     for(new i; i<MAX_PLAYERS; i++)
  492.                     {
  493.                         if(PGang[i] == PGang[playerid])
  494.                         {
  495.                            
  496.                             SendClientMessage(i, 0xFF0000FF, string);
  497.                         }
  498.                     }
  499.                     tgang[strval(inputtext)] = PGang[playerid];
  500.                 }else return SendClientMessage(playerid, 0xFFFFFFFF, "Enviaste invitacion!");
  501.             }else return SendClientMessage(playerid, 0xFFFFFFFF, "Este jugador no esta conectado!");
  502.         }
  503.     }
  504.     else if(dialogid == 3002)
  505.     {
  506.         if(response)
  507.         {
  508.             PGang[playerid] = tgang[playerid];
  509.             GangLvl[playerid] = 1;
  510.             new hex[MAX_PLAYERS];
  511.             hex[playerid] = HexToInt(GColor[PGang[playerid]]);
  512.             SetPlayerColor(playerid, hex[playerid]);
  513.             format(string, sizeof(string), "Te acabas de unir al equipo '%s'", GName[PGang[playerid]]);
  514.             SendClientMessage(playerid, 0xFFFFFFFF, string);
  515.             format(string, sizeof(string), "%s bienvenido a tú nuevo equipo!", PlayerName(playerid));
  516.             for(new i; i<MAX_PLAYERS; i++)
  517.             {
  518.                 if(PGang[i] == PGang[playerid])
  519.                 {
  520.                     SendClientMessage(i, 0xFFFF00FF, string);
  521.                 }
  522.             }
  523.         }
  524.         else
  525.         {
  526.             tgang[playerid] = 0;
  527.         }
  528.     }
  529.     else if(dialogid == 4001)
  530.     {
  531.         if(response)
  532.         {
  533.             if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 4001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Kick", "Coloca la id del jugador para kickearlo:", "Aceptar", "Cancelar");
  534.             if(IsPlayerConnected(strval(inputtext)))
  535.             {
  536.                 if(PGang[strval(inputtext)] == PGang[playerid])
  537.                 {
  538.                     PGang[strval(inputtext)] = 0;
  539.                     GangLvl[strval(inputtext)] = 0;
  540.                     format(string, 256, "{FF0000}Has expulsado a este jugador >'{FFFFFF}%s{FF0000}'", PlayerName(playerid));
  541.                     SpawnPlayer(playerid);
  542.                     SendClientMessage(playerid, 0xFF0000FF, string);
  543.                 }else return SendClientMessage(playerid, 0xFFFFFFFF, "Ýòîò èãðîê íå â âàøåé áàíäå!");
  544.             }else return SendClientMessage(playerid, 0xFFFFFFFF, "Jugador no conectado!");
  545.         }
  546.     }
  547.     else if(dialogid == 5001)
  548.     {
  549.         if(response)
  550.         {
  551.             if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 5001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Color de equipo", "Son 6 digitos para asignar un color a su equipo RRGGBB:", "Aceptar", "Cancelar");
  552.             if(strlen(inputtext) != 6)
  553.             {
  554.                 SendClientMessage(playerid, 0xFF0000FF, "Son 6 digitos para asignar un color a su equipo RRGGBB!");
  555.                 return ShowPlayerDialog(playerid, 5001, DIALOG_STYLE_INPUT, "Cambiar color del equipo", "Son 6 digitos para asignar un color a su equipo RRGGBB:", "Aceptar", "Cancelar");
  556.             }
  557.             format(GColor[PGang[playerid]], 10, "%s00", inputtext);
  558.             new hex[MAX_PLAYERS];
  559.             hex[playerid] = HexToInt(GColor[PGang[playerid]]);
  560.             SetPlayerColor(playerid,hex[playerid]);
  561.             format(string, sizeof(string), "Cambiaste el color de tú equipo: {%s}%s", inputtext, GColor[PGang[playerid]]);
  562.             SendClientMessage(playerid, 0xCCFF00FF, string);
  563.             new f[256];
  564.             format(f, 256, "Gangs/%i.ini",PGang[playerid]);
  565.             new file = ini_openFile(f);
  566.             if(file == INI_OK)
  567.             {
  568.                 ini_setString(file, "Gang color", GColor[PGang[playerid]]);
  569.                 ini_closeFile(file);
  570.             }
  571.         }
  572.     }
  573.     else if(dialogid == 6001)
  574.     {
  575.         if(response)
  576.         {
  577.             format(string,sizeof(string), "{FFFF00}'{FFFFFF}%s{FFFF00}'salio del equipo!", PlayerName(playerid));
  578.             SpawnPlayer(playerid);
  579.             SendClientMessage(playerid, 0xFFFF00AA, "Acabas de abandonar tú equipo");
  580.             for(new i; i<MAX_PLAYERS; i++)
  581.             {
  582.                 if(PGang[i] == PGang[playerid] && i != playerid)
  583.                 {
  584.                     SendClientMessage(i, 0xFFFF00FF, string);
  585.                 }
  586.             }
  587.             PGang[playerid] = 0;
  588.             GangLvl[playerid] = 0;
  589.         }
  590.     }
  591.     else if(dialogid == 7001)
  592.     {
  593.         if(response)
  594.         {
  595.             new Float:x, Float:y, Float:z;
  596.             GetPlayerPos(playerid, x, y, z);
  597.             GSpawnX[PGang[playerid]] = x;
  598.             GSpawnY[PGang[playerid]] = y;
  599.             GSpawnZ[PGang[playerid]] = z;
  600.             // Later..
  601.             new f[256];
  602.             format(f, 256, "Gangs/%i.ini",PGang[playerid]);
  603.             new file = ini_openFile(f);
  604.             if(file == INI_OK)
  605.             {
  606.                 ini_setFloat(file, "SpawnX", x);
  607.                 ini_setFloat(file, "SpawnY", y);
  608.                 ini_setFloat(file, "SpawnZ", z);
  609.                 ini_closeFile(file);
  610.  
  611.             }
  612.         }
  613.     }
  614.     else if(dialogid == 8001)
  615.     {
  616.         if(response)
  617.         {
  618.             switch(listitem)
  619.             {
  620.                 case 0: gangskin[playerid] = 1;
  621.                 case 1: gangskin[playerid] = 2;
  622.                 case 2: gangskin[playerid] = 3;
  623.                 case 3: gangskin[playerid] = 4;
  624.                 case 4: gangskin[playerid] = 5;
  625.                 case 5: gangskin[playerid] = 6;
  626.             }
  627.             ShowPlayerDialog(playerid, 8002, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Skin", "Ingrese una ID para su skin:", "Aceptar", "Cancelar");
  628.         }
  629.     }
  630.     else if(dialogid == 8002)
  631.     {
  632.         if(response)
  633.         {
  634.             if(!strlen(inputtext) && strval(inputtext) > 0) return ShowPlayerDialog(playerid, 8002, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Skin", "Ingrese una buena ID:", "Aceptar", "Cancelar");
  635.             new f[256];
  636.             format(f, 256, "Gangs/%i.ini",PGang[playerid]);
  637.             new file = ini_openFile(f);
  638.             if(file == INI_OK)
  639.             {
  640.                 format(string, 256, "Skin%i", gangskin[playerid]);
  641.                 ini_setInteger(file, string, strval(inputtext));
  642.                 ini_closeFile(file);
  643.                 format(string, sizeof(string), "Cambiaste la ID del skin! por: %i", strval(inputtext));
  644.                 SendClientMessage(playerid, 0xFFFF00FF, string);
  645.                 GSkin[PGang[playerid]][gangskin[playerid]-1] = strval(inputtext);
  646.                 for(new i; i<MAX_PLAYERS; i++)
  647.                 {
  648.                     if(PGang[i] == PGang[playerid] && GangLvl[i] == gangskin[playerid])
  649.                     {
  650.                         SetPlayerSkin(i, strval(inputtext));
  651.                     }
  652.                 }
  653.                 gangskin[playerid] = 0;
  654.             }
  655.         }
  656.     }
  657.     else if(dialogid == 9001)
  658.     {
  659.         if(response)
  660.         {
  661.             if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 9001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Equipo Rango", "Coloca la id del jugador:", "Aceptar", "Cancelar");
  662.             if(PGang[strval(inputtext)] != PGang[playerid])
  663.             {
  664.                 SendClientMessage(playerid, 0xFFFF00FF, "Id erronea, verifique bien la id!");
  665.                 return ShowPlayerDialog(playerid, 9001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Equipo Rango", "Ingrese la identificación de la etiqueta, que desea encontrar:", "Aceptar", "Cancelar");
  666.             }
  667.             id[playerid] = strval(inputtext);
  668.             ShowPlayerDialog(playerid, 9002, DIALOG_STYLE_LIST, "{FF0000}[Equipo]{FFFFFF} - Uniformes del equipo", "(Soldado) Nivel 1\n(Cabo) Nivel 2\n(Sargento) Nivel 3\n(Teniente) Nivel 4\n(Capitán) Nivel 5\n(Mayor General) Nivel 6", "Aceptar", "Cancelar");
  669.         }
  670.     }
  671.     else if(dialogid == 9002)
  672.     {
  673.         if(response)
  674.         {
  675.             switch(listitem)
  676.             {
  677.                 case 0: GangLvl[id[playerid]] = 1;
  678.                 case 1: GangLvl[id[playerid]] = 2;
  679.                 case 2: GangLvl[id[playerid]] = 3;
  680.                 case 3: GangLvl[id[playerid]] = 4;
  681.                 case 4: GangLvl[id[playerid]] = 5;
  682.                 case 5: GangLvl[id[playerid]] = 6;
  683.             }
  684.             format(string, sizeof(string), "Este era tú rango anterior 0", PlayerName(id[playerid]), GangLvl[id[playerid]]);
  685.             SendClientMessage(playerid, 0xFFFF00FF, string);
  686.             format(string, sizeof(string), "Este es el actual rango %s <id> %i", PlayerName(playerid), GangLvl[id[playerid]]);
  687.             SendClientMessage(id[playerid], 0xFFFF00FF, string);
  688.             if(GSkin[PGang[playerid]][GangLvl[id[playerid]]] > 0) SetPlayerSkin(id[playerid], GSkin[PGang[playerid]][GangLvl[id[playerid]]-1]);
  689.             id[playerid] = -1;
  690.         }
  691.     }
  692.     else if(dialogid == 10010)
  693.     {
  694.         if(response)
  695.         {
  696.             if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 10010, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Cambio de nombre ", "Coloca el nuevo nombre del equipo\naqui abajo:", "Aceptar", "Cancelar");
  697.             format(GName[PGang[playerid]], 256, "%s", inputtext);
  698.             format(string, sizeof(string), "\n{FFFF00}Has cambiado el nombre del equipo ahora es: {FF0000}%s\n",inputtext);
  699.             ShowPlayerDialog(playerid, 10011, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - Clan de nombre de Equipo", string, "Ok", "");
  700.             new f[256];
  701.             format(f, 256, "Gangs/%i.ini",PGang[playerid]);
  702.             new file = ini_openFile(f);
  703.             if(file == INI_OK)
  704.             {
  705.                 ini_setString(file, "Gang name", GName[PGang[playerid]]);
  706.                 ini_closeFile(file);
  707.             }
  708.         }
  709.     }
  710.     else if(dialogid == 7041)
  711.     {
  712.         if(response)
  713.         {
  714.             new f[256];
  715.             format(f, 256, "Gangs/%i.ini",PGang[playerid]);
  716.             fremove(f);
  717.             PGang[playerid] = 0;
  718.             GangLvl[playerid] = 0;
  719.             SendClientMessage(playerid, 0xFFFF00FF, "Eliminaste tú equipo!");
  720.         }
  721.     }
  722.  
  723.     //----------------------------------------------------------------------------
  724.     if ( response )
  725.     {
  726.     switch ( dialogid )
  727.         {
  728.             case 10 :
  729.             {
  730.                 switch ( listitem )
  731.                 {
  732.                     case 0 : ShowPlayerDialog( playerid, 11, DIALOG_STYLE_LIST, "Aviones", "Andromada\nBeagle\nCropduster\nDodo\nNevada\nRustler\nShamal\nStuntplane\nAtras", "Aceptar", "Cancelar" );
  733.                     case 1 : ShowPlayerDialog( playerid, 12, DIALOG_STYLE_LIST, "Helicopteros", "Cargobob\nLeviathan\nMaverick\nMaverick SATV\nMaverick De Policia\nRaindance\nSparrow\nAtras", "Aceptar", "Cancelar" );
  734.                     case 2 : ShowPlayerDialog( playerid, 13, DIALOG_STYLE_LIST, "Moto o cuatriciclo", "Quad\nSanchez\nMoto Policia\nAtras", "Aceptar", "Cancelar" );
  735.                     case 3 : ShowPlayerDialog( playerid, 14, DIALOG_STYLE_LIST, "Todoterreno", "Patriot\nRancher A\nRancher B\nSandking\nAtras", "Aceptar", "Cancelar" );
  736.                     case 4 : ShowPlayerDialog( playerid, 15, DIALOG_STYLE_LIST, "Servicio Publico", "Ambulancia\nBarracks\nBus\nCoach\nEnforcer\nFBI Rancher\nFBI Truck\nFiretruck\nFiretruck LA\nPatrulla (LSPD)\nPatrulla (LVPD)\nPatrulla (SFPD)\nRanger\nRhino\nS.W.A.T\nAtras", "Aceptar", "Cancelar" );
  737.                     case 5 : ShowPlayerDialog( playerid, 16, DIALOG_STYLE_LIST, "Barcos", "Guardia Costera\nDinghy\nJetmax\nLaunch\nMarquis\nPredator\nReefer\nSpeeder\nSqualo\nTropic\nAtras", "Aceptar", "Cancelar" );
  738.  
  739.  
  740.                 }
  741.             }
  742.             case 11 :
  743.             {
  744.                 if ( listitem > 10 ) return ShowPlayerDefaultDialog( playerid );
  745.  
  746.                 new
  747.                         modelo[] = { 592, 511, 512, 593, 553, 476, 519, 513 };
  748.  
  749.  
  750.                 return VehicleSpawner( playerid, modelo[ listitem ] );
  751.             }
  752.             case 12 :
  753.             {
  754.                 if ( listitem > 6 ) return ShowPlayerDefaultDialog( playerid );
  755.  
  756.                 new
  757.                     modelo[] = { 548, 417, 487, 488, 497, 563, 469 };
  758.  
  759.                 return VehicleSpawner( playerid, modelo[ listitem ] );
  760.             }
  761.             case 13 :
  762.             {
  763.                 if ( listitem > 2 ) return ShowPlayerDefaultDialog( playerid );
  764.  
  765.                 new
  766.                     modelo[] = { 471, 468, 523};
  767.  
  768.                 return VehicleSpawner( playerid, modelo[ listitem ] );
  769.  
  770.             }
  771.  
  772.             case 14 :
  773.             {
  774.                 if ( listitem > 3 ) return ShowPlayerDefaultDialog( playerid );
  775.  
  776.                 new
  777.                     modelo[] = {  470, 489, 505, 495 };
  778.  
  779.                 return VehicleSpawner( playerid, modelo[ listitem ] );
  780.             }
  781.             case 15 :
  782.             {
  783.                 if ( listitem > 14 ) return ShowPlayerDefaultDialog( playerid );
  784.  
  785.                 new
  786.                     modelo[] = { 416, 433, 431, 437, 427, 490, 528, 407, 544, 596, 598, 597, 599, 432, 601};
  787.  
  788.                 return VehicleSpawner( playerid, modelo[ listitem ] );
  789.             }
  790.  
  791.  
  792.  
  793.             case 16 :
  794.             {
  795.                 if ( listitem > 9 ) return ShowPlayerDefaultDialog( playerid );
  796.  
  797.                 new
  798.                     modelo[] = { 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 };
  799.  
  800.                 return VehicleSpawner( playerid, modelo[ listitem ] );
  801.  
  802.  
  803.             }
  804.         }
  805.     }
  806.     return 0;
  807. }
  808.  
  809.  
  810. GetFreeGang()
  811. {
  812.     for(new i=1; i<MAX_GANGS; i++)
  813.     {
  814.         if(Gang[i] == 0) return i;
  815.     }
  816.     return false;
  817. }
  818.  
  819. forward LoadAccount(playerid);
  820. public LoadAccount(playerid)
  821. {
  822.     new f[256], hex[MAX_PLAYERS];
  823.     format(f, 256, "Gangs/Players/%s.ini", PlayerName(playerid));
  824.     new file = ini_openFile(f);
  825.     if(file == INI_OK)
  826.     {
  827.         ini_getInteger(file, "Gang", PGang[playerid]);
  828.         ini_getInteger(file, "GangLvl", GangLvl[playerid]);
  829.         if(PGang[playerid] > 0)
  830.         {
  831.             hex[playerid] = HexToInt(GColor[PGang[playerid]]);
  832.             SetPlayerColor(playerid, hex[playerid]);
  833.         }
  834.         ini_closeFile(file);
  835.         return true;
  836.     }
  837.     else
  838.     {
  839.         ini_closeFile(file);
  840.         file = ini_createFile(f);
  841.         ini_setInteger(file, "Gang", 0);
  842.         ini_setInteger(file, "GangLvl", 0);
  843.         ini_closeFile(file);
  844.         return true;
  845.     }
  846. }
  847.  
  848. forward SaveAccount(playerid);
  849. public SaveAccount(playerid)
  850. {
  851.     new f[256];
  852.     format(f, 256, "Gangs/Players/%s.ini", PlayerName(playerid));
  853.     new file = ini_openFile(f);
  854.     if(file == INI_OK)
  855.     {
  856.         ini_setInteger(file, "Gang", PGang[playerid]);
  857.         ini_setInteger(file, "GangLvl", GangLvl[playerid]);
  858.         ini_closeFile(file);
  859.     }
  860.     return true;
  861. }
  862. public OnPlayerConnect(playerid)
  863. {
  864. playertarget[playerid] = Create3DTextLabel(" ", 0xFFFFFFFF, 10.0, 40.0, 50.0, 10.0, 0, 1);//Sistema de nombre//
  865. Attach3DTextLabelToPlayer(playertarget[playerid], playerid, 0.0, 0.0, 0.0);//Sistema de nombre//
  866. AccInfo[playerid][pVehicle]         = -1;
  867. new file, f[256];
  868. for(new i; i<MAX_GANGS; i++)
  869. {
  870. format(f, 256, "Gangs/%i.ini",i);
  871. file = ini_openFile(f);
  872. if(file == INI_OK)
  873. {
  874. ini_getString(file, "Gang name", inigangname[i]);
  875. format(GName[i], 256, inigangname[i]);
  876. ini_getString(file, "Gang color", col[i]);
  877. format(GColor[i], 10, col[i]);
  878. ini_getFloat(file, "SpawnX", GSpawnX[i]);
  879. ini_getFloat(file, "SpawnY", GSpawnY[i]);
  880. ini_getFloat(file, "SpawnZ", GSpawnZ[i]);
  881. ini_getInteger(file, "Skin1", GSkin[i][0]);
  882. ini_getInteger(file, "Skin2", GSkin[i][1]);
  883. ini_getInteger(file, "Skin3", GSkin[i][2]);
  884. ini_getInteger(file, "Skin4", GSkin[i][3]);
  885. ini_getInteger(file, "Skin5", GSkin[i][4]);
  886. ini_getInteger(file, "Skin6", GSkin[i][5]);
  887. CreatePickup(1314, 1, GSpawnX[i],GSpawnY[i],GSpawnZ[i], -1);
  888. Gang[i] = 1;
  889. ini_closeFile(file);
  890. }
  891. }
  892. return 1;
  893. }
  894.  
  895. forward GangLoad();
  896. public GangLoad()
  897. {
  898.     new file, f[256];
  899.     for(new i; i<MAX_GANGS; i++)
  900.     {
  901.         format(f, 256, "Gangs/%i.ini",i);
  902.         file = ini_openFile(f);
  903.         if(file == INI_OK)
  904.         {
  905.             ini_getString(file, "Gang name", inigangname[i]);
  906.             format(GName[i], 256, inigangname[i]);
  907.             ini_getString(file, "Gang color", col[i]);
  908.             format(GColor[i], 10, col[i]);
  909.             ini_getFloat(file, "SpawnX", GSpawnX[i]);
  910.             ini_getFloat(file, "SpawnY", GSpawnY[i]);
  911.             ini_getFloat(file, "SpawnZ", GSpawnZ[i]);
  912.             ini_getInteger(file, "Skin1", GSkin[i][0]);
  913.             ini_getInteger(file, "Skin2", GSkin[i][1]);
  914.             ini_getInteger(file, "Skin3", GSkin[i][2]);
  915.             ini_getInteger(file, "Skin4", GSkin[i][3]);
  916.             ini_getInteger(file, "Skin5", GSkin[i][4]);
  917.             ini_getInteger(file, "Skin6", GSkin[i][5]);
  918.             Gang[i] = 1;
  919.             ini_closeFile(file);
  920.         }
  921.     }
  922.     return false;
  923. }
  924.  
  925. forward Spawn(playerid);
  926. public Spawn(playerid)
  927. {
  928.     if(GSkin[PGang[playerid]][GangLvl[playerid]-1] > 0)
  929.     {
  930.         SetPlayerSkin(playerid, GSkin[PGang[playerid]][GangLvl[playerid]-1]);
  931.     }
  932.     if(GSpawnX[PGang[playerid]] != 0.0 && GSpawnY[PGang[playerid]] != 0.0 && GSpawnZ[PGang[playerid]] != 0.0)
  933.     {
  934.         SetPlayerPos(playerid, GSpawnX[PGang[playerid]], GSpawnY[PGang[playerid]], GSpawnZ[PGang[playerid]]);
  935.     }
  936.     new hex[MAX_PLAYERS];
  937.     hex[playerid] = HexToInt(GColor[PGang[playerid]]);
  938.     SetPlayerColor(playerid, hex[playerid]);
  939.    
  940. }
  941.  
  942. PlayerName(playerid)
  943. {
  944.     new pname[MAX_PLAYER_NAME];
  945.     GetPlayerName(playerid,pname,sizeof(pname));
  946.     return pname;
  947. }
  948.  
  949. HexToInt(string[])
  950. {
  951.     if (string[0]==0) return 0;
  952.     new i, cur=1,res=0;
  953.     for (i=strlen(string);i>0;i--)
  954.     {
  955.         if (string[i-1]<58){res=res+cur*(string[i-1]-48);}
  956.         else res=res+cur*(string[i-1]-65+10);
  957.         cur=cur*16;
  958.     }
  959.     return res;
  960. }
  961.  
  962. //=============================================NUEVA FUNCION===============================================
  963. public VehicleSpawner(playerid,model)
  964. {
  965.     if(IsPlayerInAnyVehicle(playerid))
  966.     SendClientMessage(playerid, RED, "ERROR: Ya Estas En Un Auto!");
  967.     else
  968.     {
  969.         new Float:x, Float:y, Float:z, Float:angle;
  970.         GetPlayerPos(playerid, x, y, z);
  971.         GetPlayerFacingAngle(playerid, angle);
  972.  
  973.         if(AccInfo[playerid][pVehicle] != -1)
  974.         DeleteVehicle(AccInfo[playerid][pVehicle]);
  975.         new vehicleid=CreateVehicle(model, x, y, z+2, angle, -1, -1, -1);
  976.         PutPlayerInVehicle(playerid, vehicleid, 0);
  977.         SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
  978.         LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
  979.         AccInfo[playerid][pVehicle] = vehicleid;
  980.     }
  981.     return 1;
  982. }
  983.  
  984.  
  985. public DeleteVehicle(vehicleid)
  986. {
  987.     for(new i=0;i<MAX_PLAYERS;i++)
  988.     {
  989.         new Float:X,Float:Y,Float:Z;
  990.         if(IsPlayerInVehicle(i, vehicleid))
  991.         {
  992.             RemovePlayerFromVehicle(i);
  993.             GetPlayerPos(i,X,Y,Z);
  994.             SetPlayerPos(i,X,Y+3,Z);
  995.         }
  996.         SetVehicleParamsForPlayer(vehicleid,i,0,1);
  997.     }
  998.     SetTimerEx("RespawnVehicle",1500,0,"i",vehicleid);
  999. }
  1000.  
  1001. public RespawnVehicle(vehicleid)
  1002. {
  1003.     DestroyVehicle(vehicleid);
  1004. }
  1005.  
  1006. public OnVehicleSpawn(vehicleid)
  1007. {
  1008.     for(new i=0;i<MAX_PLAYERS;i++)
  1009.     {
  1010.         if(vehicleid==AccInfo[i][pVehicle])
  1011.         {
  1012.             DeleteVehicle(vehicleid);
  1013.             AccInfo[i][pVehicle]=-1;
  1014.         }
  1015.     }
  1016.     return 1;
  1017. }
  1018. //Sistema de nombre//
  1019. public OnPlayerUpdate(playerid)
  1020. {
  1021. static text[256], Nplayer[MAX_PLAYER_NAME];
  1022. GetPlayerName(playerid, Nplayer, MAX_PLAYER_NAME);
  1023. format(text,sizeof(text),"{%06x}%s {285E91}[%s]{FFFFFF}[%d]\n%s\n%s", GetPlayerColor(playerid) >>> 8, Nplayer, GName[PGang[playerid]],playerid);
  1024. Update3DTextLabelText(playertarget[playerid], 0xFFFFFFFF, text);
  1025. return 1;
  1026. }
Add Comment
Please, Sign In to add comment