viewing paste Unknown #24331 | 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 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
//========================================================================================
//Title: Automated Russian Roulette
//Version: 1.0
//Author: Sharpienero
//Created: 03/24/2016
//Compatibility: Hercules
//Credits: Thanks to Ghost for his original Russian Roulette Script.
//========================================================================================
prontera,149,179,6, script  Automated Russian   4_M_JOB_BLACKSMITH,{
 
set .@n$,"[^0000FFAutomated Roulette^000000]"; //Name of the NPC. Make sure you also change it above.
set .@GMLevel, 40; //What is the minimum gm level to activate the event
 
if (getgmlevel() >= .@GMLevel) { 
    if (.OFStatus == 1) { 
        mes .@n$;
        mes "The event is currently ^0000FFON^000000.";
        mes "What would you like to do?";
        if (select("No, please don't stop the event.","Yes, please stop the event.") == 2) {
            set .OFStatus,0;
            set .Started,0;
            announce "The event has been stopped.", bc_map | bc_red;
            close2;
            callsub CleanUp;
            close;
            end;
        } close;
    } else {
        mes .@n$;
        mes "Greetings, "+strcharinfo(0)+". Would you like to start the Russian Roulette event?";
        if (select("Yes, please start the event.:No, please don't start the event.") == 2) close; { 
            close2;
            set .OFStatus,1;
            callsub OnStart;
        }
    }
} else {
    mes .@n$;
       if (.OFStatus == 1 && .Started == 0) {
        for(set .@i, 0; .@i < .pReg; set .@i, .@i + 1){
            if(.playerlist$[.@i] == strcharinfo(0)) {
                mes "You're already registered, "+strcharinfo(0)+"! Please wait for the game to start.";
                close;
            }
        }
        mes "Would you like to register, "+strcharinfo(0)+"?";
        if (select("Yes:No") == 2) {
            close;
        } else {
            set .playerlist$[.pReg], strcharinfo(0);
            set .pReg, .pReg + 1;
            announce "["+.pReg+ "] "+strcharinfo(0)+" has registered.",bc_area;
        }
 
    } else {
        if (.Started == 1) { 
            mes "The event is currently in progress and you cannot join.";
            close;
        } else {
            mes "This game is quite simple. When the event is active, simply click on me to start, and I will do the rest.";
        }
    }
}
close;
 
OnInit:
set .Timer,1;
set .pReg, 0;
set .RandVar,1;
set .Prize,6265;
set .PrizeAmount,1;
set .OFStatus,0;
set .RandVar,0;
end;
 
OnStart:
OnClock0000:
OnClock0200:
OnClock0400:
OnClock0600:
OnClock1621:
 
set .OFStatus,1;
announce "Russian Roulette will begin in 3 minutes. Please come to the event area (@warp prontera x y) to join the event.", bc_all | bc_blue;
sleep2 5000;
set .Timer,1;
 
if (.Timer == 0) end; 
    announce "Russian Roulette will begin in 2 minutes.", bc_all | bc_blue;
    sleep2 5000;
if (.Timer == 0) end;
    announce "Russian Roulette will begin in 1 minute.", bc_all | bc_blue;
    sleep2 5000;
if (.Timer == 0) end;
    announce "Russian Roulette has begun! Registration is now closed. Good luck to everyone!", bc_all | bc_blue;
    set .Started,1;
    set .RandVar,0;
 
if (.RandVar == 0) {
    for(set .@i, 0; .@i < getarraysize(.playerlist$); set .@i, .@i + 1){
        set .@j, .@j + 1;
    }
    sleep2 2000;
    npctalk "First off, thank you all for joining Russian Roulette. It's been too long since I've seen people blow their brains out. Now, let's begin...";
    sleep2 2000;
    callsub OnSpin;
} 
 
OnSpin:
set .spin, rand(0, .pReg - 1);
attachrid(getcharid(3, .playerlist$[.spin]));
callsub OnCheck;
npctalk "*puts the revolver on the floor and spins it*";
sleep2 2000;
npctalk "*the revolver slowly stops spinning, pointing to "+strcharinfo(0)+"*";
sleep2 2000;
npctalk "*watches " +strcharinfo(0)+ " put the revolver against their head and pull the trigger.*";
sleep2 2000;
callsub OnCheck;
callsub OnShoot;
sleep2 2000;
callsub OnSpin;
return;
 
OnShoot:
if(rand(1, 3) == 1){
    sleep2 2300;
    announce "*BOOM*!",bc_area | bc_red;
    specialeffect2 669;
    specialeffect2 531;
    percentheal -100, -100;
    deletearray .playerlist$[.spin], 1;
    set .pReg, .pReg - 1;
} else {
    sleep2 2300;
    announce "*CLICK*!",bc_area;
    specialeffect2 675;
    specialeffect2 522 + rand(1,14);
} return;
 
OnCheck:
if(.pReg <= 0) {
    announce .@n$ +" There was no winner for Russian Roulette.", bc_all;
    set .OFStatus,0;
    callsub CleanUp;
    end;
}
 
else if (.pReg == 1) {
    npctalk "Aw, it looks like you're the last person alive.. "+strcharinfo(0)+" wins, I guess..";
    sleep2 2000;
    announce ""+strcharinfo(0)+" is the winner of Russian Roulette!", bc_all;
    getitem .Prize,.PrizeAmount;
    callsub CleanUp;
    close;
    end;
}
return;
 
OnPCLogoutEvent:
if (.OFStatus == 1) {
    setarray .disqualified$[.@x], strcharinfo(0);
    set .@x, .@x + 1;
    for(set .@i, 0; .@i < .pReg; set .@i, .@i + 1) {
        if(.playerlist$[.@i] == strcharinfo(0)) {
            deletearray .playerlist$[.@i], 1;
            set .pReg, .pReg - 1;
            announce "" +strcharinfo(0)+ " has been disqualified.",bc_area, 0xFF0000;
            end;
        }
    }
}
end;
 
CleanUp:
set .Started,0;
set .Timer,1;
set .OFStatus,0;
set .pReg, 0;
set .RandVar,1;
stopnpctimer;
deletearray .playerlist$, 128;
deletearray .copiedplayer$, 128;
deletearray .disqualified$, 128;
end;
}
Viewed 1035 times, submitted by Guest.