Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1. 3v3 an 5v5 menu to choose from
- // 2. Party leader must already have party of 3 or 5 so he can talk to NPC to register.
- // 3. If he still do not have party the NPC will say to make party with 3 or 5 members.
- // 4. Once he registers the NPC will announce that party (partyname) is waiting for a 3v3 or 5v5 event (whatever he registered on)
- // 5. Announcement will be every minute until 15 mins then cancel the registration. Cancellation of registration is also announced when after 15 mins.
- // 6. used maps will be guild_vs1-3 and guild_vs2-2. The first to register will choose which map to use and it will be included in the announcement.
- // 7. Now the joining party with 3 or 5 members will talk to NPC and if they are complete they are accepted. if they are not complete then the NPC will say to make party with 3 or 5 members (whatever is needed by the first registered party).
- // 8. Both teams will be warped at the same time and that is already the start of the match. But Announcement first of "In 1 minute both party A (partyname) and Party B (partyname) will be warped to the Arena and start the match.". Then after 1 minute countdown of "Party recalling in 5", 4 3 2 1 before warp.
- // 9. both party leaders will have to pay 3 pcs or 5pcs item 7179 upon registering. Whoever wins will get all 6 pcs (or 10 pcs) 7179 from the NPC. Its like a bet match.
- prontera,155,181,5 script Sample#myro 757,{
- .@gmlevel = getgmlevel();
- .@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 ){
- .team[0] = 0;
- .status = 1;
- stopnpctimer;
- if( .amount && .item_id ){
- message strcharinfo(0),"Retrieved "+ValueConvert( .amount )+" x "+getitemname( .item_id )+".";
- getitem .item_id,.amount;
- }
- if( .zeny ){
- message strcharinfo(0),"Retrieved "+ValueConvert( .zeny )+" Zeny.";
- Zeny += .zeny;
- }
- }
- }else{
- mes "Cant quit since team 2 already joined.";
- }
- close;
- }else{
- .@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( .item_id )
- if( countitem( .item_id ) < .amount ){
- mes "You need "+ValueConvert( .amount )+" x "+getitemname( .item_id );
- close;
- }else{
- .@amount = ( .amount * 2 );
- message strcharinfo(0),"Paid "+ValueConvert( .@amount )+" x "+getitemname( .item_id )+".";
- delitem .item_id,.@amount;
- }
- if( .zeny )
- if( Zeny < .zeny ){
- mes "You need "+ValueConvert( .zeny )+" Zeny";
- close;
- }else{
- message strcharinfo(0),"Total of "+ValueConvert( .zeny )+" Zeny deducted.";
- Zeny -= .zeny;
- }
- switch( .status ){
- Case 1:
- mes "You may decide the map now.";
- .map = select( implode( .map_name$,":" ) ) - 1;
- mes "Your team has been registered.";
- .team[0] = .@partyid;
- .status = 2;
- .minute = 0;
- initnpctimer;
- break;
- Case 2:
- mes "Your team has joined the match.";
- .team[1] = .@partyid;
- .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 ~ "+ValueConvert( 30000 )+" )^000000";
- input .amount,0,30000;
- if( .amount ) .item_id = .@input;
- break;
- Case 3:
- mes "Enter Zeny amount :";
- mes "^777777( 0 ~ "+ValueConvert( 10000000 )+" )^000000";
- input .zeny,0,10000000;
- break;
- Case 4:
- if( .party_member < 1 ){
- mes "^FF0000Invalid^000000. Minimum 1 Party Member.";
- }else if( !.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;
- .status = 1;
- close;
- }
- break;
- }
- next;
- }
- break;
- Case 3:
- mes "Event Cancelled";
- close2;
- announce "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.
- .gm_level = 80;
- // Map Name List
- setarray .map_name$,"Map 1","Map 2";
- setarray .map_list$,"guild_vs1-3","guild_vs2-2";
- // map flag initialize
- .map_size = getarraysize( .map_list$ );
- for( .@i = 0; .@i < .map_size; .@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 );
- end;
- function 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$;
- }
- 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( .amount ) mes "Required Item : ^777777"+ValueConvert( .amount )+" x "+getitemname( .item_id )+"^000000";
- if( .zeny ) mes "Required Zeny : ^777777"+ValueConvert( .zeny )+" Zeny^000000";
- if( .status == 2 ) mes "Registration Countdown : "+( 15 - .minute )+" minutes.";
- return;
- count_party_member:
- .@getarg = getarg(0);
- getpartymember .@getarg,1;
- getpartymember .@getarg,2;
- for( .@i = 0; .@i < $@partymembercount; .@i++ )
- if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
- .@count++;
- return .@count;
- clear_variable:
- .minute = 0;
- .status = 0;
- deletearray .team;
- deletearray .score;
- end;
- OnTimer60000:
- .minute++;
- if( .minute < 15 ){
- announce "[ 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;
- 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;
- // sleep 55000;
- for( .@i = 5; .@i; .@i-- ){
- announce " ::: Warp within "+.@i+" seconds ::: ",0;
- sleep 1000;
- }
- // re-count for party members..
- .@count[0] = callsub( count_party_member,.team[0] );
- .@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;
- }else{
- announce "Event Start now......",0;
- warpparty .map_list$[.map],0,0,.team[0];
- warpparty .map_list$[.map],0,0,.team[1];
- deletearray .score;
- bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
- sleep 5000;
- mapannounce .map_list$[.map],"Kill all opponent enemy and win the events within 15 minute.",0;
- sleep ( 10 * 60000 );
- // check and set winner
- if( .score[0] > .score[1] ) .winner = .team[0];
- else if( .score[0] < .score[1] ) .winner = .team[1];
- else if( .score[0] == .score[1] ) .winner = 0;
- // if got winner
- if( .winner ){
- mapannounce .map_list$[.map],"WINNER Party : [ "+getpartyname( .winner )+" ] : Game end.",0;
- .@party_leader = getpartyleader( .winner,1 );
- if( attachrid( .@party_leader ) ){
- if( .zeny ){
- mapannounce .map_list$[.map],"Party Leader received "+ValueConvert( .zeny )+" Zeny",bc_blue;
- Zeny = Zeny + ( .zeny * 2 );
- }
- if( .amount ){
- mapannounce .map_list$[.map],"Party Leader received "+ValueConvert( .amount )+" x "+getitemname( .item_id ),bc_blue;
- getitem .item_id,( .amount * 2 ),.@party_leader;
- }
- detachrid;
- }else{
- mapannounce .map_list$[.map],"Fail to claim rewards because Party Leader not found / offline.",0;
- }
- // draw game
- }else{
- mapannounce .map_list$[.map],"This Game is DRAW !!! No winner.",0;
- }
- // clear map users.
- sleep 3500;
- mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
- }
- callsub( clear_variable );
- end;
- OnPCKillEvent:
- if( .status > 2 && strcharinfo(3) == .map_list$[.map] ){
- .@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;
- .score[ .@team ]++;
- 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