viewing paste topic/11185- lms_1.1 | Athena

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
//===== Hercules Script =====================================
//= Last Man Standing
//===== By: ================================================
//= AnnieRuru
//===== Current Version: ===================================
//= 1.1
//===== Compatible With: ===================================
//= Hercules 2015-11-15
//= DO NOT USE THIS SCRIPT IF YOUR HERCULES COMPILE BEFORE THIS DATE
//===== Description: =======================================
//= Stay Alive and Kill Everyone Else !!!
//===== Topic ==============================================
//= http://herc.ws/board/topic/11185-
//===== Additional Comments: ===============================
//= The first custom script that uses queue iterator script commands !
//==========================================================
 
prontera,154,187,5  script  Last Man Standing   1_F_MARIA,{
    if ( .start == false ) {
        mes "Registration closed. Please come again.";
        close;
    }
    if ( getgmlevel() >= 99 ) { // gm level to bypass the registration
        warp .eventmap$, 0,0;
        end;
    }
    if ( queuesize(.qid) >= .register_limit ) {
        mes "this event has reach the maximum player participations.";
        close;
    }
    warp .eventmap$, 0,0;
    queueadd .qid, getcharid(3);
    percentheal 100, 100;
    end;
//OnClock0000: // put all your start timer here
OnStart:
OnMinute00:
    .start = true;
    .qid = queue();
    if ( !queueopt( .qid, QUEUEOPT_DEATH, strnpcinfo(0)+"::OnDeath" ) ) { // a simple way to stop members asking if your server is updated ?
        debugmes "Your server is outdated.";
        end;
    }
    queueopt .qid, QUEUEOPT_LOGOUT, strnpcinfo(0)+"::OnQuit";
    queueopt .qid, QUEUEOPT_MAPCHANGE, strnpcinfo(0)+"::OnMapChange";
    announce "LMS event will start in 5 min.", bc_all;
    sleep 300000; // 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 = false;
        end;
    }
    .start = false;
    sleep 3000; // waiting timer here
//  .@it = queueiterator(.qid);
//  for ( .@aid = qiget(.@it); qicheck(.@it); .@aid = qiget(.@it) )
//      debugmes ( ++.@i )+". "+ rid2name(.@aid);
//  qiclear .@it;
    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;
    queueremove .qid, getcharid(3);
    warp "Save", 0,0;
    if ( queuesize(.qid) == 1 ) goto L_end;
    end;
OnMapChange:
    if ( @Queue_Destination_Map$ == .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 Poring_Coin, 10;
    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
 
    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 1319 times, submitted by AnnieRuru.