Advertisement
Gireada

CreateClan System

Jan 24th, 2013
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 26.96 KB | None | 0 0
  1. /****************************************************************************************************************************************************************************
  2. *****************************************************************************************************************************************************************************
  3. *****************************************************************************************************************************************************************************
  4. ***********************************************************************__________________************************************************************************************
  5. **********************************************************************|    CreateClan    |***********************************************************************************
  6. **********************************************************************|                  |***********************************************************************************
  7. **********************************************************************|      By          |***********************************************************************************
  8. **********************************************************************|        Gireada   |***********************************************************************************
  9. **********************************************************************|                  |***********************************************************************************
  10. **********************************************************************|                  |***********************************************************************************
  11. **********************************************************************|                  |***********************************************************************************
  12. **********************************************************************|                  |***********************************************************************************
  13. **********************************************************************|                  |***********************************************************************************
  14. **********************************************************************---------------------************************************************************************************
  15. */
  16.  
  17. //Nu stergeti Creditele.
  18.  
  19.  
  20. #include <a_samp>
  21. #include <dini>
  22. #include <zcmd>
  23. #include <sscanf>
  24. #include <bdial>
  25.  
  26. #define Creiat_de_Gireada
  27.  
  28. forward SaveClans();
  29. forward LoadClans();
  30. forward SendClanMesaj(color,const string[],clanid);
  31.  
  32. enum PlayerData
  33. {
  34.     pCreateClan,
  35.     pClan,
  36.     pRank,
  37.     pInvitation,
  38.     pInvClan,
  39.     pClanName,
  40.  
  41. }
  42. new PlayerInfo[MAX_PLAYERS][PlayerData];
  43.  
  44. enum ClanData
  45. {
  46.     cID,
  47.     cNume,
  48.     cSkin1,
  49.     cSkin2,
  50.     cColor,
  51.     cArma1,
  52.     cArma2,
  53.     cArma3,
  54.     cArma4,
  55.     cArma5,
  56.     cArma6,
  57.     cArma7,
  58.     cRank,
  59.     cLider,
  60.     Float:cSpawnx,
  61.     Float:cSpawny,
  62.     Float:cSpawnz,
  63.     Float:cAngle,
  64.     cInterior,
  65.     cVirtual,
  66.     cMembri,
  67. }
  68. new ClanInfo[100][ClanData];
  69.  
  70. public OnFilterScriptInit()
  71. {
  72.     LoadClans();
  73.     print("\n--------------------------------------");
  74.     print(" Create Clan by Gireada");
  75.     print("--------------------------------------\n");
  76.     return 1;
  77. }
  78.  
  79. public OnFilterScriptExit()
  80. {
  81.     return 1;
  82. }
  83.  
  84.  
  85. main()
  86. {
  87.     print("\n----------------------------------");
  88.     print(" Create Clan by Gireada");
  89.     print("----------------------------------\n");
  90. }
  91.  
  92. stock pName(playerid)
  93. {
  94.     new name[MAX_PLAYER_NAME];
  95.     GetPlayerName(playerid,name,sizeof(name));
  96.     return name;
  97. }
  98.  
  99. public OnPlayerConnect(playerid)
  100. {
  101.     new file[35], clanname[MAX_PLAYERS];
  102.     format(clanname, sizeof(clanname), "N/a");
  103.     format(file, sizeof(file),"JucatoriClan/%s.ini", pName(playerid));
  104.     if(dini_Exists(file))
  105.     {
  106.         PlayerInfo[playerid][pRank] = dini_Int(file,"Rank");
  107.         PlayerInfo[playerid][pCreateClan] = dini_Int(file,"CreateClan");
  108.         PlayerInfo[playerid][pClan] = dini_Int(file,"Clan");
  109.         strmid(PlayerInfo[playerid][pClanName], dini_Get(file,"ClanNume"), 0, strlen(dini_Get(file,"ClanNume")), 255);
  110.     }
  111.     else if(!dini_Exists(file))
  112.     {
  113.         dini_Create(file);
  114.         dini_IntSet(file,"Rank",PlayerInfo[playerid][pRank] = 0);
  115.         dini_IntSet(file,"CreateClan",PlayerInfo[playerid][pCreateClan] = -1);
  116.         dini_IntSet(file,"Clan",PlayerInfo[playerid][pClan] = -1);
  117.         dini_Set(file,"ClanNume","N/a");
  118.     }
  119.     new clanid = PlayerInfo[playerid][pClan];
  120.     if(ClanInfo[clanid][cNume] != PlayerInfo[playerid][pClanName])
  121.     {
  122.         dini_Set(file,"ClanNume","N/a");
  123.         dini_IntSet(file,"Rank",0);
  124.         dini_IntSet(file,"CreateClan",-1);
  125.         dini_IntSet(file,"Clan",PlayerInfo[playerid][pClan] = -1);
  126.         SendClientMessage(playerid, 0xFF0000AA, "Clanul sa desfintat!");
  127.     }
  128.     SendClientMessage(playerid, 0xFF0000AA, "Sistem de Clan creeat de Gireada! Contact: gireada09");
  129.     SetPlayerColor(playerid, ClanInfo[PlayerInfo[playerid][pClan]][cColor]);
  130.     GivePlayerWeapon(playerid, ClanInfo[PlayerInfo[playerid][pClan]][cArma1], 1);
  131.     GivePlayerWeapon(playerid, ClanInfo[PlayerInfo[playerid][pClan]][cArma2], 9999999);
  132.     GivePlayerWeapon(playerid, ClanInfo[PlayerInfo[playerid][pClan]][cArma3], 9999999);
  133.     GivePlayerWeapon(playerid, ClanInfo[PlayerInfo[playerid][pClan]][cArma4], 9999999);
  134.     GivePlayerWeapon(playerid, ClanInfo[PlayerInfo[playerid][pClan]][cArma5], 9999999);
  135.     GivePlayerWeapon(playerid, ClanInfo[PlayerInfo[playerid][pClan]][cArma6], 9999999);
  136.     GivePlayerWeapon(playerid, ClanInfo[PlayerInfo[playerid][pClan]][cArma7], 9999999);
  137.     return 1;
  138. }
  139.  
  140. public OnPlayerDisconnect(playerid, reason)
  141. {
  142.     return 1;
  143. }
  144.  
  145. public OnPlayerSpawn(playerid)
  146. {
  147.     new clanid = PlayerInfo[playerid][pClan];
  148.     if(PlayerInfo[playerid][pClan] >= 0)
  149.     {
  150.         SetPlayerPos(playerid,ClanInfo[clanid][cSpawnx],ClanInfo[clanid][cSpawny],ClanInfo[clanid][cSpawnz]);
  151.         SetPlayerInterior(playerid, ClanInfo[clanid][cInterior]);
  152.         SetPlayerVirtualWorld(playerid, ClanInfo[clanid][cVirtual]);
  153.     }
  154.     return 1;
  155. }
  156.  
  157. CMD:setrank(playerid, params[])
  158. {
  159.     new giveplayerid,rank,name[35],string[256];
  160.     if(unformat(params, "ui", giveplayerid,rank))
  161.     {
  162.         SendClientMessage(playerid, 0xFF0000AA, "Usage: /setrank <playerid/name> <rank>");
  163.         return 1;
  164.     }
  165.     if(rank < 0 && rank > 6)
  166.     {
  167.         SendClientMessage(playerid, 0xFF0000AA, "Rank-ul pot fi de la 1 la 5");
  168.         return 1;
  169.     }
  170.     new clanid = PlayerInfo[playerid][pClan];
  171.     GetPlayerName(giveplayerid, name, sizeof(name));
  172.     if(PlayerInfo[playerid][pRank] == 6)
  173.     {
  174.         if(PlayerInfo[giveplayerid][pClan] == PlayerInfo[playerid][pClan])
  175.         {
  176.             PlayerInfo[playerid][pRank] = rank;
  177.             format(string, sizeof(string), " %s a primit rank %d", name, rank);
  178.             SendClanMesaj(ClanInfo[clanid][cColor],string,clanid);
  179.         }
  180.     }
  181.     return 1;
  182. }
  183.  
  184. CMD:createclan(playerid, params[])
  185. {
  186.     if(PlayerInfo[playerid][pCreateClan] == -1)
  187.     {
  188.         ShowPlayerDialog(playerid,10, DIALOG_STYLE_INPUT, "Create Clan", "Introdu numele clanului tau:", "Accept", "Cancel");
  189.     }
  190.     else
  191.     {
  192.         SendClientMessage(playerid, 0xFF0000AA, "Ai creeat deja un clan!");
  193.     }
  194.     return 1;
  195. }
  196.  
  197. CMD:invite(playerid, params[])
  198. {
  199.     new giveplayerid, name[25], string[256];
  200.     GetPlayerName(playerid, name, sizeof(name));
  201.     if(unformat(params, "u", giveplayerid))
  202.     {
  203.         SendClientMessage(playerid, 0xFF0000AA, "Usage: /invite <playerid/name>");
  204.         return 1;
  205.     }
  206.     if(giveplayerid == INVALID_PLAYER_ID)
  207.     {
  208.         SendClientMessage(playerid, 0xFF0000AA, "ID jucator invalid");
  209.     }
  210.     if(PlayerInfo[playerid][pRank] >= 5)
  211.     {
  212.         if(PlayerInfo[giveplayerid][pClan] == -1)
  213.         {
  214.             PlayerInfo[giveplayerid][pInvitation] = 1;
  215.             PlayerInfo[giveplayerid][pInvClan] = PlayerInfo[playerid][pClan];
  216.             format(string, sizeof(string), "%s te-a invitat in clanul %s. Scrie /accepta pentru a accepta.",name, ClanInfo[PlayerInfo[playerid][pClan]][cNume]);
  217.             SendClientMessage(giveplayerid, 0xFF0000AA, string);
  218.             SendClientMessage(playerid, 0xFF0000AA, "Scrie /accepta pentru a accepta");
  219.             SendClientMessage(playerid, 0xFF0000AA, "Scrie /refuza pentru al refuza");
  220.         }
  221.     }
  222.     return 1;
  223. }
  224.  
  225. CMD:accepta(playerid, params[])
  226. {
  227.     if(PlayerInfo[playerid][pInvitation] == 1)
  228.     {
  229.         new name[MAX_PLAYER_NAME], file[512], file2[512];
  230.         new string[256];
  231.         new clanid = PlayerInfo[playerid][pClan];
  232.         GetPlayerName(playerid,name,sizeof(name));
  233.         format(file, sizeof(file),"JucatoriClan/%s.ini", name);
  234.         format(file2, sizeof(file2),"Clans/%d.ini", clanid);
  235.         GetPlayerName(playerid, name, sizeof(name));
  236.         dini_IntSet(file,"Clan",PlayerInfo[playerid][pInvClan]);
  237.         dini_IntSet(file,"Rank",1); dini_IntSet(file2,"Membri",ClanInfo[clanid][cMembri]+1);
  238.         PlayerInfo[playerid][pInvClan] = 0;
  239.         PlayerInfo[playerid][pInvitation] = 0;
  240.         dini_IntSet(file,"ClanNume",ClanInfo[clanid][cNume]);
  241.         format(string, sizeof(string), "%s s-a alaturat clanului.",name);
  242.         SendClanMesaj(ClanInfo[clanid][cColor],string,clanid);
  243.     }
  244.     return 1;
  245. }
  246.  
  247. CMD:refuza(playerid, params[])
  248. {
  249.     if(PlayerInfo[playerid][pInvitation] == 1)
  250.     {
  251.         new name[25], string[256];
  252.         GetPlayerName(playerid, name, sizeof(name));
  253.         format(string, sizeof(string), "%s a refuzat invitatia clanului.",name);
  254.         SendClanMesaj(0xFF0000AA,string,PlayerInfo[playerid][pInvClan]);
  255.         PlayerInfo[playerid][pInvClan] = 0;
  256.     }
  257.     return 1;
  258. }
  259.  
  260. CMD:claniesi(playerid, params[])
  261. {
  262.     new name[MAX_PLAYER_NAME], file[512], file2[512];
  263.     new clanid = PlayerInfo[playerid][pClan];
  264.     GetPlayerName(playerid,name,sizeof(name));
  265.     format(file, sizeof(file),"JucatoriClan/%s.ini", name);
  266.     format(file2, sizeof(file2),"Clans/%d.ini", clanid);
  267.     if(PlayerInfo[playerid][pRank] <= 5)
  268.     {
  269.         new name2[25], string[256];
  270.         GetPlayerName(playerid, name2, sizeof(name2));
  271.         format(string, sizeof(string), "%s a iesit din clan.",name2);
  272.         SendClanMesaj(0xFF0000AA,string,PlayerInfo[playerid][pInvClan]);
  273.         dini_IntSet(file2,"Membri",ClanInfo[clanid][cMembri]-1);
  274.         dini_IntSet(file,"Clan",-1);
  275.         dini_IntSet(file,"Rank",0);
  276.         dini_Set(file,"ClanNume","N/a");
  277.     }
  278.     else
  279.     {
  280.         SendClientMessage(playerid, 0xFF0000AA, "Esti liderul clanului, nu poti iesi. Foloseste /desclan");
  281.     }
  282.     return 1;
  283. }
  284.  
  285. CMD:desclan(playerid, params[])
  286. {
  287.     new clanid = PlayerInfo[playerid][pClan];
  288.     new file[35], file2[35];
  289.     format(file, sizeof(file),"Clans/%d.ini", clanid);
  290.     if(PlayerInfo[playerid][pRank] == 6)
  291.     {
  292.         for(new i=1;i<MAX_PLAYERS;i++)
  293.         {
  294.             new name[MAX_PLAYER_NAME];
  295.             GetPlayerName(i,name,sizeof(name));
  296.             format(file2, sizeof(file2),"JucatoriClan/%s.ini", name);
  297.             if(PlayerInfo[i][pClan] == clanid)
  298.             {
  299.                 dini_IntSet(file2,"Clan",-1);
  300.                 dini_IntSet(file2,"CreateClan",0);
  301.                 dini_Set(file2,"ClanNume","N/a");
  302.                 SendClientMessage(playerid, 0xFF0000AA, "Clanul s-a desfintat");
  303.             }
  304.         }
  305.         dini_Set(file,"Nume","N/a");
  306.         dini_Set(file,"Lider","N/a");
  307.         dini_IntSet(file2,"Clan",-1);
  308.         dini_IntSet(file2,"CreateClan",0);
  309.     }
  310.  
  311.     return 1;
  312. }
  313.  
  314. CMD:setspawn(playerid, params[])
  315. {
  316.     new Float:x, Float:y, Float:z, file[256];
  317.     GetPlayerPos(playerid, x, y, z);
  318.     new Float:Angle, string[100];
  319.     GetPlayerFacingAngle(playerid, Angle);
  320.     new clanid = PlayerInfo[playerid][pClan];
  321.     format(file, sizeof(file),"Clans/%d.ini", clanid);
  322.     if(PlayerInfo[playerid][pRank] == 6)
  323.     {
  324.         dini_FloatSet(file,"Spawnx",x);
  325.         dini_FloatSet(file,"Spawny",y);
  326.         dini_FloatSet(file,"Spawnz",z);
  327.         dini_FloatSet(file,"Rotatie",Angle);
  328.         dini_IntSet(file,"Virtual",GetPlayerVirtualWorld(playerid));
  329.         dini_IntSet(file,"Virtual",GetPlayerInterior(playerid));
  330.         format(string, sizeof(string), "Ai setat spawn-ul clanului la %d %d %d", x,y,z);
  331.         SendClientMessage(playerid, 0xFF0000AA, string);
  332.     }
  333.     else
  334.     {
  335.         SendClientMessage(playerid, 0xFF0000AA, "[ClanInfo] Trebuie sa fii liderul clanului, pentru a folosi comanda.");
  336.     }
  337.     return 1;
  338. }
  339.  
  340. CMD:clist(playerid, params[])
  341. {
  342.     new name[256], string[256];
  343.     if(PlayerInfo[playerid][pClan] >= 0)
  344.     {
  345.         for(new i=1;i<MAX_PLAYERS;i++)
  346.         {
  347.             GetPlayerName(i,name,sizeof(name));
  348.             if(PlayerInfo[i][pClan] == PlayerInfo[playerid][pClan])
  349.             {
  350.                 if(PlayerInfo[i][pRank] == 6)
  351.                 {
  352.                     format(string, 256, "** Fondator ** %s", name);
  353.                     SendClientMessage(playerid, 0xFF0000AA, string);
  354.                 }
  355.                 else if(PlayerInfo[i][pRank] == 5)
  356.                 {
  357.                     format(string, 256, "** Rank 5 ** %s", name);
  358.                     SendClientMessage(playerid, 0xFF0000AA, string);
  359.                 }
  360.                 else if(PlayerInfo[i][pRank] == 4)
  361.                 {
  362.                     format(string, 256, "** Rank 4 ** %s", name);
  363.                     SendClientMessage(playerid, 0xFF0000AA, string);
  364.                 }
  365.                 else if(PlayerInfo[i][pRank] == 3)
  366.                 {
  367.                     format(string, 256, "** Rank 3 ** %s", name);
  368.                     SendClientMessage(playerid, 0xFF0000AA, string);
  369.                 }
  370.                 else if(PlayerInfo[i][pRank] == 2)
  371.                 {
  372.                     format(string, 256, "** Rank 2 ** %s", name);
  373.                     SendClientMessage(playerid, 0xFF0000AA, string);
  374.                 }
  375.                 else if(PlayerInfo[i][pRank] == 1)
  376.                 {
  377.                     format(string, 256, "** Rank 1 ** %s", name);
  378.                     SendClientMessage(playerid, 0xFF0000AA, string);
  379.                 }
  380.             }
  381.         }
  382.     }
  383.     else if(PlayerInfo[playerid][pClan] == -1)
  384.     {
  385.         SendClientMessage(playerid, 0xFF0000AA, "Nu esti intr-un clan");
  386.     }
  387.     return 1;
  388. }
  389.  
  390. CMD:clanchat(playerid, params[])
  391. {
  392.     new text[1000], string[256], name[35];
  393.     if(unformat(params, "s[1000]", text))
  394.     {
  395.         SendClientMessage(playerid, 0xFF0000AA, "Usage: /clanchat <clancheat>");
  396.         return 1;
  397.     }
  398.     if(PlayerInfo[playerid][pClan] >= 0)
  399.     {
  400.         GetPlayerName(playerid,name,sizeof(name));
  401.         format(string, sizeof(string), "[ClanChat] [%d] [%s]: {FFFFFF}%s", PlayerInfo[playerid][pRank],name,text);
  402.         SendClanMesaj(ClanInfo[PlayerInfo[playerid][pClan]][cColor],string,PlayerInfo[playerid][pClan]);
  403.     }
  404.     return 1;
  405. }
  406.  
  407. DIAL:10(playerid, bool:response, listitem, inputtext[])
  408. {
  409.     new name[MAX_PLAYER_NAME], ClanName[MAX_PLAYER_NAME], file[254], file2[254];
  410.     format(file2, sizeof(file2), "JucatoriClan/%s.ini", pName(playerid));
  411.     format(ClanName, sizeof(ClanName), "N/a");
  412.     GetPlayerName(playerid,name,sizeof(name));
  413.     for(new i=0;i<100;i++)
  414.     {
  415.         format(file, sizeof(file),"Clans/%d.ini", i);
  416.         if(ClanInfo[i][cID] == -1)
  417.         {
  418.             dini_Set(file,"Nume",inputtext); dini_Set(file2,"ClanNume",inputtext);
  419.             dini_IntSet(file2,"Rank",6);
  420.             dini_IntSet(file2,"Clan",i);
  421.             dini_IntSet(file2,"CreateClan",1);
  422.             dini_Set(file,"Lider",name);
  423.             dini_IntSet(file,"ClanId",i);
  424.             //
  425.             break;
  426.         }
  427.     }
  428.     ShowPlayerDialog(playerid,11, DIALOG_STYLE_LIST, "Arme Clan", "Crosa\nBaston\nCutit\nBata\nLopata\nTac\nKatana\nDrujba", "Accept", "Anulez");
  429.     return 1;
  430. }
  431.  
  432. DIAL:11(playerid, bool:response, listitem, inputtext[])
  433. {
  434.         new clanid = PlayerInfo[playerid][pClan];
  435.         new file[512];
  436.         format(file, sizeof(file),"Clans/%d.ini", clanid);
  437.         if(listitem == 0)
  438.         {
  439.             ShowPlayerDialog(playerid,12, DIALOG_STYLE_LIST, "Arme Clan", "9mm\nSilent 9mm\nDesert Eagle", "Accept", "Anulez");
  440.             ClanInfo[clanid][cArma1] = 2; dini_IntSet(file,"Arma1",2);
  441.            
  442.         }
  443.         if(listitem == 1)
  444.         {
  445.             ShowPlayerDialog(playerid,12, DIALOG_STYLE_LIST, "Arme Clan", "9mm\n Silent 9mm\n Desert Eagle", "Accept", "Anulez");
  446.             ClanInfo[clanid][cArma1] = 3; dini_IntSet(file,"Arma1",3);
  447.            
  448.         }
  449.         if(listitem == 2)
  450.         {
  451.             ShowPlayerDialog(playerid,12, DIALOG_STYLE_LIST, "Arme Clan", "9mm\nSilent 9mm\nDesert Eagle", "Accept", "Anulez");
  452.             ClanInfo[clanid][cArma1] = 4; dini_IntSet(file,"Arma1",4);
  453.            
  454.         }
  455.         if(listitem == 3)
  456.         {
  457.             ShowPlayerDialog(playerid,12, DIALOG_STYLE_LIST, "Arme Clan", "9mm\nSilent 9mm\nDesert Eagle", "Accept", "Anulez");
  458.             ClanInfo[clanid][cArma1] = 5; dini_IntSet(file,"Arma1",5);
  459.            
  460.         }
  461.         if(listitem == 4)
  462.         {
  463.             ShowPlayerDialog(playerid,12, DIALOG_STYLE_LIST, "Arme Clan", "9mm\nSilent 9mm\nDesert Eagle", "Accept", "Anulez");
  464.             ClanInfo[clanid][cArma1] = 6; dini_IntSet(file,"Arma1",6);
  465.            
  466.         }
  467.         if(listitem == 5)
  468.         {
  469.             ShowPlayerDialog(playerid,12, DIALOG_STYLE_LIST, "Arme Clan", "9mm\nSilent 9mm\nDesert Eagle", "Accept", "Anulez");
  470.             ClanInfo[clanid][cArma1] = 7; dini_IntSet(file,"Arma1",7);
  471.            
  472.         }
  473.         if(listitem == 6)
  474.         {
  475.             ShowPlayerDialog(playerid,12, DIALOG_STYLE_LIST, "Arme Clan", "9mm\nSilent 9mm\nDesert Eagle", "Accept", "Anulez");
  476.             ClanInfo[clanid][cArma1] = 8; dini_IntSet(file,"Arma1",8);
  477.            
  478.         }
  479.         if(listitem == 7)
  480.         {
  481.             ShowPlayerDialog(playerid,12, DIALOG_STYLE_LIST, "Arme Clan", "9mm\nSilent 9mm\nDesert Eagle", "Accept", "Anulez");
  482.             ClanInfo[clanid][cArma1] = 9; dini_IntSet(file,"Arma1",9);
  483.            
  484.         }
  485.         return 1;
  486. }
  487.  
  488. DIAL:12(playerid, bool:response, listitem, inputtext[])
  489. {
  490.         new clanid = PlayerInfo[playerid][pClan];
  491.         new file[512];
  492.         format(file, sizeof(file),"Clans/%d.ini", clanid);
  493.         if(listitem == 0)
  494.         {
  495.             ShowPlayerDialog(playerid,13, DIALOG_STYLE_LIST, "Arme Clan", "ShoutGun\nSawnoff Shotgun\nCombat Shotgun", "Accept", "Anulez");
  496.             ClanInfo[clanid][cArma2] = 22; dini_IntSet(file,"Arma2",22);
  497.            
  498.         }
  499.         if(listitem == 1)
  500.         {
  501.             ShowPlayerDialog(playerid,13, DIALOG_STYLE_LIST, "Arme Clan", "ShoutGun\nSawnoff Shotgun\nCombat Shotgun", "Accept", "Anulez");
  502.             ClanInfo[clanid][cArma2] = 23; dini_IntSet(file,"Arma2",23);
  503.            
  504.         }
  505.         if(listitem == 2)
  506.         {
  507.             ShowPlayerDialog(playerid,13, DIALOG_STYLE_LIST, "Arme Clan", "ShoutGun\nSawnoff Shotgun\nCombat Shotgun", "Accept", "Anulez");
  508.             ClanInfo[clanid][cArma2] = 24; dini_IntSet(file,"Arma2",24);
  509.            
  510.         }
  511.         return 1;
  512. }
  513.  
  514. DIAL:13(playerid, bool:response, listitem, inputtext[])
  515. {
  516.         new clanid = PlayerInfo[playerid][pClan];
  517.         new file[512];
  518.         format(file, sizeof(file),"Clans/%d.ini", clanid);
  519.         if(listitem == 0)
  520.         {
  521.             ShowPlayerDialog(playerid,14, DIALOG_STYLE_LIST, "Arme Clan", "Micro SMG\nMP5", "Accept", "Anulez");
  522.             ClanInfo[clanid][cArma3] = 25; dini_IntSet(file,"Arma3",25);
  523.            
  524.         }
  525.         if(listitem == 1)
  526.         {
  527.             ShowPlayerDialog(playerid,14, DIALOG_STYLE_LIST, "Arme Clan", "Micro SMG\nMP5", "Accept", "Anulez");
  528.             ClanInfo[clanid][cArma3] = 26; dini_IntSet(file,"Arma3",26);
  529.            
  530.         }
  531.         if(listitem == 2)
  532.         {
  533.             ShowPlayerDialog(playerid,14, DIALOG_STYLE_LIST, "Arme Clan", "Micro SMG\nMP5", "Accept", "Anulez");
  534.             ClanInfo[clanid][cArma3] = 27; dini_IntSet(file,"Arma3",27);
  535.            
  536.         }
  537.         return 1;
  538. }
  539.  
  540. DIAL:14(playerid, bool:response, listitem, inputtext[])
  541. {
  542.         new clanid = PlayerInfo[playerid][pClan];
  543.         new file[512];
  544.         format(file, sizeof(file),"Clans/%d.ini", clanid);
  545.         if(listitem == 0)
  546.         {
  547.             ShowPlayerDialog(playerid,15, DIALOG_STYLE_LIST, "Arme Clan", "Ak-47\nM5", "Accept", "Anulez");
  548.             ClanInfo[clanid][cArma4] = 28;  dini_IntSet(file,"Arma4",28);
  549.         }
  550.         if(listitem == 1)
  551.         {
  552.             ShowPlayerDialog(playerid,15, DIALOG_STYLE_LIST, "Arme Clan", "Ak-47\nM5", "Accept", "Anulez");
  553.             ClanInfo[clanid][cArma4] = 29;  dini_IntSet(file,"Arma4",29);
  554.         }
  555.         return 1;
  556. }
  557.  
  558. DIAL:15(playerid, bool:response, listitem, inputtext[])
  559. {
  560.         new clanid = PlayerInfo[playerid][pClan];
  561.         new file[512];
  562.         format(file, sizeof(file),"Clans/%d.ini", clanid);
  563.         if(listitem == 0)
  564.         {
  565.             ShowPlayerDialog(playerid,16, DIALOG_STYLE_LIST, "Arme Clan", "Country Rifle\nSniper Rifle", "Accept", "Anulez");
  566.             ClanInfo[clanid][cArma5] = 30;   dini_IntSet(file,"Arma5",30);
  567.         }
  568.         if(listitem == 1)
  569.         {
  570.             ShowPlayerDialog(playerid,16, DIALOG_STYLE_LIST, "Arme Clan", "Country Rifle\nSniper Rifle", "Accept", "Anulez");
  571.             ClanInfo[clanid][cArma5] = 31;  dini_IntSet(file,"Arma5",31);
  572.         }
  573.         return 1;
  574. }
  575.  
  576. DIAL:16(playerid, bool:response, listitem, inputtext[])
  577. {
  578.         new clanid = PlayerInfo[playerid][pClan];
  579.         new file[512];
  580.        
  581.         format(file, sizeof(file),"Clans/%d.ini", clanid);
  582.         if(listitem == 0)
  583.         {
  584.             ShowPlayerDialog(playerid,17, DIALOG_STYLE_LIST, "Culoare", "{FF0000}Rosu\n{0000FF}Albastru\n{FF00FF}Mov\n{FFFF00}Galben\n{00FF00}Verde\n{00FFFF}Cyan\n{C0C0C0}Gri", "Accept", "Anulez");
  585.             ClanInfo[clanid][cArma6] = 33;  dini_IntSet(file,"Arma6",33);
  586.         }
  587.         if(listitem == 1)
  588.         {
  589.             ShowPlayerDialog(playerid,17, DIALOG_STYLE_LIST, "Culoare", "{FF0000}Rosu\n{0000FF}Albastru\n{FF00FF}Mov\n{FFFF00}Galben\n{00FF00}Verde\n{00FFFF}Cyan\n{C0C0C0}Gri", "Accept", "Anulez");
  590.             ClanInfo[clanid][cArma6] = 34;  dini_IntSet(file,"Arma6",33);
  591.         }
  592. }
  593.  
  594. DIAL:17(playerid, bool:response, listitem, inputtext[])
  595. {
  596.         new file[512];
  597.         format(file, sizeof(file),"Clans/%d.ini", PlayerInfo[playerid][pClan]);
  598.         if(listitem == 0)
  599.         {
  600.             ShowPlayerDialog(playerid,18, DIALOG_STYLE_INPUT, "Skin Clan", "Introdu id-ul skinului:", "Accept", "Cancel");
  601.             dini_Set(file,"Culoare","0xFF0000");
  602.         }
  603.         if(listitem == 1)
  604.         {
  605.             ShowPlayerDialog(playerid,18, DIALOG_STYLE_INPUT, "Skin Clan", "Introdu id-ul skinului:", "Accept", "Cancel");
  606.             dini_Set(file,"Culoare","0x0000FF");
  607.         }
  608.         if(listitem == 2)
  609.         {
  610.             ShowPlayerDialog(playerid,18, DIALOG_STYLE_INPUT, "Skin Clan", "Introdu id-ul skinului:", "Accept", "Cancel");
  611.             dini_Set(file,"Culoare","0xFF00FF");
  612.         }
  613.         if(listitem == 3)
  614.         {
  615.             ShowPlayerDialog(playerid,18, DIALOG_STYLE_INPUT, "Skin Clan", "Introdu id-ul skinului:", "Accept", "Cancel");
  616.             dini_Set(file,"Culoare","0xFFFF00");
  617.         }
  618.         if(listitem == 4)
  619.         {
  620.             ShowPlayerDialog(playerid,18, DIALOG_STYLE_INPUT, "Skin Clan", "Introdu id-ul skinului:", "Accept", "Cancel");
  621.             dini_Set(file,"Culoare","0x00FF00");
  622.         }
  623.         if(listitem == 5)
  624.         {
  625.             ShowPlayerDialog(playerid,18, DIALOG_STYLE_INPUT, "Skin Clan", "Introdu id-ul skinului:", "Accept", "Cancel");
  626.             dini_Set(file,"Culoare","0x00FFFF");
  627.         }
  628.         if(listitem == 6)
  629.         {
  630.             ShowPlayerDialog(playerid,18, DIALOG_STYLE_INPUT, "Skin Clan", "Introdu id-ul skinului:", "Accept", "Cancel");
  631.             dini_Set(file,"Culoare","0xC0C0C0");
  632.         }
  633.         return 1;
  634. }
  635.  
  636. DIAL:18(playerid, bool:response, listitem, inputtext[])
  637. {
  638.     new file[512];
  639.     format(file, sizeof(file),"Clans/%d.ini", PlayerInfo[playerid][pClan]);
  640.     new skinid = strval(inputtext);
  641.     if(!IsValidSkin(skinid))
  642.     {
  643.         ShowPlayerDialog(playerid,18, DIALOG_STYLE_INPUT, "Skin Clan", "Introdu id-ul skinului:", "Accept", "Cancel");
  644.     }
  645.     else
  646.     {
  647.         dini_Set(file,"Skin1",inputtext);
  648.         ShowPlayerDialog(playerid,19, DIALOG_STYLE_INPUT, "Skin Clan", "Introdu id-ul skinului2:", "Accept", "Cancel");
  649.     }
  650.     return 1;
  651. }
  652.  
  653. DIAL:19(playerid, bool:response, listitem, inputtext[])
  654. {
  655.     new file[512], file2[512];
  656.     format(file, sizeof(file),"Clans/%d.ini", PlayerInfo[playerid][pClan]);
  657.     format(file2, sizeof(file2), "JucatoriClan/%s.ini", pName(playerid));
  658.     new skinid = strval(inputtext);
  659.     if(!IsValidSkin(skinid))
  660.     {
  661.         ShowPlayerDialog(playerid,19, DIALOG_STYLE_INPUT, "Skin Clan", "Introdu id-ul skinului:", "Accept", "Cancel");
  662.     }
  663.     else
  664.     {
  665.         dini_Set(file,"Skin2",inputtext);
  666.         dini_IntSet(file2,"CreateClan",1);
  667.         dini_IntSet(file2,"Rank",6);
  668.     }
  669.     return 1;
  670. }
  671.    
  672. public LoadClans()
  673. {
  674.     new file[512];
  675.     for(new idx=0;idx<100;idx++)
  676.     {
  677.         format(file, sizeof(file),"Clans/%d.ini", idx);
  678.         if(dini_Exists(file))
  679.         {
  680.             ClanInfo[idx][cID] = dini_Int(file,"ClanId");
  681.             strmid(ClanInfo[idx][cNume], dini_Get(file,"Nume"), 0, strlen(dini_Get(file,"Nume")), 255);
  682.             ClanInfo[idx][cSkin1] = dini_Int(file,"Skin1");
  683.             ClanInfo[idx][cSkin2] = dini_Int(file,"Skin2");
  684.             ClanInfo[idx][cColor] = dini_Int(file,"Culoare");
  685.             ClanInfo[idx][cArma1] = dini_Int(file,"Arma1");
  686.             ClanInfo[idx][cArma2] = dini_Int(file,"Arma2");
  687.             ClanInfo[idx][cArma3] = dini_Int(file,"Arma3");
  688.             ClanInfo[idx][cArma4] = dini_Int(file,"Arma4");
  689.             ClanInfo[idx][cArma5] = dini_Int(file,"Arma5");
  690.             ClanInfo[idx][cArma6] = dini_Int(file,"Arma6");
  691.             ClanInfo[idx][cArma7] = dini_Int(file,"Arma7");
  692.             strmid(ClanInfo[idx][cLider], dini_Get(file,"Lider"), 0, strlen(dini_Get(file,"Lider")), 255);
  693.             ClanInfo[idx][cSpawnx] = dini_Float(file,"Spawnx");
  694.             ClanInfo[idx][cSpawny] = dini_Float(file,"Spawny");
  695.             ClanInfo[idx][cSpawnz] = dini_Float(file,"Spawnz");
  696.             ClanInfo[idx][cAngle] = dini_Float(file,"Rotatie");
  697.             ClanInfo[idx][cInterior] = dini_Int(file,"Interior");
  698.             ClanInfo[idx][cVirtual] = dini_Int(file,"Virtual");
  699.             ClanInfo[idx][cMembri] = dini_Int(file,"Membri");
  700.         }
  701.         else if(!dini_Exists(file))
  702.         {
  703.             dini_Create(file);
  704.             dini_IntSet(file,"ClanId",ClanInfo[idx][cID] = -1);
  705.             dini_Set(file,"Nume","N/a");
  706.             dini_IntSet(file,"Skin1",ClanInfo[idx][cSkin1] = 0);
  707.             dini_IntSet(file,"Skin2",ClanInfo[idx][cSkin2] = 0);
  708.             dini_IntSet(file,"Culoare",ClanInfo[idx][cColor] = 0);
  709.             dini_IntSet(file,"Arma1",ClanInfo[idx][cArma1] = 0);
  710.             dini_IntSet(file,"Arma2",ClanInfo[idx][cArma2] = 0);
  711.             dini_IntSet(file,"Arma3",ClanInfo[idx][cArma3] = 0);
  712.             dini_IntSet(file,"Arma4",ClanInfo[idx][cArma4] = 0);
  713.             dini_IntSet(file,"Arma5",ClanInfo[idx][cArma5] = 0);
  714.             dini_IntSet(file,"Arma6",ClanInfo[idx][cArma6] = 0);
  715.             dini_IntSet(file,"Arma7",ClanInfo[idx][cArma7] = 0);
  716.             dini_Set(file,"Lider", "N/a");
  717.             dini_FloatSet(file,"Spawnx",ClanInfo[idx][cSpawnx]);
  718.             dini_FloatSet(file,"Spawny",ClanInfo[idx][cSpawny]);
  719.             dini_FloatSet(file,"Spawnz",ClanInfo[idx][cSpawnz]);
  720.             dini_FloatSet(file,"Rotatie",ClanInfo[idx][cAngle]);
  721.             dini_IntSet(file,"Interior",ClanInfo[idx][cInterior] = 0);
  722.             dini_IntSet(file,"Virtual",ClanInfo[idx][cVirtual] = -1);
  723.             dini_IntSet(file,"Membri",ClanInfo[idx][cMembri] = 0);
  724.         }
  725.     }
  726.     return 1;
  727. }
  728.  
  729. public SendClanMesaj(color,const string[],clanid)
  730. {
  731.     for(new i = 0; i < MAX_PLAYERS; i++)
  732.     {
  733.         if(IsPlayerConnected(i))
  734.         {
  735.             if (PlayerInfo[i][pClan] == clanid)
  736.             {
  737.                 SendClientMessage(i, color, string);
  738.             }
  739.         }
  740.     }
  741.     return 1;
  742. }
  743.  
  744. IsValidSkin(skinid)
  745. {
  746.     #define     MAX_BAD_SKINS 22
  747.     new badSkins[MAX_BAD_SKINS] =
  748.     {
  749.         3, 4, 5, 6, 8, 42, 65, 74, 86,
  750.         119, 149, 208, 265, 266, 267,
  751.         268, 269, 270, 271, 272, 273, 289
  752.     };
  753.     if (skinid < 0 || skinid > 299) return false;
  754.     for (new i = 0; i < MAX_BAD_SKINS; i++)
  755.     {
  756.         if (skinid == badSkins[i]) return false;
  757.     }
  758.     #undef MAX_BAD_SKINS
  759.     return 1;
  760.  
  761. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement