Shadoww5

Sistema de Arara - FreeGells & Shadow_xD

Jul 17th, 2011
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.18 KB | None | 0 0
  1. /////////////////////////////////////////////
  2. //                                         //
  3. //      Sistema de Arara by FreeGells!     //
  4. //                                         //
  5. //            Ajuda de Shadoww5.           //
  6. //                                         //
  7. /////////////////////////////////////////////
  8.  
  9. #include <a_samp>
  10. #include <dini>
  11.  
  12. #define BRANCO 0xFFFFFFFF
  13. #define VERMELHO 0xFF0000FF
  14.  
  15. enum a
  16. {
  17.     bool:Arara,
  18.     bool:Racao,
  19.     Grande,
  20.     Timer
  21. }
  22. new Info[MAX_PLAYERS][a];
  23.  
  24. public OnFilterScriptInit()
  25. {
  26.     if(!fexist("Araras.txt")) { dini_Create("Araras.txt"); }
  27.     return 1;
  28. }
  29.  
  30. public OnFilterScriptExit()
  31. {
  32.     for(new i = 0; i < MAX_PLAYERS; i++)
  33.     {
  34.         if(Info[i][Arara]) { RemovePlayerAttachedObject(i, 0); }
  35.     }
  36.     return 1;
  37. }
  38.  
  39. forward Crescimento(playerid);
  40.  
  41. public OnPlayerConnect(playerid)
  42. {
  43.     new nome[24], str[50];
  44.     GetPlayerName(playerid, nome, 24);
  45.     format(str, sizeof str, "%s - Arara", nome);
  46.     if(dini_Isset("Araras.txt", str))
  47.     {
  48.         Info[playerid][Arara] = bool:dini_Bool("Araras.txt", str);
  49.         format(str, sizeof str, "%s - Racao", nome);
  50.         Info[playerid][Racao] = bool:dini_Bool("Araras.txt", str);
  51.         format(str, sizeof str, "%s - Grande", nome);
  52.         Info[playerid][Grande] = dini_Int("Araras.txt", str);
  53.         if(Info[playerid][Arara])
  54.         {
  55.             Info[playerid][Timer] = SetTimerEx("Crescimento", 300000, true, "i", playerid);
  56.             SendClientMessage(playerid, 0xFFFF00FF, "Alimente sua arara ou ela morrerá.");
  57.         }
  58.     }
  59.     return 1;
  60. }
  61.  
  62. public OnPlayerSpawn(playerid)
  63. {
  64.     if(Info[playerid][Arara])
  65.     {
  66.         switch(Info[playerid][Grande])
  67.         {
  68.             case 0: { SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.328340, -0.019586, -0.157024, 0.000000, 0.000000, 0.000000, 0.391784, 0.423681, 0.528653 ); }
  69.             case 1: { SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.328340, -0.019586, -0.157024, 0.000000, 0.000000, 0.000000, 0.509503, 0.486798, 0.625176 ); }
  70.             case 2: { SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.328340, -0.051058, -0.147006, 0.000000, 0.000000, 0.000000, 0.584640, 0.560368, 0.655995 ); }
  71.             case 3: { SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.328340, -0.082576, -0.147006, 0.000000, 0.000000, 0.000000, 0.648338, 0.671368, 0.725697 ); }
  72.             case 4, 5: { SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.328340, -0.082576, -0.147006, 0.000000, 0.000000, 0.000000, 0.949556, 1.045981, 1.021382 ); }
  73.         }
  74.     }
  75.     return 1;
  76. }
  77. public OnPlayerDisconnect(playerid, reason)
  78. {
  79.     new nome[24], str[50];
  80.     GetPlayerName(playerid, nome, 24);
  81.     format(str, sizeof str, "%s - Arara", nome);
  82.     dini_BoolSet("Araras.txt", str, Info[playerid][Arara]);
  83.     format(str, sizeof str, "%s - Racao", nome);
  84.     dini_BoolSet("Araras.txt", str, Info[playerid][Racao]);
  85.     format(str, sizeof str, "%s - Grande", nome);
  86.     dini_IntSet("Araras.txt", str, Info[playerid][Grande]);
  87.     return 1;
  88. }
  89.  
  90. public OnPlayerCommandText(playerid, cmdtext[])
  91. {
  92.     if(strcmp(cmdtext, "/comprararara", true) == 0)
  93.     {
  94.         if(Info[playerid][Grande] >= 5) return SendClientMessage(playerid, VERMELHO, "Sua Arara Está Grande e Pronta para ser vendida, Para vender digite /VenderArara !");
  95.         if(GetPlayerMoney(playerid)<2000)return SendClientMessage(playerid, BRANCO,"Você não tem R$2000!");
  96.         if(Info[playerid][Arara]) return SendClientMessage(playerid, BRANCO, "Você já tem uma Arara!");
  97.         SendClientMessage(playerid, BRANCO, "Você Comprou uma Arara!");
  98.         SendClientMessage(playerid, BRANCO, "Ela irá crescer de Cinco a Cinco Minutos!");
  99.         SendClientMessage(playerid, BRANCO, "Não se esqueça de Alimenta-lá! /Racão!");
  100.         SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.328340, -0.019586, -0.157024, 0.000000, 0.000000, 0.000000, 0.391784, 0.423681, 0.528653 );
  101.         GivePlayerMoney(playerid, -2000);
  102.         Info[playerid][Arara] = true;
  103.         Info[playerid][Grande] = 0;
  104.         Info[playerid][Timer] = SetTimerEx("Crescimento", 300000, true, "i", playerid);
  105.         return 1;
  106.     }
  107.     if(strcmp(cmdtext, "/alimentada", true) == 0)
  108.     {
  109.         if(Info[playerid][Grande] >= 5) return SendClientMessage(playerid, VERMELHO, "Sua Arara Está Grande e Pronta para ser vendida, Para vender digite /VenderArara !");
  110.         if(!Info[playerid][Arara]) return SendClientMessage(playerid, VERMELHO, "Você não tem uma arara.");
  111.         if(Info[playerid][Racao]) { SendClientMessage(playerid, BRANCO, "Arara Alimentada: {008000}Sim"); }
  112.         else { SendClientMessage(playerid, BRANCO, "Arara Alimentada: {FF0000}Não"); }
  113.         return 1;
  114.     }
  115.     if(strcmp(cmdtext, "/racao", true) == 0)
  116.     {
  117.         if(Info[playerid][Grande] >= 5) return SendClientMessage(playerid, VERMELHO, "Sua Arara Está Grande e Pronta para ser vendida, Para vender digite /VenderArara !");
  118.         if(!Info[playerid][Arara]) return SendClientMessage(playerid, VERMELHO, "Você não tem uma arara.");
  119.         if(Info[playerid][Racao]) return SendClientMessage(playerid, BRANCO, "Você já Alimentou sua Arara!");
  120.         SendClientMessage(playerid, BRANCO, "Você Alimentou Sua Arara! Isso lhe custou R$200");
  121.         GivePlayerMoney(playerid, -200);
  122.         Info[playerid][Racao] = true;
  123.         return 1;
  124.     }
  125.     if(strcmp(cmdtext, "/venderarara", true) == 0)
  126.     {
  127.         if(!Info[playerid][Arara]) return SendClientMessage(playerid, BRANCO,"Você Não comprou nenhuma Arara!");
  128.         if(Info[playerid][Grande] < 5) return SendClientMessage(playerid, BRANCO,"Sua Arara ainda não está grande!");
  129.         Info[playerid][Grande] = 0;
  130.         Info[playerid][Arara] = false;
  131.         RemovePlayerAttachedObject(playerid, 0);
  132.         GivePlayerMoney(playerid, 10000);
  133.         SendClientMessage(playerid, BRANCO, "Você Vendeu Sua Arara e ganhou R$10000!");
  134.         return 1;
  135.     }
  136.     return 0;
  137. }
  138.  
  139.  
  140. public Crescimento(playerid)
  141. {
  142.     if(!Info[playerid][Arara])
  143.     {
  144.         KillTimer(Info[playerid][Timer]);
  145.         return 0;
  146.     }
  147.     if(!Info[playerid][Racao] && Info[playerid][Grande] < 5)
  148.     {
  149.         SendClientMessage(playerid, BRANCO, "Você não alimentou sua Arara e Ela Morreu!");
  150.         RemovePlayerAttachedObject(playerid, 0);
  151.         Info[playerid][Arara] = false;
  152.         Info[playerid][Grande] = 0;
  153.         KillTimer(Info[playerid][Timer]);
  154.         return 1;
  155.     }
  156.     new str[30];
  157.     RemovePlayerAttachedObject(playerid, 0);
  158.     switch(Info[playerid][Grande])
  159.     {
  160.         case 0: { SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.328340, -0.019586, -0.157024, 0.000000, 0.000000, 0.000000, 0.391784, 0.423681, 0.528653 ); }
  161.         case 1: { SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.328340, -0.019586, -0.157024, 0.000000, 0.000000, 0.000000, 0.509503, 0.486798, 0.625176 ); }
  162.         case 2: { SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.328340, -0.051058, -0.147006, 0.000000, 0.000000, 0.000000, 0.584640, 0.560368, 0.655995 ); }
  163.         case 3: { SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.328340, -0.082576, -0.147006, 0.000000, 0.000000, 0.000000, 0.648338, 0.671368, 0.725697 ); }
  164.         case 4, 5: { SetPlayerAttachedObject( playerid, 0, 19079, 1, 0.328340, -0.082576, -0.147006, 0.000000, 0.000000, 0.000000, 0.949556, 1.045981, 1.021382 ); }
  165.     }
  166.     Info[playerid][Grande]++;
  167.     Info[playerid][Racao] = false;
  168.     format(str, sizeof str, "Sua Arara Cresceu! (%d/5)", Info[playerid][Grande]);
  169.     SendClientMessage(playerid, BRANCO, str);
  170.     if(Info[playerid][Grande] >= 5)
  171.     {
  172.         SendClientMessage(playerid, BRANCO, "Sua Arara Está Grande e Pronta para ser vendida, Para vender digite /VenderArara !");
  173.         KillTimer(Info[playerid][Timer]);
  174.     }
  175.     return 1;
  176. }
Add Comment
Please, Sign In to add comment