Jump to content
  • 0

Would someone mind helping me check party member IP and UID?


DR4LUC0N

Question


  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   6
  • Joined:  04/04/12
  • Last Seen:  

So the original code is 

// 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

This checks the party member is the same IP as party leader.

But I'm also trying to check to see if the party member has done the event before using uniqueID, here's my attempt.

// START OF NEW CHECK - [Duplicate IP in one party?]
	attachrid .@origin;
	// for IP check
	set .@party_list$, "";
	set .@done_list$, "";
	set .@dupli, 0;
	set .@done, 0;
	
	// Check Party Members
	for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
		if (isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) == 0)
		continue;{
			attachrid $@partymemberaid[.@i];
			.@lip = query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`=" + $@partymemberaid[.@i] + "", .@ipd$);
			.@pmu = query_sql("SELECT last_unique_id FROM `login` WHERE account_id ="+$@partymemberaid[.@i]+"", .@party_mem_uid$);
			.@gpmu = query_sql("SELECT `dailybbq` FROM `bloody_branch_uid` WHERE `unique_id` = "+.@party_mem_uid$+" LIMIT 1", .@pmbbq$);
			.@cip = compare(.@party_list$, "|" + .@ipd$ + "|" )
			.@cuid = compare(.@party_list$, "|" + .@pmbbq$ + "|" )
			
			//Check party member UniqueID and see if they have completed for the day.
			if(.@cip == 0 && .@cuid == 1) {
			set .@done, 1;
			}
			// If same IP is on party
			else if(.@cip == 1 && .@cuid == 0) {
			set .@dupli, 1;
			}			
			else if(.@cip == 0 && .@cuid == 0) {
				// Add IP to party list for checking
				.@party_list$ += "|" + .@ipd$ + "|";
				// Add Unique_ID to party list for checking
				.@party_list$ += "|" + .@pmbbq$ + "|";
			}
			
			// 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(.@done) {
		mes "A party member has completed the Bloody branch Quest today.";
		close;
	}
	
	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

Could someone help me in this please?

Edited by DR4LUC0N
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

// START OF NEW CHECK - [Duplicate IP in one party?]
	attachrid .@origin;

	// Check Party Members
	.@p = getcharid(1);
	if (.@p == 0)
	{
		mes "you have no party";
		close;
	}
	getpartymember .@p, 2, .@aid;
	.@count = $@partymembercount;
	
	// make sure there is no pause between the check and collected party member data
	// like script command next, select, prompt, sleep2, sleep.
	for (.@i = 0; .@i < .@count; .@i++)
	{
		// no need to check with isloggedin anymore,
		// if failed to attach meaning the party member / player isn't online,
		// since only one char in account id can online at one time.
		if (attachrid(.@aid[.@i]) == true)
		{
			// getcharip() script command was there in the script engine, why query?
			.@ip$ = getcharip();

			 // script for you self? if use gepard do not bother using query,
			 // get_unique_id() should be there in the script engine, why query?
			.@guid = get_unique_id();
			
			// check ip duplicate
			if ((.@j = inarray(.@iplist$, .@ip$)) > -1)
				.@iplist_$[getarraysize(.@iplist_$)] = strcharinfo(0);
			else
				.@iplist$[getarraysize(.@iplist$)] = .@ip$;
			
			// check gepard unique id duplicate
			if ((.@j = inarray(.@guidlist, .@guid)) > -1)
				.@guidlist$[getarraysize(.@guidlist$)] = strcharinfo(0);
			else
				.@guidlist[getarraysize[.@guidlist]] = .@guid;
		}	
	}
	
	// Get back to party leader to display message
	attachrid .@origin;
	
	if (getarraysize(.@iplist_$))
	{
		mes "There is party member that found with same ip they are "+ implode(.@iplist$, ",");
		close;
	}
	if (getarraysize(.@guidlist$))
	{
		mes "There is party member that found with same pc they are "+ implode(.@guidlist$, ",");
		close;
	}
// END OF NEW CHECK

 

Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  439
  • Reputation:   29
  • Joined:  12/08/11
  • Last Seen:  

Please refer to my reply and ignore my suggestion at the bottom. I already mentioned that the script already offers a uid check, you just have to reuse it.

 

veil,81,134,6	script	Quistis Trepe	10414,{
	.gui = get_unique_id ();
	.@nb = query_sql("SELECT `dailybbq` FROM `bloody_branch_uid` 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;
			}

 

Here's the line of codes that verify party members' IP

			//Check party member UniqueID and see if they have completed for the day.
			if(.@cip == 0 && .@cuid == 1) {
			set .@done, 1;
			}
			// If same IP is on party
			else if(.@cip == 1 && .@cuid == 0) {
			set .@dupli, 1;
			}			
			else if(.@cip == 0 && .@cuid == 0) {
				// Add IP to party list for checking
				.@party_list$ += "|" + .@ipd$ + "|";
				// Add Unique_ID to party list for checking
				.@party_list$ += "|" + .@pmbbq$ + "|";
			}

After this, all you have to do was to reuse/insert the uid check.

...and you already did the first few lines

			.@pmu = query_sql("SELECT last_unique_id FROM `login` WHERE account_id ="+$@partymemberaid[.@i]+"", .@party_mem_uid$);
			.@gpmu = query_sql("SELECT `dailybbq` FROM `bloody_branch_uid` WHERE `unique_id` = "+.@party_mem_uid$+" LIMIT 1", .@pmbbq$);

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   6
  • Joined:  04/04/12
  • Last Seen:  

On 6/21/2021 at 11:35 AM, Litro Endemic said:
// START OF NEW CHECK - [Duplicate IP in one party?]
	attachrid .@origin;

	// Check Party Members
	.@p = getcharid(1);
	if (.@p == 0)
	{
		mes "you have no party";
		close;
	}
	getpartymember .@p, 2, .@aid;
	.@count = $@partymembercount;
	
	// make sure there is no pause between the check and collected party member data
	// like script command next, select, prompt, sleep2, sleep.
	for (.@i = 0; .@i < .@count; .@i++)
	{
		// no need to check with isloggedin anymore,
		// if failed to attach meaning the party member / player isn't online,
		// since only one char in account id can online at one time.
		if (attachrid(.@aid[.@i]) == true)
		{
			// getcharip() script command was there in the script engine, why query?
			.@ip$ = getcharip();

			 // script for you self? if use gepard do not bother using query,
			 // get_unique_id() should be there in the script engine, why query?
			.@guid = get_unique_id();
			
			// check ip duplicate
			if ((.@j = inarray(.@iplist$, .@ip$)) > -1)
				.@iplist_$[getarraysize(.@iplist_$)] = strcharinfo(0);
			else
				.@iplist$[getarraysize(.@iplist$)] = .@ip$;
			
			// check gepard unique id duplicate
			if ((.@j = inarray(.@guidlist, .@guid)) > -1)
				.@guidlist$[getarraysize(.@guidlist$)] = strcharinfo(0);
			else
				.@guidlist[getarraysize[.@guidlist]] = .@guid;
		}	
	}
	
	// Get back to party leader to display message
	attachrid .@origin;
	
	if (getarraysize(.@iplist_$))
	{
		mes "There is party member that found with same ip they are "+ implode(.@iplist$, ",");
		close;
	}
	if (getarraysize(.@guidlist$))
	{
		mes "There is party member that found with same pc they are "+ implode(.@guidlist$, ",");
		close;
	}
// END OF NEW CHECK

 

Thank you for helping! The reason for the SQL is because it gets emptied every day so they can go back in the next. As far as I know there's not a way to remove a gepard unique_id variable without talking to an NPC, so I found it to be easier to use a SQL to keep track and delete it daily(I have an OnClock for this towards the end of the script.). But you're clearly much better at this then I am and that's why I came here for help because I'm unsure where to go from here.

 

Basically if the party member IP isn't the same(stopping dual client or same IP party members from entering) and making sure the party members haven't entered in the event before. Here's the actual script for better reference.

//===== 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 `dailybbq` FROM `bloody_branch_uid` 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 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;
	set .@done, 0;
	
	// Check Party Members
	for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
		if (isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) == 0)
		continue;{
			attachrid $@partymemberaid[.@i];
			.@lip = query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`=" + $@partymemberaid[.@i] + "", .@ipd$);
			.@pmu = query_sql("SELECT last_unique_id FROM `login` WHERE account_id ="+$@partymemberaid[.@i]+"", .@party_mem_uid$);
			.@gpmu = query_sql("SELECT `dailybbq` FROM `bloody_branch_uid` WHERE `unique_id` = "+.@party_mem_uid$+" LIMIT 1", .@pmbbq$);
			.@cip = compare(.@party_list$, "|" + .@ipd$ + "|" )
			.@cuid = compare(.@party_list$, "|" + .@pmbbq$ + "|" )
			
			//Check party member UniqueID and see if they have completed for the day.
			if(.@cip == 0 && .@cuid == 1) {
			set .@done, 1;
			}
			// If same IP is on party
			else if(.@cip == 1 && .@cuid == 0) {
			set .@dupli, 1;
			}			
			else if(.@cip == 0 && .@cuid == 0) {
				// Add IP to party list for checking
				.@party_list$ += "|" + .@ipd$ + "|";
				// Add Unique_ID to party list for checking
				.@party_list$ += "|" + .@pmbbq$ + "|";
			}
			
			// 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(.@done) {
		mes "A party member has completed the Bloody branch Quest today.";
		close;
	}
	
	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 "Someone in the party doesn't have 15 vote coins.";
		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];
				if
				query_sql("SELECT last_unique_id FROM `login` WHERE account_id ="+$@partymemberaid[.@i]+"", .@party_mem_uid_done$);
				query_sql( "INSERT INTO `bloody_branch_uid` VALUES ("+.@party_mem_uid_done$+", 1)");
				query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`=" + $@partymemberaid[.@i] + "", .@ipd$);
				if ( strcharinfo(3) == .eventmap$ )
					getitem .finish_item_id, .finish_item_amount;
				.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,0;
	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( "DELETE FROM `bloody_branch_uid` WHERE `dailybbq` = '1'" );
//	query_sql "truncate table bloody_branch_uid";
	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, 2; //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;
	
	// teleport map that the player warps to after they finish the quest
//	set .Map$,"veil";
//	set .x,120;
//	set .y,105;
	

	// 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;
}

veil_guide,81,134,6	duplicate(Quistis Trepe)	Quistis Trepe#Guides	10414


-	script	sqlresetter	-1,{
OnCommand: //Add event on the start of your npc
	dispbottom "BBQ sql has been reset for testing purpose.";
	query_sql( "DELETE FROM `bloody_branch_uid` WHERE `dailybbq` = '1'" );
end;

OnInit:
	bindatcmd "sql",strnpcinfo(3) + "::OnCommand";
end;
}


-	script	no_reins2	-1,{
OnPCLoadMapEvent:
if (strcharinfo(3) == "cguild_vs22" && ismounting() ) { setmounting(); }
}
cguild_vs22	mapflag	loadevent

 

 

On 6/25/2021 at 1:10 AM, Magnetix said:

Please refer to my reply and ignore my suggestion at the bottom. I already mentioned that the script already offers a uid check, you just have to reuse it.

 

veil,81,134,6	script	Quistis Trepe	10414,{
	.gui = get_unique_id ();
	.@nb = query_sql("SELECT `dailybbq` FROM `bloody_branch_uid` 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;
			}

 

Here's the line of codes that verify party members' IP

			//Check party member UniqueID and see if they have completed for the day.
			if(.@cip == 0 && .@cuid == 1) {
			set .@done, 1;
			}
			// If same IP is on party
			else if(.@cip == 1 && .@cuid == 0) {
			set .@dupli, 1;
			}			
			else if(.@cip == 0 && .@cuid == 0) {
				// Add IP to party list for checking
				.@party_list$ += "|" + .@ipd$ + "|";
				// Add Unique_ID to party list for checking
				.@party_list$ += "|" + .@pmbbq$ + "|";
			}

After this, all you have to do was to reuse/insert the uid check.

...and you already did the first few lines

			.@pmu = query_sql("SELECT last_unique_id FROM `login` WHERE account_id ="+$@partymemberaid[.@i]+"", .@party_mem_uid$);
			.@gpmu = query_sql("SELECT `dailybbq` FROM `bloody_branch_uid` WHERE `unique_id` = "+.@party_mem_uid$+" LIMIT 1", .@pmbbq$);

 

Sorry for the late reply. What about the part where the event is complete, is that proper to input both the leader and member? 

Edited by DR4LUC0N
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...