viewing paste Unknown #20590 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
-   script  sdkfksdfjsdfgdf -1,{
OnInit:
    .eventlasting = 30 * 60; // Tempo do último evento ou auto-reset. 30 * 60 = 30 minutos
    .min2start = 2; // Quantidade mínima de player para iniciar a BG
    .startingscore = 50; // Score inicial
    setarray .rewardwin, 7773,30; // premiar a equipe vencedora
    setarray .rewardlose, 7773,15; // premiar a equipe vencedora
 
    setarray .Map$, "florian", "bat_c01", "guild_vs3";
 
    .rewardwinsize = getarraysize( .rewardwin );
    .rewardlosesize = getarraysize( .rewardlose );
    .totalmap = getarraysize( .Map$ );
    bindatcmd "bg", strnpcinfo(0)+"::OnJoin";
    bindatcmd "leavebg", strnpcinfo(0)+"::OnLeave";
 
    for ( .@i = 0; .@i < .totalmap; .@i++ ) {
        setmapflag .Map$[.@i], mf_battleground, 2;
        setmapflag .Map$[.@i], mf_nosave;
        setmapflag .Map$[.@i], mf_nowarp;
        setmapflag .Map$[.@i], mf_nowarpto;
        setmapflag .Map$[.@i], mf_noreturn;
        setmapflag .Map$[.@i], mf_noteleport;
        setmapflag .Map$[.@i], mf_nomemo;
        setmapflag .Map$[.@i], mf_noexppenalty;
        setmapflag .Map$[.@i], mf_nobranch;
        setmapflag .Map$[.@i], mf_noicewall;
        setmapflag .Map$[.@i], mf_gvg;
    }
    end;
OnLeave:
    while ( .signup_aid[.@i] != getcharid(3) && .@i < .signup_count )
        .@i++;
    if ( .@i == .signup_count ) {
        dispbottom "Você ainda não se inscreveu na BG.";
        end;
    }
    deletearray .signup_aid[.@i], 1;
    .signup_count--;
    dispbottom "Você tem deixar o registro desta BG.";
    end;
OnJoin:
    if ( getmapflag( strcharinfo(3), mf_nowarp ) || getmapflag( strcharinfo(3), mf_nowarpto ) ) {
        dispbottom "Você não pode se inscrever para BG neste mapa.";
        end;
    }
    while ( .signup_aid[.@i] != getcharid(3) && .@i < .signup_count )
        .@i++;
    if ( .@i < .signup_count ) {
        dispbottom "Você ainda não se inscreveu na BG.";
        end;
    }
    .signup_aid[ .signup_count ] = getcharid(3);
    .signup_count++;
    dispbottom "Você se registrou na BG.";
//  .@i = 1; // DEBUG
//  .@signup_name$ = rid2name( .signup_aid[0] );
//  while ( .signup_aid[.@i] ) {
//      .@signup_name$ = .@signup_name$ +","+ rid2name( .signup_aid[.@i] );
//      .@i++;
//  }
//  dispbottom "[Debug] Atualmente tem "+ .signup_count +" e eles são "+ .@signup_name$;
L_Start:
    for ( .@i = 0; .@i < .signup_count; .@i++ ) {
        if ( attachrid( .signup_aid[.@i] ) ) {
            if ( getmapflag( strcharinfo(3), mf_nowarp ) ) { // O jogador entrou em um outro evento.
                deletearray .signup_aid[.@i], 1;
            }
        }
        else {
            deletearray .signup_aid[.@i], 1;
            .signup_count--;
            .@i--;
        }   
    }
    if ( .start || .signup_count < .min2start ) {
        announce "Batalha Campal -- [Field of Death] -- +"+ .signup_count +" jogadores para começar -- Digite @bg para participar!", bc_all, 0xFFA500;
        end;
    }
    announce "Batalha Campal -- [Field of Death] -- Começou!", bc_all, 0xFFA500;
    .start = 1;
    .@map$ = .Map$[ rand(3) ];
    .red = createbgid( .@map$, 0,0, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDead" );
    .blue = createbgid( .@map$, 0,0, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead" );
    callfunc "shuffle__", 0, .min2start -1, .@r;
    .@modulus = rand(2);
    for ( .@i = 0; .@i < .signup_count; .@i++ )
        setbgid ( .@i %2 == .@modulus )? .red : .blue, .signup_aid[ .@r[.@i] ];
    deletearray .signup_aid, .min2start;
    .signup_count -= .min2start;
    bg_warp .red, .@map$, 0,0;
    bg_warp .blue, .@map$, 0,0;
    .score[1] = .score[2] = .startingscore;
    bg_updatescore .@map$, .score[1], .score[2];
    sleep .eventlasting * 1000;
    if ( .start == 1 ) {
        if ( .score[1] > .score[2] ) {
            mapannounce "guild_vs"+ .map, " Time Vermelho ganhou!", bc_all, 0xFFA500;
            callsub L_reward, .red, .rewardwin, .rewardwinsize;
            callsub L_reward, .blue, .rewardlose, .rewardlosesize;
        }
        else if ( .score[1] < .score[2] ) {
            mapannounce "guild_vs"+ .map, " Time Azul ganhou!", bc_all, 0xFFA500;
            callsub L_reward, .blue, .rewardwin, .rewardwinsize;
            callsub L_reward, .red, .rewardlose, .rewardlosesize;
        }
        else {
            mapannounce "guild_vs"+ .map, "Empate !", bc_all, 0xFFA500;
            callsub L_reward, .red, .rewardlose, .rewardlosesize;
            callsub L_reward, .blue, .rewardlose, .rewardlosesize;
        }
    }
    bg_warp .red, "prontera", 155,182;
    bg_warp .blue, "prontera", 158,182;
    bg_destroy .red;
    bg_destroy .blue;
    .start = 0;
    deletearray .score;
    goto L_Start;
L_reward:
    getbgusers getarg(0);
    for ( .@i = 0; .@i < $@arenamembersnum; .@i++ )
        for ( .@j = 0; .@j < getarg(2); .@j += 2 )
            getitem getelementofarray( getarg(1), .@j ), getelementofarray( getarg(1), .@j +1 ), $@arenamembers[.@i];
    return;
OnRedDead: callsub L_dead, 1;
OnBlueDead: callsub L_dead, 2;
L_dead:
    .score[ getarg(0) ]--;
    bg_updatescore strcharinfo(3), .score[1], .score[2];
    if ( !.score[ getarg(0) ] )
        awake strnpcinfo(0);
    while ( checkcell( strcharinfo(3), .@x = rand(200), .@y = rand(200), cell_chknopass ) );
    bg_team_setxy getcharid(4), .@x, .@y;
    sleep2 1250;
    percentheal 0,0;
    if ( getmapflag( strcharinfo(3), mf_battleground ) )
        warp strcharinfo(3), 0,0;
    end;
OnRedQuit: callsub L_quit, 1, .red;
OnBlueQuit: callsub L_quit, 2, .blue;
L_quit:
    percentheal 100, 100;
    if ( bg_get_data( getarg(1), 0 ) ) end;
    mapannounce strcharinfo(3), "Todos "+ .teamname$[ getarg(0) ] +"membros da equipe saiu!", bc_all, 0xFF3333;
    .score[ getarg(0) ] = 0;
    awake strnpcinfo(0);
    end;
}
 
//Tricar para florian
prontera    mapflag battleground    2
prontera    mapflag nosave  SavePoint
prontera    mapflag nowarp
prontera    mapflag nowarpto
prontera    mapflag noreturn
prontera    mapflag noteleport
prontera    mapflag nomemo
prontera    mapflag nopenalty
prontera    mapflag nobranch
prontera    mapflag noicewall
 
bat_c01 mapflag battleground    2
bat_c01 mapflag nosave  SavePoint
bat_c01 mapflag nowarp
bat_c01 mapflag nowarpto
bat_c01 mapflag noreturn
bat_c01 mapflag noteleport
bat_c01 mapflag nomemo
bat_c01 mapflag nopenalty
bat_c01 mapflag nobranch
bat_c01 mapflag noicewall
 
guild_vs3   mapflag battleground    2
guild_vs3   mapflag nosave  SavePoint
guild_vs3   mapflag nowarp
guild_vs3   mapflag nowarpto
guild_vs3   mapflag noreturn
guild_vs3   mapflag noteleport
guild_vs3   mapflag nomemo
guild_vs3   mapflag nopenalty
guild_vs3   mapflag nobranch
guild_vs3   mapflag noicewall
 
 
//------------------------------ FUN??O --------------------------------------------------
//----------------------------------------------------------------------------------------
 
//  callfunc "shuffle", <min num>, <max num>, <output array> {, <count> };
function    script  shuffle__   {
    .@static = getarg(0);
    .@range = getarg(1) +1 - .@static;
    .@count = getarg(3, 0);
    if ( .@range <= 0 )
        return 0;
    if ( !.@count || .@count > .@range )
        .@count = .@range;
    while ( .@i < .@count ) {
        .@r = .@save = rand( .@i, .@range -1 ) ;
        if ( !.@tmp1[.@i] ) {
            .@r = .@tmp1[.@r] ? .@tmp2[.@r] : .@r;
            .@tmp2[.@i] = .@r;
            .@tmp2[.@save] = .@i;
            .@tmp1[.@save] = 1;
            set getelementofarray( getarg(2), .@i ), .@r + .@static;
            if ( .@save < .@count )
                set getelementofarray( getarg(2), .@save ), .@i + .@static;
        }
        .@i++;
    }
    return .@count;
}
/*
prontera,156,184,5  script  kjdshfksfjh 100,{
//  input .@min, -1000000000, 1000000000;
//  input .@max, -1000000000, 1000000000;
    .@min = 1;
    .@max = 5;
    callfunc "shuffle__", .@min, .@max, .@output$, 100;
    dispbottom implode( .@output$, "," );
}
*/
 
//------------------------------ Quit AFK --------------------------------------------------
//----------------------------------------------------------------------------------------
-   script  afk_script  -1,{
//  Config
OnInit:
    .sleeploop = 2000; // every 1 second
    .afk = 4; // loop 180 times of 1 second = 3 minutes to execute
    setarray .@map$,
        "florian", "bat_c01", "guild_vs3"; // battlegrounds
 
    .@size = getarraysize( .@map$ );
    for ( .@i = 0; .@i < .@size; .@i++ )
        setmapflag .@map$[.@i], mf_loadevent;
    .Map$ = ":"+ implode( .@map$, ":" ) +":";
    .idle = .sleeploop * .afk / 1000;
    end;
 
//  what to do when triggered
L_trigger:
//  dispbottom "Você est? AFK"+ .idle +" segudos";
    if ( getcharid(4) )
        bg_leave;
    warp "SavePoint", 0,0;
    end;
 
//  function
OnPCLoadMapEvent:
    while ( true ) {
        if ( compare( .Map$, ":"+ strcharinfo(3) +":" ) ) {
            if ( checkidle() >= .idle )
                goto L_trigger;
//      dispbottom "Você est? AFK "+ checkidle() +" segundos";
            sleep2 .sleeploop;
        }
        else
            break;
    }
    end;
}
Viewed 972 times, submitted by Guest.