viewing paste Myzter | 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
// RCharles - Last Man Standing - Fixed!
prontera,143,170,4  script  LMS 67,{
    if (!.gm) goto OnInit;
    mes .n1$;
    mes "Hello there " + strcharinfo(0) + ", welcome to the Last Man Standing event, how can i help you?";
    mes " ";
    mes "> Registration: " + (.LMS_Reg?"^00CC00Open":"^ff0000Closed") + "^000000";
    mes "> Status: " + ((.LMS_Eve==1)?"^00CC00Starting...":(.LMS_Eve==2)?"^FF0000In Progress":"^FF0000Inactive")+"^000000.";
    next;
 
    set .@Menu$, "- Join LMS:- Redeem Reward:" + (getgmlevel() >= .gml?"- " + (.LMS_Eve?"Stop":"Start") +" Event ^0000ff[GM]^000000":"") + ":- Exit";
    switch (select(.@Menu$)) {
        case 1:
            mes .n1$;
            if (!.LMS_Reg) {
                mes "I'm Sorry " + strcharinfo(0) + " but the registration isn't opened yet";
                close;
            }
            mes "Are you sure in joining Last Man Standing Event?";
            next;
            if (select("- Yes! I would like to participate!","- Wrong move, EXIT") - 1) {
                mes .n1$;
                mes "See you again, when you are ready.";
                close;
            }
            mes .n1$;
            mes "That's the spirit!!!";
            mes "I will warp you know to the map where the event will be hold.";
            close2;
 
            if (.limit && .p_ct >= .limit) {
                message strcharinfo(0), "Oh no, the event room for LMS reach the limit of participants!";
                end;
            }
            if (!.LMS_Reg) {
                message strcharinfo(0), "I'm sorry, the registration was closed, be faster the next time!";
                end;
            }
            if (.LMS_Eve > 1) {
                message strcharinfo(0), "I'm sorry, the event is in progress right now, be faster the next time!";
                end;
            }
            set .p_ct,.p_ct + 1;
            set @lms,.LMS_ID;
            warp .map$,0,0;
            if (.intra) sc_start SC_Intravision,.dur,1;
            end;
        case 2:
            mes .n1$;
            if (!@lms || @lms != .LMS_ID) {
                mes "I'm sorry, but you are not qualified to recieve an reward.";
                close;
            }
            mes "Congratulation in surviving Last Man Standing, here is your reward.";
            set @lms,0;
            getitem .rew_id,.rew_am;
            break;
        case 3:
            mes .n1$;
            mes "Do you really want to "+( (!.LMS_Eve)?"^00CC00Start":"^FF0000Stop")+"^000000 the event?";
            next;
 
            if (select("- Yes:- No") == 2) close;
            mes .n1$;
            mes "Please close this window to proceed!";
            close2;
            if (.LMS_Eve) {
                set .LMS_ID,0;
                goto OnDisable;
            } else {
                set .LMS_ID, rand(100000,999999);
                set .time_ch,0;
                goto OnTimer10000;
            }
    }
    close;
 
    OnTimer10000: // Every 10 seconds
        stopnpctimer;
        set .time_ch,.time_ch + 1;
        if (.time_ch == 1) {
            set .LMS_Eve,1; // Event starting
            announce .n2$+": The event, Last Man Standing, will be started shortly.",bc_all;
            if (getmapusers(.map$) > 0) mapannounce .map$,.n2$+": You all will be warped in 10 seconds back to Prontera, since this map will be used for an event, Last Man Standing.",bc_map;
        } else if (.time_ch == 3) {
            mapwarp .map$,"prontera.gat",150,180;
            announce .n2$+": The registration is now open for 2 minutes... hurry!!!",bc_all;
            // Avoid fights before start the event
            removemapflag .map$,mf_pvp;
            set .LMS_Reg,1; // Registration enabled
        } else if (.time_ch == 4) {
            announce .n2$+": We are accepting " + (.limit?.limit:"unlimited") + " participants.",bc_all;
        } else if (.time_ch == 9) {
            announce .n2$+": The registration will be closed in 1 minute...",bc_all;
        } else if (.time_ch == 12) {
            announce .n2$+": The registration process finish in 30 seconds... hurry!!!",bc_all;
        } else if (.time_ch == 15) {
            set .LMS_Reg,0;
            if (.p_ct < 2 || getmapusers(.map$) < 2) {
                announce .n2$+": The process was canceled because there are not enough players.",bc_all;
                set .LMS_ID,0;
                goto OnDisable;
            } else {
                announce .n2$+": Registration has been closed!",bc_all;
            }
        } else if (.time_ch == 16) {
            announce .n2$+": We have " + .p_ct + " registered fighters!!!",bc_all;
            setmapflag .map$,mf_nowarpto;
            setmapflag .map$,mf_nowarp;
            setmapflag .map$,mf_nosave;
            setmapflag .map$,mf_nomemo;
            setmapflag .map$,mf_nomemo;
            setmapflag .map$,mf_partylock;
            setmapflag .map$,mf_pvp_noparty;
            set .LMS_Eve,2; // Event started
        } else if (.time_ch > 16) {
            set .@BaseTime, .time_ch - 17;
            set .@MinutesElapsed, .@BaseTime / 6 + 1;
            if (getmapusers(.map$) == 0) {
                announce .n2$+": It seems like that all users have left the event map therefore I won't be able to declare the winner!!!",bc_all;
                goto OnDisable;
            } else if (getmapusers(.map$) == 1) {
                announce .n$+": The winner of the Last Man Standing event is "+ rid2name(killerrid)+".",bc_all;
                goto OnDisable;
            } else if (.@BaseTime % 6 == 0) {
                if (.@BaseTime) {
                    mapannounce .map$, .n2$ + ": " + .@MinutesElapsed + " Minutes has passed!!!",bc_all;
                } else {
                    mapannounce .map$, .n2$ + ": FIGHT!",bc_all;
                    // Ensure a random start position
                    mapwarp .map$, .map$, 0, 0;
                    // Set the PVP flag here to be sure that the players don't fight before the event start
                    setmapflag .map$,mf_pvp;
                }
            } else if (.@MinutesElapsed >= .dur) {
                mapannounce .map$,.n2$+": "+.dur+" Minutes has passed, I will now end the event!!!",bc_all;
                goto OnDisable;
            }
        }
 
        initnpctimer;
        end;
 
    OnDisable:
        stopnpctimer;
        if (!.LMS_Eve) end; // No need to continue if the event hasn't even started
        set .LMS_Eve,0;
 
        removemapflag .map$,mf_nowarpto;
        removemapflag .map$,mf_nowarp;
        removemapflag .map$,mf_nomemo;
        removemapflag .map$,mf_nomemo;
        removemapflag .map$,mf_pvp;
        removemapflag .map$,mf_partylock;
        removemapflag .map$,mf_pvp_noparty;
 
        set .p_ct,0; // Reseting Player Counter
 
        announce .n2$ + ": The event, Last Man Standing, has ended!!!",bc_all;
        mapannounce .map$,.n2$+": You all will be warped in 10 seconds back to prontera.",bc_all;
        sleep 10000;
        mapwarp .map$,"prontera.gat",150,180;
        end;
 
    OnPCDieEvent:
        set @lms,0;
        if (.LMS_Eve < 2) end;
        if (strcharinfo(3) != .map$) end;
        if (killerrid != getcharid(3)) dispbottom .n$+": You have been killed by "+rid2name(killerrid)+"!!";
        warp "prontera",150,180;
        if (getmapusers(.map$) == 2) {
            mapannounce .map$,.n$+": Wuhu!! Only 2 players remain, let's see who is the better player!!", bc_all;
        } else if (getmapusers(.map$) == 1) {
            announce .n$+": The winner of the Last Man Standing event is "+ rid2name(killerrid)+".",bc_all;
            goto OnDisable;
        } else if (getmapusers(.map$) == 0) {
            goto OnDisable;
        }
        end;
 
    OnPCLogoutEvent:
        if (.LMS_Eve < 2) end;
        if (strcharinfo(3) != .map$) end;
        end;
 
    OnInit:
        set .n1$,"[^0000ff"+strnpcinfo(1)+"^000000]";
        set .n2$,"["+strnpcinfo(1)+"]";
        set .gm,60; // GM Access
        set .dur,5;
 
        // Intravision (Maya Purple Card Effect - Able to see hidden player)
        // This effect is to prevent players to cheat by using "Cloaking" and similiar skills
        // 0 = Off
        // 1 = On
        set .intra,1;
 
        set .rew_am,1; // Reward Amount
        set .rew_id,607; // Item ID
 
        // Player Limit:
        // 0 == Unlimited
        set .limit,30;
 
        // Map on which LMS will be executed
        set .map$,"guild_vs4";
        end;
}
Viewed 898 times, submitted by Myzter.