So I have a script that checks for party members IP, but I'd like to also have it check their Unique_id(to prevent using a different PC without VPN and to prevent using same PC with VPN) I've been knocking my head on the table for an hour now trying to figure it out. I'm using SQL because I'm having the table get TRUNCATED at OnClock0000(couldn't find any other way to remove everyones variable).
//===== rAthena Script =======================================
//= MVP Ladder Game
//===== By: ==================================================
//= aftermath, AnnieRuru (rewrite)
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= rAthena Project
//===== Description: =========================================
//= Gather a party and kill every MVP in ascending order.
//===== Additional Comments: =================================
//= 1.0 First version, edited. [Euphy]
//============================================================
veil,81,134,6 script Quistis Trepe 10414,{
.gui = get_unique_id ();
.@nb = query_sql("SELECT `bloodybranch` FROM `bloody_branch` WHERE `unique_id` = "+.gui+" LIMIT 1", .@bbq);
mes "[Quistis Trepe]";
mes "Say... do you want to play the MvP Ladder game? It cost 15 Vote Coins Per person, total of 30 Vote Coins now to get in.";
next;
switch(select("Yes, let's get it on!:Information.:Show me the best record.:No.")) {
case 1:
if (.@bbq <= 0) {
break;
} else if (.@bbq >= 1) {
mes "You have already completed the Bloody Branch Quest for today. Come back tomorrow after 12:00am server time.";
close;
}
case 2:
mes "[Quistis Trepe]";
mes "In this game, your party has to kill every single MvP monster in ascending order, from the weakest to strongest.";
if ( .finish_item_amount )
mes "If your party can finish the MVP ladder game, each member will earn "+ callfunc("F_InsertPlural", .finish_item_amount, getitemname( .finish_item_id )) +".";
if ( .register_cost )
// mes "But the entrance fee is "+ callfunc( "F_InsertComma", .register_cost ) +" zeny.";
mes "But the entrance fee is 15 vote coins per person, which means 30 Vote Coin total.";
mes "Everyone need to vote on the websites to get 300 Vote Point, you can exchange them for 30 Vote Coins with the VoteForPoints Npc";
next;
mes "[Quistis Trepe]";
mes "You lose the game if you can't finish in "+ .timeout +" minutes, or if your entire party is killed.";
mes "Good luck!";
close;
case 3:
mes "[Quistis Trepe]";
if ( !$mvpladdderparty_time ) {
mes "Nobody has finished this game yet.";
close;
}
mes "The best record is";
mes "[ "+( $mvpladdderparty_time / 60 )+" min "+( $mvpladdderparty_time % 60 )+" sec ]";
mes "By the party ^FF0000"+ $mvpladdderparty_name$ +"^000000.";
.@size = getarraysize( $mvpladderparty_member$ );
for ( .@i = 0; .@i < .@size; .@i++ )
mes "^000000"+ ( .@i +1 ) +". ^0000FF"+ $mvpladderparty_member$[.@i];
if ( getgmlevel() < .gmlvlreset ) close;
next;
if ( select( "Close.", "Reset the record." ) == 1 ) close;
if ( select( "Never mind.", "I really want to reset it." ) == 1 ) close;
$mvpladdderparty_time = 0;
$mvpladdderparty_name$ = "";
deletearray $mvpladderparty_member$[.@i];
mes "[Quistis Trepe]";
mes "Record reset successfully.";
close;
case 4:
mes "[Quistis Trepe]";
mes "When you are strong enough to complete the game, please come back.";
close;
}
if ( !getcharid(1) ) {
mes "[Quistis Trepe]";
mes "You have to form a party to play.";
close;
}
if ( is_party_leader() == false ) {
mes "[Quistis Trepe]";
mes "Only the party leader can register.";
close;
}
.@origin = getcharid(3);
getpartymember getcharid(1),1;
getpartymember getcharid(1),2;
for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if (isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) == 0)
continue;{
.@class = readparam( Class, $@partymembercid[.@i] );
if (compare( .@job_list$, "|" + .@class + "|" ) == 1) {
mes "Sorry, only one " + jobname(.@class) + " is allowed.";
close;
}
.@job_list$ += "|" + .@class + "|";
.@online++;
}
}
// START OF NEW CHECK - [Duplicate IP in one party?]
attachrid .@origin;
// for IP check
set .@party_list$, "";
set .@done_list$, "";
set .@dupli, 0;
// Check Party Members
for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if (isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) == 0)
continue;{
attachrid $@partymemberaid[.@i];
query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`=" + $@partymemberaid[.@i] + "", .@ipd$);
// If same IP is on party
if(compare(.@party_list$, "|" + .@ipd$ + "|" ) == 1) {
set .@dupli, 1;
} else
// Add IP to party list for checking
.@party_list$ += "|" + .@ipd$ + "|";
// If acc has entered ladder
if (compare( .en_acc_list$, "|" + getcharid(3,strcharinfo(0)) + "|" ) == 1) {
if(.@done_list$ == "")
.@done_list$ += strcharinfo(0);
else
.@done_list$ += ", " + strcharinfo(0);
}
}
}
// Get back to PTL to display message
attachrid .@origin;
if(.@dupli) {
mes "Sorry, party members with the same IP address can't enter.";
close;
}
if(.@done_list$ != "") {
mes "Sorry, the following people has already entered the ladder today:";
mes .@done_list$;
close;
}
// END OF NEW CHECK
else if ( $@partymembercount != .register_min ) {
mes "[Quistis Trepe]";
mes "You have to form a party with exactly "+ .register_min +" different classes members to play.";
close;
}
else if ( .@online != .register_min ) {
mes "[Quistis Trepe]";
mes "Your party must have "+ .register_min +" members online on map '"+ strnpcinfo(4) +"'.";
close;
}
else if (countitem(34207) < 15) {
mes "[Quistis Trepe]";
mes "You don't have 15 vote coins. Please come back when you do.";
close;
}
// PTL has 5 miths, check for other pt members
else if (countitem(34207) > 14) {
for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
attachrid $@partymemberaid[.@i];
if (countitem(34207) < 15) {
attachrid .@origin;
mes "[Quistis Trepe]";
mes "You don't have 15 Vote Points. Please come back when you do.";
close;
}
}
attachrid .@origin;
}
if ( .party_id ) {
mes "[Quistis Trepe]";
mes "I'm sorry, but a party is currently playing the game. Please standby until the party is finished.";
mes "Thank you.";
close;
}
announce "The party ["+ strcharinfo(1) +"] has started the MvP ladder game.", bc_all;
// Delete mithril coins for each PT member
for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
attachrid $@partymemberaid[.@i];
delitem 34207,15;
}
attachrid .@origin;
set .party_id, getcharid(1);
set .@time_enter, gettimetick(2);
for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
attachrid $@partymemberaid[.@i];
if ( strcharinfo(3) == strnpcinfo(4) ) {
announce "You have "+ .timeout +" minutes to complete "+ .totalround +" rounds.", bc_self;
.@name$[.@c] = strcharinfo(0);
.@c++;
}
}
}
cleanmap .eventmap$;
warpparty .eventmap$, 0,0, .party_id, strnpcinfo(4);
attachrid .@origin;
mes "hello";
donpcevent strnpcinfo(0)+"::OnMvpDead";
sleep .timeout * 60000;
if ( .round == .totalround +1 ) {
getpartymember .party_id, 1;
getpartymember .party_id, 2;
mapannounce .eventmap$, "Congratulations... You were able to defeat all the MVPs!", bc_map;
for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
attachrid $@partymemberaid[.@i];
query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`=" + $@partymemberaid[.@i] + "", .@ipd$);
if ( strcharinfo(3) == .eventmap$ )
getitem .finish_item_id, .finish_item_amount;
query_sql( "INSERT INTO `bloody_branch` VALUES ("+.gui+", 1)");
.entered_list$ += "|" + .@ipd$ + "|";
.en_acc_list$ += "|" + getcharid(3,strcharinfo(0)) + "|";
}
}
set .@rid , getcharid(3,strcharinfo(0));
addrid (2,0,getcharid(1)); //attach the rid of all players in the group
set questdelay,gettimetick(2)+86400; //set the delay for all players in group
detachrid;
attachrid(.@rid); //so that the rest of the script will only run on the party leader
set .@timeused, gettimetick(2) - .@time_enter;
if ( .bonus_item_amount && .@timeused < .bonus_time * 60 ) {
mapannounce .eventmap$, "You are rewarded a bonus item for completing the ladder within "+ .bonus_time +" minutes.", bc_map;
for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
attachrid $@partymemberaid[.@i];
if ( strcharinfo(3) == .eventmap$ )
getitem .bonus_item_id, .bonus_item_amount;
}
}
}
if ( !$mvpladdderparty_time || .@timeused < $mvpladdderparty_time ) {
mapannounce .eventmap$, "And you broke the record! [ "+( .@timeused / 60 )+" min "+( .@timeused % 60 )+" sec ]", bc_map;
set $mvpladdderparty_time, .@timeused;
set $mvpladdderparty_name$, getpartyname( .party_id );
copyarray $mvpladderparty_member$, .@name$, .register_min;
}
else
mapannounce .eventmap$, "Time used [ "+( .@timeused / 60 )+" min "+( .@timeused % 60 )+" sec ]", bc_map;
sleep 10000;
announce "Player ["+ .@name$ +"] of the party ["+ getpartyname( .party_id ) +"] has finished the Bloody Branch Quest!", bc_all;
}
else
announce "Player ["+ .@name$ +"] of the party ["+ getpartyname( .party_id ) +"] has failed to finish the MvP ladder game.", bc_all;
mapwarp .eventmap$, .map$, .x, .y;
killmonsterall .eventmap$;
.party_id = .round = 0;
end;
OnMvpDead:
getpartymember .party_id, 1;
getpartymember .party_id, 2;
.round++;
if ( .round >= 2 && .round != .totalround +1 && .round_item_amount ) {
for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
attachrid $@partymemberaid[.@i];
if ( strcharinfo(3) == .eventmap$ )
getitem .round_item_id, .round_item_amount;
}
}
}
if ( .round == .totalround +1 ) {
awake strnpcinfo(0);
end;
}
else if ( .round == .totalround )
mapannounce .eventmap$, "The final Round will begin in "+ .delay +" seconds...", bc_map;
else
mapannounce .eventmap$, "Starting round "+ .round +" in "+ .delay +" seconds...", bc_map;
sleep .delay * 1000;
if ( .mvpid[.round] == 1646 ) // pick random Bio3 MVP
.mvpid[.round] = rand(1646,1651);
monster .eventmap$,0,0, "--ja--", .mvpid[.round], 1, strnpcinfo(0)+"::OnMvpDead";
mapannounce .eventmap$, getmonsterinfo( .mvpid[.round], MOB_NAME ) +" has spawned!", bc_map|bc_blue;
end;
OnPCLogoutEvent:
if ( hp > 0 )
.@less_one = 1;
else
end;
OnPCDieEvent:
if ( strcharinfo(3) != .eventmap$ || !getcharid(1) ) end;
if ( getcharid(1) != .party_id ) end;
getpartymember .party_id, 1;
getpartymember .party_id, 2;
for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
attachrid $@partymemberaid[.@i];
if ( strcharinfo(3) == .eventmap$ && hp > 0 )
.@alive++;
}
}
if ( .@less_one )
.@alive--;
if ( !.@alive ) {
mapannounce .eventmap$, "Party wiped!", bc_map;
sleep 10000;
awake strnpcinfo(0);
}
end;
OnClock0000:
set .entered_list$, "";
set .en_acc_list$, "";
query_sql "truncate table bloody_branch";
end;
OnInit:
set .entered_list$, "";
set .en_acc_list$, "";
// Configurations -----------------------------------------------------
// Time limit (in minutes)
// When time runs out, all players inside the room will be kicked out.
// Do NOT set this to zero!
set .timeout, 30;
// entrance fee (in Zeny)
set .register_cost, 200000000;
// exact amount of party members needed to start the game
set .register_min, 2;
// id of each mvp. you can add more
setarray .mvpid[1],
1086,// Golden Thief Bug 64
// 1651,// H.Wizz 99
1115,// Eddga 65
1150,// Moonlight Flower 67
1159,// Phreeoni 69
1112,// Drake 70
1583,// Tao Gunka 70
1492,// Incantation Samurai 71
1046,// Doppelgangger 72
// 1649,// H.Priest 99
1252,// Garm 73
1418,// Evil Snake Lord 73
1059,// Mistress 74
1190,// Orc Lord 74
// 1646,// Lord Knight 99
1087,// Orc Hero 77
1251,// Knight of Windstorm 77
1038,// Osiris 78
// 1658,// Ygnizem 79
// 1647,// Assassin X 99
1272,// Dark Lord 80
1871,// Fallen Bishop 80
1039,// Baphomet 81
1147,// Maya 81
// 1650,// Sniper Cecil 99
1785,// Atroce 82
1389,// Dracula 85
1630,// Bacsojin 85
1885,// Gorynych 85
1623,// RSX 0806 86
1511,// Amon Ra 88
// 1648,// Whitesmith 99
1688,// Lady Tanee 89
1768,// Gloom Under Night 89
1719,// Datale 90
1734,// Kiel D-01 90
1157,// Pharaoh 93
1373,// Lord of Death 94
1312,// Turtle General 97
1779,// Ktullanux 98
1874,// Beelzebub 98
// 1646,// Bio3 placeholder 99
1708,// Thanatos 99
1751,// Valkyrie Randgris 99
1832;// Ifrit 99
// number of rounds (default: 39)
//set .totalround, getarraysize(.mvpid) -1;
set .totalround, 30; //if you want 35 rounds
// item reward for completing each round
// set .round_item_id, 607;
// set .round_item_amount, 1;
// item reward for completing the entire ladder
set .finish_item_id, 12103;
set .finish_item_amount, 20;
// bonus reward if ladder completed within a certain time (in minutes)
set .bonus_time, 15; // if completed within 15 minutes, this reward is given
set .bonus_item_id, 12103;
set .bonus_item_amount, 5;
// time delay between rounds, in seconds (default: 3)
set .delay, 3;
// minimum GM level to reset the best record
set .gmlvlreset, 99;
// event map
set .eventmap$, "cguild_vs22";
// mapflag configuration
setarray .@mapflag,
mf_nowarp,
mf_nowarpto,
mf_nosave,
mf_nomemo,
mf_noteleport,
// mf_nopenalty, // disable exp loss
mf_noreturn,
// mf_nobranch,
// mf_nomobloot, // disable monster drop loots,
// mf_nomvploot, // 2 of these
// mf_nodrop,
mf_partylock;
// Config Ends --------------------------------------------------------------
mapannounce .eventmap$, "An administrator has refreshed the server. Please re-register. We apologize for the inconvenience.", bc_map;
getmapxy .map$, .x, .y, BL_NPC;
mapwarp .eventmap$, .map$, .x, .y;
killmonsterall .eventmap$;
.@size = getarraysize( .@mapflag );
for ( .@i = 0; .@i < .@size; .@i++ )
setmapflag .eventmap$, .@mapflag[.@i];
//waitingroom"Bloody Branch Quest",0;
end;
}
- script no_reins2 -1,{
OnPCLoadMapEvent:
if (strcharinfo(3) == "cguild_vs22" && ismounting() ) { setmounting(); }
}
cguild_vs22 mapflag loadevent
Now I'm not quite sure if I need to add another row into my table(maybe to record account_id?)
CREATE TABLE IF NOT EXISTS `bloody_branch` (
`unique_id` int(11) unsigned NOT NULL default '0',
`bloodybranch` varchar(30) NOT NULL default '',
PRIMARY KEY (`unique_id`)
) ENGINE=MyISAM;
Question
DR4LUC0N
So I have a script that checks for party members IP, but I'd like to also have it check their Unique_id(to prevent using a different PC without VPN and to prevent using same PC with VPN) I've been knocking my head on the table for an hour now trying to figure it out. I'm using SQL because I'm having the table get TRUNCATED at OnClock0000(couldn't find any other way to remove everyones variable).
//===== rAthena Script ======================================= //= MVP Ladder Game //===== By: ================================================== //= aftermath, AnnieRuru (rewrite) //===== Current Version: ===================================== //= 1.0 //===== Compatible With: ===================================== //= rAthena Project //===== Description: ========================================= //= Gather a party and kill every MVP in ascending order. //===== Additional Comments: ================================= //= 1.0 First version, edited. [Euphy] //============================================================ veil,81,134,6 script Quistis Trepe 10414,{ .gui = get_unique_id (); .@nb = query_sql("SELECT `bloodybranch` FROM `bloody_branch` WHERE `unique_id` = "+.gui+" LIMIT 1", .@bbq); mes "[Quistis Trepe]"; mes "Say... do you want to play the MvP Ladder game? It cost 15 Vote Coins Per person, total of 30 Vote Coins now to get in."; next; switch(select("Yes, let's get it on!:Information.:Show me the best record.:No.")) { case 1: if (.@bbq <= 0) { break; } else if (.@bbq >= 1) { mes "You have already completed the Bloody Branch Quest for today. Come back tomorrow after 12:00am server time."; close; } case 2: mes "[Quistis Trepe]"; mes "In this game, your party has to kill every single MvP monster in ascending order, from the weakest to strongest."; if ( .finish_item_amount ) mes "If your party can finish the MVP ladder game, each member will earn "+ callfunc("F_InsertPlural", .finish_item_amount, getitemname( .finish_item_id )) +"."; if ( .register_cost ) // mes "But the entrance fee is "+ callfunc( "F_InsertComma", .register_cost ) +" zeny."; mes "But the entrance fee is 15 vote coins per person, which means 30 Vote Coin total."; mes "Everyone need to vote on the websites to get 300 Vote Point, you can exchange them for 30 Vote Coins with the VoteForPoints Npc"; next; mes "[Quistis Trepe]"; mes "You lose the game if you can't finish in "+ .timeout +" minutes, or if your entire party is killed."; mes "Good luck!"; close; case 3: mes "[Quistis Trepe]"; if ( !$mvpladdderparty_time ) { mes "Nobody has finished this game yet."; close; } mes "The best record is"; mes "[ "+( $mvpladdderparty_time / 60 )+" min "+( $mvpladdderparty_time % 60 )+" sec ]"; mes "By the party ^FF0000"+ $mvpladdderparty_name$ +"^000000."; .@size = getarraysize( $mvpladderparty_member$ ); for ( .@i = 0; .@i < .@size; .@i++ ) mes "^000000"+ ( .@i +1 ) +". ^0000FF"+ $mvpladderparty_member$[.@i]; if ( getgmlevel() < .gmlvlreset ) close; next; if ( select( "Close.", "Reset the record." ) == 1 ) close; if ( select( "Never mind.", "I really want to reset it." ) == 1 ) close; $mvpladdderparty_time = 0; $mvpladdderparty_name$ = ""; deletearray $mvpladderparty_member$[.@i]; mes "[Quistis Trepe]"; mes "Record reset successfully."; close; case 4: mes "[Quistis Trepe]"; mes "When you are strong enough to complete the game, please come back."; close; } if ( !getcharid(1) ) { mes "[Quistis Trepe]"; mes "You have to form a party to play."; close; } if ( is_party_leader() == false ) { mes "[Quistis Trepe]"; mes "Only the party leader can register."; close; } .@origin = getcharid(3); getpartymember getcharid(1),1; getpartymember getcharid(1),2; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if (isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) == 0) continue;{ .@class = readparam( Class, $@partymembercid[.@i] ); if (compare( .@job_list$, "|" + .@class + "|" ) == 1) { mes "Sorry, only one " + jobname(.@class) + " is allowed."; close; } .@job_list$ += "|" + .@class + "|"; .@online++; } } // START OF NEW CHECK - [Duplicate IP in one party?] attachrid .@origin; // for IP check set .@party_list$, ""; set .@done_list$, ""; set .@dupli, 0; // Check Party Members for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if (isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) == 0) continue;{ attachrid $@partymemberaid[.@i]; query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`=" + $@partymemberaid[.@i] + "", .@ipd$); // If same IP is on party if(compare(.@party_list$, "|" + .@ipd$ + "|" ) == 1) { set .@dupli, 1; } else // Add IP to party list for checking .@party_list$ += "|" + .@ipd$ + "|"; // If acc has entered ladder if (compare( .en_acc_list$, "|" + getcharid(3,strcharinfo(0)) + "|" ) == 1) { if(.@done_list$ == "") .@done_list$ += strcharinfo(0); else .@done_list$ += ", " + strcharinfo(0); } } } // Get back to PTL to display message attachrid .@origin; if(.@dupli) { mes "Sorry, party members with the same IP address can't enter."; close; } if(.@done_list$ != "") { mes "Sorry, the following people has already entered the ladder today:"; mes .@done_list$; close; } // END OF NEW CHECK else if ( $@partymembercount != .register_min ) { mes "[Quistis Trepe]"; mes "You have to form a party with exactly "+ .register_min +" different classes members to play."; close; } else if ( .@online != .register_min ) { mes "[Quistis Trepe]"; mes "Your party must have "+ .register_min +" members online on map '"+ strnpcinfo(4) +"'."; close; } else if (countitem(34207) < 15) { mes "[Quistis Trepe]"; mes "You don't have 15 vote coins. Please come back when you do."; close; } // PTL has 5 miths, check for other pt members else if (countitem(34207) > 14) { for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { attachrid $@partymemberaid[.@i]; if (countitem(34207) < 15) { attachrid .@origin; mes "[Quistis Trepe]"; mes "You don't have 15 Vote Points. Please come back when you do."; close; } } attachrid .@origin; } if ( .party_id ) { mes "[Quistis Trepe]"; mes "I'm sorry, but a party is currently playing the game. Please standby until the party is finished."; mes "Thank you."; close; } announce "The party ["+ strcharinfo(1) +"] has started the MvP ladder game.", bc_all; // Delete mithril coins for each PT member for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { attachrid $@partymemberaid[.@i]; delitem 34207,15; } attachrid .@origin; set .party_id, getcharid(1); set .@time_enter, gettimetick(2); for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { attachrid $@partymemberaid[.@i]; if ( strcharinfo(3) == strnpcinfo(4) ) { announce "You have "+ .timeout +" minutes to complete "+ .totalround +" rounds.", bc_self; .@name$[.@c] = strcharinfo(0); .@c++; } } } cleanmap .eventmap$; warpparty .eventmap$, 0,0, .party_id, strnpcinfo(4); attachrid .@origin; mes "hello"; donpcevent strnpcinfo(0)+"::OnMvpDead"; sleep .timeout * 60000; if ( .round == .totalround +1 ) { getpartymember .party_id, 1; getpartymember .party_id, 2; mapannounce .eventmap$, "Congratulations... You were able to defeat all the MVPs!", bc_map; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { attachrid $@partymemberaid[.@i]; query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`=" + $@partymemberaid[.@i] + "", .@ipd$); if ( strcharinfo(3) == .eventmap$ ) getitem .finish_item_id, .finish_item_amount; query_sql( "INSERT INTO `bloody_branch` VALUES ("+.gui+", 1)"); .entered_list$ += "|" + .@ipd$ + "|"; .en_acc_list$ += "|" + getcharid(3,strcharinfo(0)) + "|"; } } set .@rid , getcharid(3,strcharinfo(0)); addrid (2,0,getcharid(1)); //attach the rid of all players in the group set questdelay,gettimetick(2)+86400; //set the delay for all players in group detachrid; attachrid(.@rid); //so that the rest of the script will only run on the party leader set .@timeused, gettimetick(2) - .@time_enter; if ( .bonus_item_amount && .@timeused < .bonus_time * 60 ) { mapannounce .eventmap$, "You are rewarded a bonus item for completing the ladder within "+ .bonus_time +" minutes.", bc_map; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { attachrid $@partymemberaid[.@i]; if ( strcharinfo(3) == .eventmap$ ) getitem .bonus_item_id, .bonus_item_amount; } } } if ( !$mvpladdderparty_time || .@timeused < $mvpladdderparty_time ) { mapannounce .eventmap$, "And you broke the record! [ "+( .@timeused / 60 )+" min "+( .@timeused % 60 )+" sec ]", bc_map; set $mvpladdderparty_time, .@timeused; set $mvpladdderparty_name$, getpartyname( .party_id ); copyarray $mvpladderparty_member$, .@name$, .register_min; } else mapannounce .eventmap$, "Time used [ "+( .@timeused / 60 )+" min "+( .@timeused % 60 )+" sec ]", bc_map; sleep 10000; announce "Player ["+ .@name$ +"] of the party ["+ getpartyname( .party_id ) +"] has finished the Bloody Branch Quest!", bc_all; } else announce "Player ["+ .@name$ +"] of the party ["+ getpartyname( .party_id ) +"] has failed to finish the MvP ladder game.", bc_all; mapwarp .eventmap$, .map$, .x, .y; killmonsterall .eventmap$; .party_id = .round = 0; end; OnMvpDead: getpartymember .party_id, 1; getpartymember .party_id, 2; .round++; if ( .round >= 2 && .round != .totalround +1 && .round_item_amount ) { for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { attachrid $@partymemberaid[.@i]; if ( strcharinfo(3) == .eventmap$ ) getitem .round_item_id, .round_item_amount; } } } if ( .round == .totalround +1 ) { awake strnpcinfo(0); end; } else if ( .round == .totalround ) mapannounce .eventmap$, "The final Round will begin in "+ .delay +" seconds...", bc_map; else mapannounce .eventmap$, "Starting round "+ .round +" in "+ .delay +" seconds...", bc_map; sleep .delay * 1000; if ( .mvpid[.round] == 1646 ) // pick random Bio3 MVP .mvpid[.round] = rand(1646,1651); monster .eventmap$,0,0, "--ja--", .mvpid[.round], 1, strnpcinfo(0)+"::OnMvpDead"; mapannounce .eventmap$, getmonsterinfo( .mvpid[.round], MOB_NAME ) +" has spawned!", bc_map|bc_blue; end; OnPCLogoutEvent: if ( hp > 0 ) .@less_one = 1; else end; OnPCDieEvent: if ( strcharinfo(3) != .eventmap$ || !getcharid(1) ) end; if ( getcharid(1) != .party_id ) end; getpartymember .party_id, 1; getpartymember .party_id, 2; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { attachrid $@partymemberaid[.@i]; if ( strcharinfo(3) == .eventmap$ && hp > 0 ) .@alive++; } } if ( .@less_one ) .@alive--; if ( !.@alive ) { mapannounce .eventmap$, "Party wiped!", bc_map; sleep 10000; awake strnpcinfo(0); } end; OnClock0000: set .entered_list$, ""; set .en_acc_list$, ""; query_sql "truncate table bloody_branch"; end; OnInit: set .entered_list$, ""; set .en_acc_list$, ""; // Configurations ----------------------------------------------------- // Time limit (in minutes) // When time runs out, all players inside the room will be kicked out. // Do NOT set this to zero! set .timeout, 30; // entrance fee (in Zeny) set .register_cost, 200000000; // exact amount of party members needed to start the game set .register_min, 2; // id of each mvp. you can add more setarray .mvpid[1], 1086,// Golden Thief Bug 64 // 1651,// H.Wizz 99 1115,// Eddga 65 1150,// Moonlight Flower 67 1159,// Phreeoni 69 1112,// Drake 70 1583,// Tao Gunka 70 1492,// Incantation Samurai 71 1046,// Doppelgangger 72 // 1649,// H.Priest 99 1252,// Garm 73 1418,// Evil Snake Lord 73 1059,// Mistress 74 1190,// Orc Lord 74 // 1646,// Lord Knight 99 1087,// Orc Hero 77 1251,// Knight of Windstorm 77 1038,// Osiris 78 // 1658,// Ygnizem 79 // 1647,// Assassin X 99 1272,// Dark Lord 80 1871,// Fallen Bishop 80 1039,// Baphomet 81 1147,// Maya 81 // 1650,// Sniper Cecil 99 1785,// Atroce 82 1389,// Dracula 85 1630,// Bacsojin 85 1885,// Gorynych 85 1623,// RSX 0806 86 1511,// Amon Ra 88 // 1648,// Whitesmith 99 1688,// Lady Tanee 89 1768,// Gloom Under Night 89 1719,// Datale 90 1734,// Kiel D-01 90 1157,// Pharaoh 93 1373,// Lord of Death 94 1312,// Turtle General 97 1779,// Ktullanux 98 1874,// Beelzebub 98 // 1646,// Bio3 placeholder 99 1708,// Thanatos 99 1751,// Valkyrie Randgris 99 1832;// Ifrit 99 // number of rounds (default: 39) //set .totalround, getarraysize(.mvpid) -1; set .totalround, 30; //if you want 35 rounds // item reward for completing each round // set .round_item_id, 607; // set .round_item_amount, 1; // item reward for completing the entire ladder set .finish_item_id, 12103; set .finish_item_amount, 20; // bonus reward if ladder completed within a certain time (in minutes) set .bonus_time, 15; // if completed within 15 minutes, this reward is given set .bonus_item_id, 12103; set .bonus_item_amount, 5; // time delay between rounds, in seconds (default: 3) set .delay, 3; // minimum GM level to reset the best record set .gmlvlreset, 99; // event map set .eventmap$, "cguild_vs22"; // mapflag configuration setarray .@mapflag, mf_nowarp, mf_nowarpto, mf_nosave, mf_nomemo, mf_noteleport, // mf_nopenalty, // disable exp loss mf_noreturn, // mf_nobranch, // mf_nomobloot, // disable monster drop loots, // mf_nomvploot, // 2 of these // mf_nodrop, mf_partylock; // Config Ends -------------------------------------------------------------- mapannounce .eventmap$, "An administrator has refreshed the server. Please re-register. We apologize for the inconvenience.", bc_map; getmapxy .map$, .x, .y, BL_NPC; mapwarp .eventmap$, .map$, .x, .y; killmonsterall .eventmap$; .@size = getarraysize( .@mapflag ); for ( .@i = 0; .@i < .@size; .@i++ ) setmapflag .eventmap$, .@mapflag[.@i]; //waitingroom"Bloody Branch Quest",0; end; } - script no_reins2 -1,{ OnPCLoadMapEvent: if (strcharinfo(3) == "cguild_vs22" && ismounting() ) { setmounting(); } } cguild_vs22 mapflag loadevent
Now I'm not quite sure if I need to add another row into my table(maybe to record account_id?)
CREATE TABLE IF NOT EXISTS `bloody_branch` ( `unique_id` int(11) unsigned NOT NULL default '0', `bloodybranch` varchar(30) NOT NULL default '', PRIMARY KEY (`unique_id`) ) ENGINE=MyISAM;
I greatly appreciate any and all help.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.