// RCharles - Last Man Standing
prontera,143,170,4 script LMS 67,{
mes n$;
mes "Hello there " + strcharinfo(0) + ", what do you want to do?";
mes " ";
if (getgmlevel() >= .gml) mes "> The event is currently "+( (.LMS_Eve)?"^00FF00Online":"^FF0000Offline")+"^000000.";
next;
set .@Menu$, "- Join LMS:- Redeem Reward:" + (getgmlevel() >= .gml?"Start/Stop Event":"") + ":- Exit";
switch (select(.@Menu$)) {
case 1:
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 .n$;
mes "See you again, when you are ready.";
close;
}
mes .n$;
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;
}
set .p_ct,.p_ct + 1;
set @lms,1;
setarray .lms_ppl$[.p_ct - 1],strcharinfo(0);
warp .map$,0,0;
if (.intra) sc_start SC_Intravision,.dur,1;
end;
case 2:
mes .n$;
if (!@lms) {
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.";
getitem .rew_id,.rew_am;
break;
case 3:
mes .n$;
mes "Do you really want to "+( (!.LMS_Eve)?"^00FF00start":"^FF0000stop")+"^000000 the event?";
next;
if (select("- Yes:- No") == 1) close;
donpcevent strnpcinfo(3) + "::" + (.LMS_Eve?"OnDisable":"OnStart");
mes .n$;
mes "The event has been " + (.LMS_Eve?"^00FF00started":"^FF0000stopped")+"^000000.";
mes "See ya.";
}
close;
OnStart:
announce .n$+": The event, Last Man Standing, will be started shortly.",bc_all;
sleep 10000;
announce .n$+": The maximum players which can join "+ ( (.limit)?"are "+.limit:"is Unlimited")+".",bc_all;
sleep 10000;
announce .n$+": I will open the registration for 2 minutes.",bc_all;
sleep 10000;
announce .n$+": I just need to finish the preparations!",bc_all;
if (getmapusers(.map$) > 0) {
mapannounce .map$,.n$+": 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;
sleep 10000;
mapwarp .map$,"prontera.gat",150,180;
}
sleep 10000;
set .LMS_Reg,1; // Registration enabled
announce .n$+": Registration is now opened, please hurry!!!",bc_all;
initnpctimer;
end;
OnTimer60000: // Every minute
stopnpctimer;
set .time_ch,.time_ch + 1;
switch(.time_ch) {
case 1:
announce .n$+": Registration will last for 1 minute, please hurry!!!",bc_all;
break;
case 2:
set .LMS_Reg,0;
announce .n$+": Registration has been closed!!!",bc_all;
sleep 10000;
if (.p_ct < 2) {
announce .n$+": But it seems too less have registered, so I have to cancel it!!!",bc_all;
goto OnDisable;
}
announce .n$+": "+.p_ct+" players have registered!!!",bc_all;
sleep 10000;
announce .n$+": The event will last "+.dur+" minutes.",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_pvp;
setmapflag .map$,mf_partylock;
setmapflag .map$,mf_pvp_noparty;
set .LMS_Eve,1; // Event started
break;
default:
// +2 = Previous 2 minutes for registering time
if (.time_ch < (.dur/2)+2 || .time_ch < .dur+2) break;
if (getmapusers(.map$) == 0 && .LMS_Eve) {
announce .n$+": It seems like that all users have left the event map therefore I won't be able to declare the winner!!!",bc_all;
} else if (.time_ch == (.dur/2)+2 ) {
mapannounce .map$, .n$ + ": " + .dur/2 + " Minutes has passed!!!",bc_all;
} else if (.time_ch == (.dur+2) ) {
mapannounce .map$,.n$+": "+.dur+" Minutes has passed, I will now end the event!!!",bc_all;
}
}
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;
deletearray .lms_ppl$[0],128;
set .p_ct,0; // Reseting Player Counter
announce .n$ + ": The event, Last Man Standing, has ended!!!",bc_all;
mapannounce .map$,.n$+": You all will be warped in 10 seconds back to prontera.",bc_all;
sleep 10000;
mapwarp .map$,"prontera.gat",150,180;
end;
CleanGuy:
for (set .@b,0; .@b < getarraysize(.lms_ppl$); set .@b,.@b + 1) {
if (getarg(0) == .lms_ppl$[.@b]) deletearray .lms_ppl$[.@b],1;
}
set .p_ct,getarraysize(.lms_ppl$);
return;
OnPCDieEvent:
set @lms,0;
if (!.LMS_Eve) 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;
}
callsub CleanGuy,strcharinfo(0);
end;
OnPCLogoutEvent:
if (!.LMS_Eve) end;
if (strcharinfo(3) != .map$) end;
callsub CleanGuy,strcharinfo(0);
end;
OnInit:
set .n$,"["+strnpcinfo(1)+"]";
set .gm,60; // GM Access
set .dur,1800000;
// 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;
}