viewing paste last man standing - queue iterator | Athena

Posted on the | Last edited on
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
prontera,154,178,5  script  Last Man Standing   1_F_MARIA,{
    if ( !.start ) {
        mes "no event atm";
        close;
    }
    if ( .start == 2 ) {
        mes "event is running";
        close;
    }
    if ( queuesize(.qid) >= .register_limit ) {
        mes "this event has reach the maximum player participations";
        close;
    }
    warp .eventmap$, 0,0;
    queueadd .qid, getcharid(3);
    Hp = 1;
    end;
//OnClock0000: // put all your start timer here
OnStart:
OnMinute00:
    .qid = queue();
    queueopt .qid, HQO_OnDeath, strnpcinfo(0)+"::OnDeath";
    queueopt .qid, HQO_OnLogout, strnpcinfo(0)+"::OnQuit";
    queueopt .qid, HQO_OnMapChange, strnpcinfo(0)+"::OnMapChange";
    announce "LMS event registration start", bc_all;
    .start = 1;
    sleep 6000; // registration timer here
    announce "LMS event registration close", bc_all;
    if ( queuesize(.qid) < .register_min ) {
        announce "LMS: Not enough players for LMS event", bc_all;
        queuedel .qid;
        mapwarp .eventmap$, .map$, .x, .y;
        .start = 0;
        end;
    }
    .start = 2;
    sleep 3000; // waiting timer here
    mapannounce .eventmap$, "THIS   IS   SPARTA !!!!!", bc_all, 0xff0000, 0x190, 50;
    pvpon .eventmap$;
    end;
OnDeath:
    if ( isloggedin( killerrid ) )
        announce "LMS: "+ strcharinfo(0) +" was killed by "+ rid2name( killerrid ), bc_map;
    else
        announce "LMS: "+ strcharinfo(0) +" was killed by a monster", bc_map;
    warp "SavePoint", 0,0;
    queueremove .qid, getcharid(3);
    if ( queuesize(.qid) == 1 ) goto L_end;
    end;
OnMapChange:
    if ( @QMapChangeTo$ == .eventmap$ ) end;
OnQuit:
    announce "LMS: "+ strcharinfo(0) +" has Quit!", bc_map;
    queueremove .qid, getcharid(3);
    if ( queuesize(.qid) == 1 ) goto L_end;
    end;
L_end:
    .@it = queueiterator(.qid); // call the 1st member of the queue ID
    .@aid = qiget(.@it); // get the 1st index of the queue
    qiclear .@it; // remove the called memory
    attachrid .@aid;
    announce "LMS: Congratulations ~ The winner of LMS event is "+ strcharinfo(0), bc_all;
    getitem .reward_item_id, .reward_item_amount;
    killmonsterall .eventmap$;
    pvpoff .eventmap$;
    queuedel .qid; // event ends, delete the queue from server
    sleep2 5000;
    warp "Save", 0,0;
    end;
OnInit:
    .eventmap$ = "guild_vs5";
    .register_min = 2; // minimum amount of players to start this event, or else it auto-abort
    .register_limit = 100; // maximum amount of players able to participate in this event
    .reward_item_id = 505;
    .reward_item_amount = 20;
 
    bindatcmd "lms", strnpcinfo(0)+"::OnStart", 99,100;
    getmapxy .map$, .x, .y, 1;
    setarray .@mapflag,
        mf_nosave,
        mf_nowarp,
        mf_nowarpto,
        mf_nomemo,
        mf_nopenalty,
    //  mf_nobranch, // as far as I recall, some server allow players to use dead branch to make LMS more exciting
        mf_noicewall,
        mf_pvp_noparty,
        mf_pvp_noguild;
    .@mapflagsize = getarraysize( .@mapflag );
    for ( .@i = 0; .@i < .@mapflagsize; .@i++ )
        setmapflag .eventmap$, .@mapflag[.@i];
    end;
}
Viewed 1221 times, submitted by AnnieRuru.