Advertisement
johnlol

sobrevivente_2016

Jul 2nd, 2020
2,203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.                 .___  ___.  __   __  ___
  3.                 |   \/   | |  | |  |/  /
  4.                 |  \  /  | |  | |  '  /  
  5.                 |  |\/|  | |  | |    <  
  6.                 |  |  |  | |  | |  .  \  
  7.                 |__|  |__| |__| |__|\__\
  8.                          
  9.     = Sobrevivente v2016
  10.     = by Mikéias
  11.     = brAthena
  12.     = User: http://forum.brathena.org/index.php/user/11630-mikeias/
  13.  
  14. */
  15.  
  16. prontera.gat,164,164,3  script  [Sobrevivente]  4_M_DEWOLDMAN,{
  17.  
  18.     mes .namenpc$;
  19.     mes "Olá "+strcharinfo(0);
  20.     mes "Deseja participar do evento Sobrevivente?";
  21.     next;
  22.     switch(select("Participar do evento", ( getgroupid() >= $@lvminGM ? ( !$sobre_status ? "Ligar":"Desligar")+" Evento":"") , "Premiação", "Não quero participar")){
  23.    
  24.         case 1:
  25.             // = Se evento não ativo
  26.             if (!$sobre_status){
  27.                 mes .namenpc$;
  28.                 mes "O evento não está ativo no momento!";
  29.                 close;
  30.             }
  31.            
  32.             // = Verifica se o nome do personagem já está no array
  33.             for (set .@i,0; .@i < getarraysize($participantes$); set .@i,.@i + 1) {
  34.                 if ( $participantes$[.@i] == strcharinfo(0) ) {
  35.                     message strcharinfo(0), strnpcinfo(1)+" Você já está registrado. Aguarde!";
  36.                     close;
  37.                 }
  38.             }
  39.        
  40.             // = Adiciona o nome do personagem ao array
  41.             set $participantes$[getarraysize($participantes$)], strcharinfo(0);
  42.             message strcharinfo(0), strnpcinfo(1)+" Meus parabéns! Você se registrou com êxito para participar do evento.";
  43.             announce strnpcinfo(1)+" <"+strcharinfo(0)+"> registrou-se para participar do evento!",bc_all;
  44.             close;
  45.        
  46.         case 2:
  47.             if( agitcheck() || agitcheck2() ){
  48.                 mes .namenpc$;
  49.                 mes "A Guerra do Emperium está ativa!";
  50.                 close;
  51.             }
  52.             // = Controle: Ligar e Desligar Evento
  53.             if ( !$sobre_status ){
  54.                 donpcevent "Sobrevivente::OnStart";
  55.             }else{
  56.                 donpcevent "Sobrevivente::OnStop";
  57.             }
  58.             close;
  59.            
  60.         case 3:
  61.             mes .namenpc$;
  62.             mes "O último a sobreviver recebe:";
  63.             for(set .@w, 0; .@w < getarraysize($@premiacaoITEM); set .@w, .@w + 1){
  64.                 set .@item, $@premiacaoITEM[.@w];
  65.                 set .@quantidade, $@premiacaoQUANT[.@w];
  66.                 mes .@quantidade+"x "+getitemname(.@item);
  67.             }
  68.             close;
  69.        
  70.         case 4:
  71.         close;
  72.    
  73.     }
  74.    
  75.     OnInit:
  76.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  77.     set .namenpc$, strnpcinfo(1);
  78.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  79.     setarray $@mapevent$, "pvp_n_1-5", 99, 101; // = Configuração do mapa do evento
  80.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  81.     set $@minparticipantes,2;   // = Número mínimo de participantes para iniciar o evento
  82.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  83.     set $@lvminGM, 60;  // = Level mínimo de GM para ligar/desligar o evento
  84.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  85.     // = ATENÇÃO: CADA ITEM TEM SUA QUANTIDADE
  86.     setarray $@premiacaoITEM, 607, 608, 609;    // = Itens
  87.     setarray $@premiacaoQUANT, 1, 10, 20;   // = Quantidade de cada item
  88.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  89.    
  90.     callfunc ("resetEvento", $participantes$, $@mapevent$[0]);
  91.     setarray .mapflag,0,1,7,8,13,22,33,34;
  92.     for (set .@m,0; .@m < getarraysize(.mapflag); set .@m, .@m + 1){
  93.         setmapflag $@mapevent$[0], .mapflag[.@m];
  94.     }
  95.     end;
  96.  
  97. }
  98.  
  99. -   script  Sobrevivente    -1,{
  100.  
  101.     // = Início automático
  102.     OnClock1000:
  103.     OnClock1200:
  104.     OnClock1600:
  105.     OnClock1800:
  106.    
  107.     // = Início manual
  108.     OnStart:
  109.     pvpoff $@mapevent$[0];
  110.     set $sobre_status,1;
  111.     for(set .@t, 3; .@t > 0; set .@t, .@t - 1){
  112.    
  113.         // = Se variável 0 ou GDE ativa, então encerra.
  114.         if ( !$sobre_status || agitcheck() || agitcheck2() ) callfunc ("resetEvento", $participantes$, $@mapevent$[0]);
  115.        
  116.         announce "["+strnpcinfo(1)+"] O evento iniciará em "+(.@t*20)+" segundos!",bc_all;
  117.         sleep 20000;
  118.     }
  119.    
  120.     if ( getarraysize($participantes$) < $@minparticipantes ){
  121.         announce "["+strnpcinfo(1)+"] O mínimo de participantes requeridos não foi satisfeito!",bc_all;
  122.         callfunc ("resetEvento", $participantes$, $@mapevent$[0]);
  123.         end;
  124.     }
  125.     announce "["+strnpcinfo(1)+"] Começando!",bc_all;
  126.    
  127.     set $sobre_status,0;
  128.     for(set .@p, 0; .@p < getarraysize($participantes$); set .@p, .@p + 1){
  129.    
  130.         if ( isloggedin(getcharid(3, $participantes$[.@p])) ){
  131.             warpchar $@mapevent$[0], atoi($@mapevent$[1]), atoi($@mapevent$[2]), getcharid(0, $participantes$[.@p]);
  132.         }else{
  133.             deletearray $participantes$[.@p], 1;
  134.         }
  135.        
  136.     }
  137.     sleep 8000;
  138.    
  139.     mapannounce $@mapevent$[0], "["+strnpcinfo(1)+"] Comecem. O último a sobreviver será o vencedor!",bc_map;
  140.     pvpon $@mapevent$[0];
  141.     set .@timer,0;
  142.     while( getarraysize($participantes$) > 1 ){ // = Enquanto o total de participantes for maior que 1
  143.    
  144.         if ( .@timer == (12*3) ){   // = Caso queira aumentar o tempo de evento, modifique o número multiplicado por 12. Padrão: 3 minutos
  145.             mapannounce $@mapevent$[0], "["+strnpcinfo(1)+"] O tempo acabou!",bc_map;
  146.             callfunc ("resetEvento", $participantes$, $@mapevent$[0]);
  147.             end;
  148.         }
  149.        
  150.         sleep 5000;
  151.         set .@timer, .@timer+1;
  152.     }
  153.     pvpoff $@mapevent$[0];
  154.  
  155.     if ( getarraysize($participantes$) ){
  156.         attachrid(getcharid(3, $participantes$[0]));    // = Atacha o account_id apartir do nome
  157.         if ( strcharinfo(3) == $@mapevent$[0] ){
  158.             announce "["+strnpcinfo(1)+"] Temos um vencedor: "+$participantes$[0],bc_all;
  159.             for(set .@w, 0; .@w < getarraysize($@premiacaoITEM); set .@w, .@w + 1){
  160.                 set .@item, $@premiacaoITEM[.@w];
  161.                 set .@quantidade, $@premiacaoQUANT[.@w];
  162.                 getitem .@item, .@quantidade;
  163.                 message strcharinfo(0), "Você recebeu: "+.@quantidade+"x "+getitemname(.@item);
  164.             }
  165.         }
  166.         detachrid;
  167.     }
  168.     callfunc ("resetEvento", $participantes$, $@mapevent$[0]);
  169.     end;
  170.    
  171.     // = Encerra o Evento
  172.     OnStop:
  173.     announce "["+strnpcinfo(1)+"] Evento encerrado!",bc_all;
  174.     callfunc ("resetEvento", $participantes$, $@mapevent$[0]);
  175.     end;
  176.  
  177. }
  178.  
  179. -   script  sobre_events    -1,{
  180.  
  181.     // = Se o participante que deslogou ou morreu estiver no mapa do evento, seu nome será retirado do array de participantes
  182.     OnPCLogoutEvent:
  183.     OnPCDieEvent:
  184.     if ( strcharinfo(3) == $@mapevent$[0] ){
  185.         for (set .@i,0; .@i < getarraysize($participantes$); set .@i,.@i + 1) {
  186.             if ( $participantes$[.@i] == strcharinfo(0) ){
  187.                 deletearray $participantes$[.@i], 1;
  188.             }
  189.         }
  190.        
  191.         mapannounce $@mapevent$[0], "[Sobrevivente] ["+strcharinfo(0)+"] não está mais entre os sobreviventes!",bc_map;
  192.         warp getsavepoint(0), getsavepoint(1), getsavepoint(2);
  193.         sleep2 2000;
  194.         atcommand "@alive";
  195.     }
  196.     end;
  197. }
  198.  
  199. // = Reseta parâmetros
  200. function    script  resetEvento {
  201.  
  202.     // @param0 = array dos participantes
  203.     // @param1 = map event
  204.     deletearray getarg(0);
  205.     set $sobre_status,0;
  206.     mapwarp getarg(1), "prontera",150,150;
  207.     pvpoff getarg(1);
  208.     return;
  209. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement