Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function script ValueConvert {
- set .@num, atoi(""+getarg(0));
- if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);
- set .@l, getstrlen(""+.@num);
- for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) {
- set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$;
- if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$;
- }
- return .@num$;
- }
- function script ValueConvert {
- set .@num, atoi(""+getarg(0));
- if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);
- set .@l, getstrlen(""+.@num);
- for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) {
- set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$;
- if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$;
- }
- return .@num$;
- }
- umbala,148,163,5 script Party vs Party#myro 118,{
- set .@gmlevel,getgmlevel();
- set .@partyid,getcharid(1);
- callsub display_event_info;
- next;
- switch( select( ( .status == 1 )?"Register":( .status == 2 )?"Join / Quit Match":"",
- ( .@gmlevel < .gm_level || .status )?"":"Configurations",
- ( .@gmlevel < .gm_level || !.status )?"":"Stop Event" ) ){
- Case 1:
- if( getcharid(0) != getpartyleader( .@partyid,2 ) ){
- mes "Only Party Leader can register.";
- }else if( .@partyid == .team[0] ){
- if( !.team[1] ){
- if( select("Quit Match","Cancel") == 1 ){
- set .team[0],0;
- set .status,1;
- stopnpctimer;
- if( $match_amount && $match_itemid ){
- message strcharinfo(0),"Retrieved "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid )+".";
- getitem $match_itemid,$match_amount;
- }
- if( $zeny ){
- message strcharinfo(0),"Retrieved "+callfunc( "ValueConvert", $zeny )+" Zeny.";
- set Zeny,Zeny + $zeny;
- }
- }
- }else{
- mes "Cant quit since team 2 already joined.";
- }
- close;
- }else{
- set .@count,callsub( count_party_member,.@partyid );
- if( .@count != $party_member ){
- mes "Please make a party of ^FF0000"+$party_member+" online members^000000.";
- mes " ";
- mes "You have "+.@count+" members online now.";
- }else{
- if( $match_itemid )
- if( countitem( $match_itemid ) < $match_amount ){
- mes "You need "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid );
- close;
- }
- if( $zeny )
- if( Zeny < $zeny ){
- mes "You need "+callfunc( "ValueConvert", $zeny )+" Zeny";
- close;
- }
- if( $match_itemid ){
- set .@amount,$match_amount;
- message strcharinfo(0),"Paid "+callfunc( "ValueConvert", .@amount )+" x "+getitemname( $match_itemid )+".";
- delitem $match_itemid,.@amount;
- }
- if( $zeny ){
- message strcharinfo(0),"Total of "+callfunc( "ValueConvert", $zeny )+" Zeny deducted.";
- set Zeny,Zeny - $zeny;
- }
- switch( .status ){
- Case 1:
- mes "You may decide the map now.";
- set .map,select( .map_name_menu$ ) - 1;
- mes "Your team has been registered.";
- set .team[0],.@partyid;
- set .status,2;
- set .minute,0;
- initnpctimer;
- break;
- Case 2:
- mes "Your team has joined the match.";
- set .team[1],.@partyid;
- set .status,3;
- stopnpctimer;
- close2;
- donpcevent strnpcinfo(0)+"::OnEventStart";
- end;
- break;
- default:
- mes "Registration closed.";
- close;
- }
- }
- }
- break;
- Case 2:
- while( 1 ){
- callsub display_event_info;
- next;
- switch( select( "Edit Party Member","Required Item","Required Zeny","^FF0000Start Event^000000" ) ){
- Case 1:
- mes "Enter the Amount of Party Member required.";
- mes "^777777( 0 ~ 10 )^000000";
- input $party_member,0,10;
- break;
- Case 2:
- mes "Enter item ID :";
- do{
- input .@input;
- }while( getitemname( .@input ) == "null" );
- mes "Enter Amount : "+getitemname( .@input );
- mes "^777777( 0 ~ "+callfunc( "ValueConvert", 30000 )+" )^000000";
- input $match_amount,0,30000;
- if( $match_amount ) set $match_itemid,.@input;
- break;
- Case 3:
- mes "Enter Zeny amount :";
- mes "^777777( 0 ~ "+callfunc( "ValueConvert", 10000000 )+" )^000000";
- input $zeny,0,10000000;
- break;
- Case 4:
- if( $party_member < 1 ){
- mes "^FF0000Invalid^000000. Minimum 1 Party Member.";
- }else if( !$match_amount && !$zeny ){
- mes "^FF0000Invalid^000000. Required 1 item or Zeny.";
- }else{
- mes "Event started.";
- // announce "An Event has been started by GM, registration are now opened.",0;
- mapannounce .npc_map$,"MAP ANNOUNCE: Party vs. Party event has been started by a GM, registrations are now opened.",0;
- mapannounce .map_list$[.map],"An Event has been started by GM, registration are now opened.",0;
- set .status,1;
- close;
- }
- break;
- }
- next;
- }
- break;
- Case 3:
- mes "Event Cancelled";
- close2;
- // announce "Event has been cancelled by GM.",0;
- mapannounce .npc_map$,"MAP ANNOUNCE: The Event has been cancelled by a GM.",0;
- mapannounce .map_list$[.map],"Event has been cancelled by GM.",0;
- mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
- callsub( clear_variable );
- end;
- default: break;
- }
- close;
- OnInit:
- // Minimum GM Level to access cp.
- set .gm_level,80;
- // Map Name List
- setarray .map_name$,"guild_vs1-3","guild_vs2-2";
- setarray .map_list$,"guild_vs1-3","guild_vs2-2";
- // Team Base Location
- // setarray .team_xy,<x1>,<x2>,<y1>,<y2>;
- // x1 + y1 = Coordinate Team 1
- // x2 + y2 = Coordinate Team 2
- setarray .team_xy_map1,44,54,49,50;
- setarray .team_xy_map2,44,54,49,50;
- // map flag initialize
- set .map_size,getarraysize( .map_list$ );
- for( set .@i,0; .@i < .map_size; set .@i,.@i + 1 ){
- set .map_name_menu$,.map_name_menu$ + .map_name$[.@i] +":";
- setmapflag .map_list$[.@i],mf_partylock;
- setmapflag .map_list$[.@i],mf_nogo;
- setmapflag .map_list$[.@i],mf_pvp;
- setmapflag .map_list$[.@i],mf_battleground,2;
- bg_updatescore .map_list$[.@i],.score[ 0 ],.score[ 1 ];
- }
- // npc locations
- getmapxy( .npc_map$,.npc_x,.npc_y,1 );
- // auto start after reload.
- if( $party_member && ( $match_amount || $zeny ) && !.status )
- set .status,1;
- end;
- display_event_info:
- mes "^FF0000[ PARTY MATCH EVENT ]^000000";
- mes "Status : ^777777"+(( !.status )?"^FF0000Not Running":( .status == 1 )?"Waiting Team 1":( .status == 2 )?"Waiting Team 2":"Running" )+"^000000";
- if( .status || getgmlevel() >= .gm_level ){
- mes "Party Member : ^777777"+$party_member+"^000000";
- if( .status == 2 ) mes "Location : ^777777"+.map_name$[.map]+"^000000";
- }
- mes " ";
- if( $match_amount ) mes "Required Item : ^777777"+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid )+"^000000";
- if( $zeny ) mes "Required Zeny : ^777777"+callfunc( "ValueConvert", $zeny )+" Zeny^000000";
- if( .status == 2 ) mes "Registration Countdown : "+( 15 - .minute )+" minutes.";
- return;
- count_party_member:
- set .@getarg,getarg(0);
- getpartymember .@getarg,1;
- getpartymember .@getarg,2;
- for( set .@i,0; .@i < $@partymembercount; set .@i,.@i + 1 )
- if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
- set .@count,.@count + 1;
- return .@count;
- clear_variable:
- set .minute,0;
- set .status,0;
- deletearray .team;
- deletearray .score;
- return;
- OnTimer60000:
- set .minute,.minute + 1;
- if( .minute < 15 ){
- // announce "[ Party : "+getpartyname( .team[0] )+" ] is waiting for a "+$party_member+" vs "+$party_member+" event. ( "+( 15 - .minute )+" minutes to go )",0;
- mapannounce .npc_map$,"[ Party : "+getpartyname( .team[0] )+" ] is waiting for a "+$party_member+" vs "+$party_member+" event. ( "+( 15 - .minute )+" minutes to go )",0;
- initnpctimer;
- }else{
- stopnpctimer;
- // announce "Event Cancelled, 2 Teams failed to register.",0;
- mapannounce .npc_map$,"MAP ANNOUNCE: Event Cancelled, 2 Teams failed to register.",0;
- mapannounce .map_list$[.map],"Event Cancelled, 2 Teams failed to register.",0;
- callsub clear_variable;
- }
- end;
- OnEventStart:
- // announce "Both team success to register for the events. Get ready while you're being warped within 1 minutes.",0;
- mapannounce .npc_map$,"Both team success to register for the events. Get ready while you're being warped within 1 minutes.",0;
- sleep 5000;
- for( set .@i,5; .@i; set .@i,.@i - 1 ){
- // announce " ::: Warp within "+.@i+" seconds ::: ",0;
- mapannounce .npc_map$,"MAP ANNOUNCE: ::: Warp within "+.@i+" seconds ::: ",0;
- mapannounce .map_list$[.map]," ::: Warp within "+.@i+" seconds ::: ",0;
- sleep 1000;
- }
- // re-count for party members..
- set .@count[0],callsub( count_party_member,.team[0] );
- set .@count[1],callsub( count_party_member,.team[1] );
- // check party.
- if( .@count[0] != $party_member || .@count[1] != $party_member ){
- // announce "Event stopped, one of the registered team doesnt meet the requirements of "+$party_member+" members.",0;
- mapannounce .npc_map$,"Event stopped, one of the registered teams did not meet the requirements of "+$party_member+" members.",0;
- }else{
- // announce "Event Start now......",0;
- mapannounce .npc_map$,"MAP ANNOUNCE: Event Starts now......",0;
- mapannounce .map_list$[.map],"Event Start now......",0;
- for( set .@i,0; .@i < 2; set .@i,.@i + 1 ){
- if( attachrid( getpartyleader( .team[.@i],1 ) ) )
- warpparty .map_list$[.map],getd( ".team_xy_map"+( .map + 1 )+"["+.@i+"]" ),getd( ".team_xy_map"+( .map + 1 )+"["+( .@i + 2 )+"]" ),.team[.@i];
- detachrid;
- }
- deletearray .score;
- bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
- sleep 5000;
- mapannounce .map_list$[.map],"Kill all opponents within 15 minutes to win.",0;
- sleep ( 10 * 60000 );
- // check and set winner
- if( .score[0] > .score[1] ) set .winner,.team[0];
- else if( .score[0] < .score[1] ) set .winner,.team[1];
- else if( .score[0] == .score[1] ) set .winner,0;
- // if got winner
- if( .winner ){
- mapannounce .map_list$[.map],"WINNING PARTY : [ "+getpartyname( .winner )+" ] : Match has ended.",0;
- set .@party_leader,getpartyleader( .winner,1 );
- if( attachrid( .@party_leader ) ){
- if( $zeny ){
- mapannounce .map_list$[.map],"Party Leader received "+callfunc( "ValueConvert", $zeny )+" Zeny",bc_blue;
- set Zeny,Zeny + ( $zeny * 2 );
- }
- if( $match_amount ){
- mapannounce .map_list$[.map],"Party Leader received "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid ),bc_blue;
- getitem $match_itemid,( $match_amount * 2 ),.@party_leader;
- }
- detachrid;
- }else{
- mapannounce .map_list$[.map],"Failed to claim rewards because Party Leader not found / offline.",0;
- }
- // draw game
- }else{
- mapannounce .map_list$[.map],"This Game is a DRAW !!!",0;
- }
- // clear map users.
- sleep 3500;
- mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
- }
- callsub( clear_variable );
- // OnMinute00:
- if( $party_member && ( $match_amount || $zeny ) && !.status ){
- // announce "Registration are now opened.",0;
- mapannounce .npc_map$,"Registrations are now opened.",0;
- set .status,1;
- }
- end;
- OnPCKillEvent:
- if( .status > 2 && strcharinfo(3) == .map_list$[.map] ){
- set .@team,( ( getcharid(1) == .team[0] )? 0:1 );
- mapannounce .map_list$[.map],"[ Party : "+getpartyname( .team[ .@team ] )+" ] "+strcharinfo(0)+" has "+( ( killedrid == getcharid(3) )?"commit suicide":"killed "+rid2name( killedrid ) )+" .",0;
- set .score[ .@team ],.score[ .@team ] + 1;
- bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
- if( attachrid( killedrid ) ){
- sleep2 1000;
- atcommand "@alive";
- warp "Save",0,0;
- detachrid;
- }
- if( .score[0] >= $party_member || !.score[1] >= $party_member )
- awake strnpcinfo(0);
- }
- end;
- }
Advertisement
Add Comment
Please, Sign In to add comment