Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //By Skorm v2.1
- prontera.gat,207,143,5 script Koh 120,{
- if(!getgmlevel()) end;
- if(select("Start KOH:NO")==1) {
- donpcevent "King Of The Hill::OnClock1230";
- }
- end;
- }
- pvp_n_1-1,89,39,5 script King Of The Hill 139,{
- end;
- OnClock1230:
- OnClock1430:
- OnClock1630:
- OnClock1830:
- stopnpctimer;
- set .koh,0; cleararray .kohplayers[0],0,100;
- set .in,0; set .koht, 1;
- //announce "King of The Hill will start in Pvp1 in 3 minutes!",0;
- //sleep 60000;
- //announce "King of The Hill will start in 2 minutes!!",0;
- //sleep 60000;
- announce "King of The Hill will start 1 minute!!",0;
- set .x,rand(500);
- set .y,rand(500);
- while( !checkcell("pvp_n_1-1",.x+2,.y+3,cell_chkpass) ) {
- set .x,rand(500);
- set .y,rand(500);
- }
- sleep 60000; set .koh,1;
- setnpctimer 0; startnpctimer;
- end;
- OnPCLoadMapEvent:
- if(strcharinfo(3)!=.ma$) end;
- if(!.koht) end;
- for(set .@t,0; .@t<getarraysize(.kohplayers); set .@t,.@t+1) {
- if(.kohplayers[.@t]==getcharid(3)) {
- callfunc "frequency",.@t,(getcharid(3)-2000000),.ma$;
- stopnpctimer;
- set .koh,0; cleararray .kohplayers[0],0,100;
- set .in,0; set .koht,0; set .koth, 0;
- end;
- }
- }
- mapannounce .ma$,""+strcharinfo(0)+" has joined King of the Hill.",0,.jn$;
- set .kohplayers[.in],getcharid(3);
- set .kohplayers$[.in],strcharinfo(0);
- set .in,.in+1;
- callfunc "frequency",(.in-1),(getcharid(3)-2000000),.ma$;
- stopnpctimer;
- set .koh,0; cleararray .kohplayers[0],0,100;
- set .in,0; set .koht,0; set .koth, 0;
- end;
- OnTimer1000:
- donpcevent "::OnKOHStart";
- announce "King of the hill has started!",0,.st$;
- while(getmapusers(.ma$)>=.num&&.koh||.koth&&.koh) {
- sleep 1; set .koth, 1;
- for(set .@d,0; .@d < 5;set .@d,.@d+1) {
- sleep .aft;
- movenpc "KOH#FX1",.x,(.y+.@d);
- movenpc "KOH#FX2",(.x+.@d),(.y+5);
- movenpc "KOH#FX3",(.x+5),((.y+5)-.@d);
- movenpc "KOH#FX4",((.x+5)-.@d),.y;
- }
- }
- if(.koh) announce "Not enough players King of the hill has ended!",0,.nt$;
- stopnpctimer;
- set .koht,0; set .koh,0; set .koth,0;
- callfunc "frequency",0,2000000,.ma$,1;
- cleararray .kohplayers[0],0,100;
- set .in,0;
- end;
- OnTimer16000:
- if(!.koh){ stopnpctimer; end; }
- sleep rand(.hil[0],.hil[1]);
- set .x,rand(500);
- set .y,rand(500);
- while( !checkcell(.ma$,.x+2,.y+3,cell_chkpass) ) {
- set .x,rand(500);
- set .y,rand(500);
- }
- if(.koh) mapannounce .ma$,"The Hill has moved!",0,.hm$;
- goto OnTimer16000;
- OnTimer1800000:
- announce "King of the Hill has ended there was no winner.",0,.nt$;
- stopnpctimer;
- set .koht,0; set .koh,0; set .koth,0;
- callfunc "frequency",0,2000000,.ma$,1;
- cleararray .kohplayers[0],0,100;
- set .in,0;
- end;
- OnInit:
- setarray .hil, 30000, 60000; //Delay for the hill to move in milliseconds range.
- set .hm$, "0xFFAF0A"; //Hill moved color.
- set .nt$, "0xFFAF0A"; //Not enough players color.
- set .st$, "0xFFAF0A"; //KOH started colors.
- set .jn$, "0x00FFFF"; //Join KOH colors.
- set .aft, 500; //Delay of Hill effect in milliseconds.
- set .num, 2; //Number of players allowed to start the event.
- set .ma$, strnpcinfo(4); //Map | For non-rA users manually put your map here in quotes.
- }
- pvp_n_1-1 mapflag loadevent
- pvp_n_1-1,1,1,0 script KOH#FX1 139,{
- OnKOHStart:
- while(getvariableofnpc(.koh, "King Of The Hill")) {
- sleep .efd;
- specialeffect .eft;
- }
- end;
- OnInit:
- set .eft, 137; //Number of hill effect.
- set .efd, 50; //Effect Delay.
- }
- pvp_n_1-1,1,1,0 duplicate(KOH#FX1) KOH#FX2 139
- pvp_n_1-1,1,1,0 duplicate(KOH#FX1) KOH#FX3 139
- pvp_n_1-1,1,1,0 duplicate(KOH#FX1) KOH#FX4 139
- function script frequency {
- //Configuration
- set .anc, 20; //Delay in seconds to announce the leader.
- set .dal, 1; //Delay in seconds for the announcement of status change.
- set .win, 300; //Winning points.
- set .le$, "0x00FFFF"; //Leader Announce Color.
- set .lo$, "0xFF0000"; //lost control of the hill announce color.
- set .kh$, "0x800080"; //Has won koh color.
- set .ge$, "0x00FF00"; //Gained control of the hill color.
- set .co$, "0xFFFF00"; //Hill congested color.
- set .pon, 500; //Delay in milliseconds to get one point.
- set .war, 1; //Warp players off the map when event is finished.(Disable=0 / Enable=1)
- set .pri, 501; //Prize ID.
- set .pam, 10; //Prize Amount.
- set .ma$, getarg(2); //Map
- set .fkn, 1; //Display points in Fakename? (Disable=0 / Enable=1)
- set .dsp, 0; //Display points in chat? (Disable=0 / Enable=1)
- //End
- if(getarg(3,0)) {
- deletearray .c[0],128;
- deletearray .g[0],128;
- set .t,0;
- for(set .@u,0; getelementofarray(getvariableofnpc(.kohplayers, "King Of The Hill"),.@u); set .@u,.@u+1)
- setd(".kohpoints"+(getelementofarray(getvariableofnpc(.kohplayers, "King Of The Hill"),.@u)-2000000),0);
- return;
- }
- set @p,getarg(1);
- set @in,getarg(0);
- getmapxy(.@map$,.@x,.@y,0);
- set .tick, gettimetick(2)+.anc;
- while(.@map$==.ma$&&getvariableofnpc(.koht, "King Of The Hill")) {
- sleep2 1;
- getmapxy(.@map$,.@x,.@y,0);
- if(getvariableofnpc(.koh, "King Of The Hill")) {
- while(.@x<=(getvariableofnpc(.x, "King Of The Hill")+5)&&
- .@y<=(getvariableofnpc(.y, "King Of The Hill")+5)&&
- .@x>=getvariableofnpc(.x, "King Of The Hill")&&
- .@y>=getvariableofnpc(.y, "King Of The Hill")&&
- Hp!=0&&playerattached()) {
- getmapxy(.@map$,.@x,.@y,0);
- sleep2 .pon;
- if(!@c) {
- set .c[.p],getcharid(3); set .g[.p],@in;
- set .p,.p+1; set @c,1;
- if(.p==1) {
- mapannounce .ma$,""+strcharinfo(0)+" has gained control of the hill.",0,.ge$;
- set .b, getcharid(3);
- }
- }
- if(.p>=2&&!.t) {
- mapannounce .ma$,"Hill Congested!",0,.co$; set .t,1;
- }
- if(!.t) {
- setd ".kohpoints"+@p, getd(".kohpoints"+@p)+1;
- if(.dsp) dispbottom "You've "+getd(".kohpoints"+@p)+" points";
- if(.fkn) atcommand "@fakename "+strcharinfo(0)+" ("+getd(".kohpoints"+@p)+"pts)";
- if(getd(".kohpoints"+@p)>=.win) {
- announce ""+strcharinfo(0)+" is King of the Hill!!!",0,.kh$;
- getitem .pri, .pam;
- for(set .@u,0; getelementofarray(getvariableofnpc(.kohplayers, "King Of The Hill"),.@u); set .@u,.@u+1)
- setd(".kohpoints"+(getelementofarray(getvariableofnpc(.kohplayers, "King Of The Hill"),.@u)-2000000),0);
- deletearray .c[0],128;
- deletearray .g[0],128;
- set .t,0; set @c,0;
- if(.fkn) atcommand "@fakename";
- if(.war) mapwarp .ma$,"prontera",100,100;
- return;
- }
- }
- }
- for(set .@s,0; .@s<getarraysize(.c); set .@s,.@s+1)
- if(.c[.@s]==getcharid(3)||!isloggedin(.c[.@s])) {
- if(.b==getcharid(3)&&gettimetick(2)>.tock||
- !isloggedin(.b)&&gettimetick(2)>.tock) {
- mapannounce .ma$,""+getelementofarray(getvariableofnpc(.kohplayers$, "King Of The Hill"),.g[.@u])+
- " has lost control of the hill.",0,.lo$;
- set .tock, gettimetick(2)+.dal;
- }
- set .p,.p-1;
- if(.p<=1) set .t,0;
- deletearray .c[.@s],1;
- deletearray .g[.@s],1;
- if(playerattached()) set @c,0;
- set .@s,.@s-1;
- }
- if(gettimetick(2)>.tick) {
- set .winningpoints,0;
- set .tick, gettimetick(2)+.anc;
- for(set .@u,0; getelementofarray(getvariableofnpc(.kohplayers, "King Of The Hill"),.@u); set .@u,.@u+1) {
- if(getd(".kohpoints"+(getelementofarray(getvariableofnpc(.kohplayers, "King Of The Hill"),.@u)-2000000))
- >=.winningpoints) {
- set .winningpoints,
- getd(".kohpoints"+(getelementofarray(getvariableofnpc(.kohplayers, "King Of The Hill"),.@u)-2000000));
- set .lead, .@u;
- }
- }
- if(.winningpoints)
- mapannounce .ma$,""+getelementofarray(getvariableofnpc(.kohplayers$, "King Of The Hill"),.lead)+
- " is in the lead with "+ .winningpoints +" points.",0,.le$;
- }
- if(.winningpoints>=.win) {
- if(.fkn) atcommand "@fakename";
- set @c,0;
- end;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement