Advertisement
waldreysouzasilva

PAWN: Pescador

Nov 14th, 2016
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.89 KB | None | 0 0
  1. #pragma tabsize 2
  2. #define SALARIO 800
  3. #define DIALOG_PEIXE 3000
  4. #define PRESSED(%0) \
  5.     (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  6.  
  7. //Header
  8. new Float:x, Float:y, Float:z;
  9. new MoneyDay=0,Experiencia=0,Isca=0,PeixeColetados[10],bool:PescaAtivada,bool:PescaRede;
  10. new Peixe[][] = {
  11.   //ID QUANTIDADE PREÇO EXP NOME
  12.   {0,0,17,3,"Dourado"},
  13.   {1,0,25,5,"Tainha"},
  14.   {2,0,33,7,"Traira"},
  15.   {3,0,23,4,"Bagre"},
  16.   {4,0,50,10,"Pacu"},
  17.   {5,0,50,10,"Barbado"},
  18.   {6,0,37,8,"Pintado"},
  19.   {7,0,22,3,"Sardinha"},
  20.   {8,0,20,3,"Piranha"},
  21.   {9,0,10,1,"Atum"}
  22. };
  23.  
  24. //Callbacks
  25. fisher_OnPlayerConnect(playerid) {
  26.     //VARA DE PESCAR
  27.     CreatePickup(18632,1,2163.7803,-103.1321,2.7500,-1);
  28.     Create3DTextLabel("Vara de pesca\nApenas pescadores podem pegar",0xBFBFBFFF,2163.7803,-103.1321,2.7500,7.0,0,0);
  29.     //PACOTE DE ISCAS
  30.     CreatePickup(19289,1,2160.4102,-102.8177,2.7500,-1);
  31.     Create3DTextLabel("Pacote de iscas\nApenas pescadores podem pegar",0xBFBFBFFF,2160.4102,-102.8177,2.7500,7.0,0,0);
  32.     return 1;
  33. }
  34.  
  35. fisher_OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
  36.   if(PRESSED(KEY_SECONDARY_ATTACK)) {
  37.     if(IsPlayerInRangeOfPoint(playerid,2.0,2163.7803,-103.1321,2.7500)) {
  38.       if(Jogador[playerid][Job] == 1) {
  39.         if(Jogador[playerid][StickFish]) {
  40.           SendClientMessage(playerid,0xFF4040FF, "Você já tem uma vara de pesca!");
  41.         } else {
  42.           Jogador[playerid][StickFish] = true;
  43.           SendClientMessage(playerid,0x6C7A89CC,"Agora você tem uma vara de pesca");
  44.           SendClientMessage(playerid,0x6C7A89CC,"\t\tAgora vá trabalhar, bom trabalho!");
  45.         }
  46.       } else {
  47.         SendClientMessage(playerid,0xFF4040FF, "Você não é pescador, apenas pescadores podem pegar vara de pesca aqui.");
  48.       }
  49.     } else if(IsPlayerInRangeOfPoint(playerid,2.0,2160.4102,-102.8177,2.7500)) {
  50.       if(Jogador[playerid][Job] == 1) {
  51.         Isca += 10;
  52.         SendClientMessage(playerid,0x6C7A89CC,"Você acabou de coletar um pacote com 10 iscas.");
  53.         SendClientMessage(playerid,0x6C7A89CC,"\t\tAgora vai trabalhar vagabundo!");
  54.       } else {
  55.         SendClientMessage(playerid,0xFF4040FF, "Você não é pescador, apenas pescadores podem pegar pacote de iscas aqui.");
  56.       }
  57.     }
  58.   }
  59.   return 1;
  60. }
  61.  
  62. //Commands
  63. CMD:pesca(playerid,params[]) {
  64.   new modo[64],bool:valido = false;
  65.   if(sscanf(params,"s",modo)) return SendClientMessage(playerid,0xFF4040FF, "MODO CORRETO: /pesca <peixe/isca>");
  66.   if(!strcmp("peixe",modo)) {
  67.     valido = true;
  68.     new str[268];
  69.     format(str, sizeof(str),"{FFFFFF}Todos os peixes que você capturou será mostrado abaixo!\n\tColete o máximo de peixe!\n\nDourado: %d\nTainha: %d\nTraira: %d\nBagre: %d\nPacu: %d\nBarbado: %d\nPintado: %d\nSardinha: %d\nPiranha: %d\nAtum: %d",Peixe[0][1],Peixe[1][1],Peixe[2][1],Peixe[3][1],Peixe[4][1],Peixe[5][1],Peixe[6][1],Peixe[7][1],Peixe[8][1],Peixe[9][1]);
  70.     ShowPlayerDialog(playerid,DIALOG_PEIXE,DIALOG_STYLE_MSGBOX,"{6C7A89}PESCA: {FFFFFF}Meus peixes",str,"Ok","");
  71.   } else if(!strcmp("iscas", modo)) {
  72.     valido = true;
  73.     new str[64];
  74.     format(str, sizeof(str),"Você tem %d iscas no balde.",Isca);
  75.     SendClientMessage(playerid,0x6C7A89CC,str);
  76.   }
  77.   if(!valido) return SendClientMessage(playerid,0xFF4040FF, "MODO CORRETO: /pesca <peixe/iscas>");
  78.   return 1;
  79. }
  80.  
  81. CMD:pescar(playerid, params[]) {
  82.   new bool:valido = false;
  83.     PescaRede = false;
  84.   valido = true;
  85.   if(Jogador[playerid][StickFish]) {
  86.         if(IsPlayerInRangeOfPoint(playerid,4.0,2101.6106,-104.5097,2.2929)) {
  87.         if(Isca == 0) {
  88.           SendClientMessage(playerid,-1,"Você não tem nenhuma isca");
  89.           SendClientMessage(playerid,-1,"\t\tSe você é pescador, pode pegar um pacote de iscas gratuita na central da profissão");
  90.           SendClientMessage(playerid,-1,"Se não, você vai ter que adquirir em alguma loja 24/7.");
  91.         } else {
  92.           Pescando(playerid);
  93.         }
  94.       } else {
  95.                 SendClientMessage(playerid,0xBFBFBFFF, "Você não está em um lugar de pesca.");
  96.             }
  97.     } else {
  98.       SendClientMessage(playerid,-1,"Você não tem uma vara de pescar.");
  99.       SendClientMessage(playerid,-1,"\t\tSe você é pescador, pode pegar uma vara gratuita na central da profissão.");
  100.       SendClientMessage(playerid,-1,"Se não, você vai ter que adquirir em alguma loja 24/7.");
  101.     }
  102.   if(!valido) return SendClientMessage(playerid,0xFF4040FF, "MODO CORRETO: /pescar");
  103.   return 1;
  104. }
  105.  
  106. CMD:resumo(playerid) {
  107.   PayDay(playerid);
  108.   return 1;
  109. }
  110.  
  111. CMD:rede(playerid,params[]) {
  112.     if(Jogador[playerid][Job] == 1) {
  113.         new modo[64],bool:valido;
  114.       if(sscanf(params,"s",modo)) return SendClientMessage(playerid,0xFF4040FF, "MODO CORRETO: /rede <lancar/puxar>");
  115.         if(!strcmp("puxar",modo)) {
  116.             valido = true;
  117.             if(PescaRede || PescaAtivada) {
  118.                 if(IsPlayerInRangeOfPoint(playerid,3.0,x,y,z)) {
  119.                     for(new i = 0; i < 10; i++) {
  120.                         PeixeColetados[i] = Peixe[PeixeColetados[i]][1] += 1;
  121.                     }
  122.                     PescaRede = false;
  123.                     RemovePlayerMapIcon(playerid,1);
  124.                     SendClientMessage(playerid,0xBFBFBFFF,"Rede coletada com sucesso!");
  125.                 }
  126.             } else {
  127.                 SendClientMessage(playerid,0xBFBFBFFF,"Você não tem nenhuma rede lançada em alto mar!");
  128.             }
  129.         }   else if(!strcmp("lancar",modo)) {
  130.                 if(!PescaRede) {
  131.                     valido = true;
  132.                   PescaRede = true;
  133.                     PescaAtivada = true;
  134.                     Pescando(playerid);
  135.                 } else {
  136.                     SendClientMessage(playerid,0x2574A9FF,"Você já lançou uma rede em alto mar! Aguarde para lançar uma nova rede em alto mar.");
  137.                 }
  138.             }
  139.             if(!valido) return SendClientMessage(playerid,0xFF4040FF, "MODO CORRETO: /rede <lancar/puxar>");
  140.         }
  141.     return 1;
  142. }
  143.  
  144. //Functions
  145. stock Pescando(playerid) {
  146.     if(!PescaRede) {
  147.         SendClientMessage(playerid,0x2574A9FF,"A isca foi lançada! Aguarde até algum peixe fisgar a isca.");
  148.         SetTimerEx("AguardePesca",Minuto(1),false,"i",playerid);
  149.     } else {
  150.         GetPlayerPos(playerid,x,y,z);
  151.         SendClientMessage(playerid,0x2574A9FF,"A rede foi lançada com sucesso! Volte daqui 6 horas que você poderá puxar novamente.");
  152.         SetTimerEx("AguardeRede",Minuto(1),false,"i",playerid);
  153.     }
  154.     return 1;
  155. }
  156.  
  157. stock Minuto(time) {
  158.     time = time* 60000;
  159.     return time;
  160. }
  161.  
  162. stock PayDay(playerid) {
  163.   new str[64],str2[64],str3[64],juros_governo = 0;
  164.   if(MoneyDay == 0) {
  165.   } else {
  166.     juros_governo = MoneyDay*10/100;
  167.     MoneyDay -= juros_governo;
  168.   }
  169.   format(str, sizeof(str),"\t\tExperiência: {F2527F}+%d",Experiencia);
  170.   format(str2, sizeof(str2),"\t\tJuros do governo: {EF4836}%d,00 [10 porcento]",juros_governo);
  171.   format(str3, sizeof(str3),"\t\tPagamento do dia: {03A678}%d,00",MoneyDay);
  172.   SendClientMessage(playerid,0xF5D76EAA,"PAYDAY:{FFFFFF} Resumo do pagamento");
  173.   SendClientMessage(playerid,0xBFBFBFFF,str);
  174.   SendClientMessage(playerid,0xBFBFBFFF,str2);
  175.   SendClientMessage(playerid,0xBFBFBFFF,str3);
  176.   SendClientMessage(playerid,0xF5D76EAA,"Retire seu dinheiro em qualquer banco.");
  177.   return 1;
  178. }
  179.  
  180. forward AguardePesca(playerid);
  181. public AguardePesca(playerid) {
  182.     new rand = random(sizeof(Peixe));
  183.     new str[128];
  184.     format(str, sizeof(str),"Você acabou de pescar um %s, parabéns!",Peixe[rand][4]);
  185.     SendClientMessage(playerid,0x2574A9FF,str);
  186.     Peixe[rand][1] += 1;
  187.     Experiencia += Peixe[rand][3];
  188.     MoneyDay += Peixe[rand][2];
  189.     Isca -= 1;
  190.     return 1;
  191. }
  192.  
  193. forward AguardeRede(playerid);
  194. public AguardeRede(playerid) {
  195.     new rand[10];
  196.     PescaAtivada = false;
  197.     for(new i = 0; i < 10; i++) {
  198.         rand[i] = random(sizeof(Peixe));
  199.         //Peixe[rand[i]][1] += 1;
  200.         Experiencia += Peixe[rand[i]][3];
  201.         MoneyDay += Peixe[rand[i]][2];
  202.         PeixeColetados[i] = Peixe[rand[i]][1];
  203.     }
  204.     SendClientMessage(playerid,0x2574A9FF,"Você conseguiu pegar alguns peixes pelo que parece!");
  205.     SendClientMessage(playerid,0x2574A9FF,"\t\t\tVá onde deixou a rede para ver como foi!");
  206.     SendClientMessage(playerid,0x2574A9FF,"Está marcado no mapa como uma âncora.");
  207.     SetPlayerMapIcon(playerid,1,x,y,z,9,0,1);
  208.     return 1;
  209. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement