Jump to content
  • 0
Sign in to follow this  
dfabsgwapings

Get Party Member Account ID HELP

Question

Hi everyone can any help me on how to figure this out?

All party member will start having 20 tickets. If they accept a certain task all party members ticket will reduced by one and the gettimetick will attach to each party member.

 

please help me fix this. Thanks

 

.@party_id = getcharid(1);
	getpartymember .@party_id, 1;
	getpartymember .@party_id, 2;
	for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
		set .@nb,query_sql("SELECT ticket,time FROM rdc WHERE account_id = "+$@partymemberaid[.@i]+"", .ticket,.time );
		if ( .ticket[.@i] == 20 ){
			set .time[.@i],gettimetick(2) + 604800;
			set .ticket[.@i],.ticket[.@i] - 1;
			query_sql("UPDATE `rdc` SET `time` = '"+.time[.@i]+"', `ticket` = '"+.ticket[.@i]+"' WHERE account_id = "+$@partymemberaid[.@i]+"");
		} else {
			set .ticket[.@i],.ticket[.@i] - 1;
			query_sql("UPDATE `rdc` SET `ticket` = '"+.ticket[.@i]+"' WHERE account_id = "+$@partymemberaid[.@i]+"");
		}
		callfunc "InstDrake";
	}

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Until you are using additional sql tables for specific reasons, you don't need the usage of a query to update the values for every party member, you can use attachrid() script command instead of that to loop over every party member. Example:

 

	.@char_id = getcharid(CHAR_ID_CHAR);
	.@party_id = getcharid(CHAR_ID_PARTY);
	getpartymember .@party_id, 2;
	for (.@i = 0; .@i < $@partymembercount; ++.@i) {
		if (attachrid($@partymemberaid[.@i])) {
			if (ticket) {
				--ticket;
				time = gettimetick(2) + 604800;
			} else
				message strcharinfo(PC_NAME), "You don't have more tickets";
		}
	}
	attachrid(.@char_id);
 

In that example, you will be attaching the script for every party member and then discount 1 ticket and set time variable if him has a ticket, otherwise it will bring the message that don't have more tickets. And then, return to the original party member who activates the script.

 

In the script that you post, you have this query:

 

		.@nb = query_sql("SELECT ticket,time FROM rdc WHERE account_id = "+$@partymemberaid[.@i]+"", .ticket,.time );
 

If so, you are setting to pick every character from the account of the party member looped, because you are selecting every record where account_id it's equal to the id of the party member's account id. Maybe you are trying to gather all the members of the party registered in that table, but if so, you should select every record with party id value to gather only party members.

 

Make the registration process with query sql would give you the chance to discount ticket to every party member, even those who are not logged in on the time when the registration is doned, or even those who are outside of the game party but flaged in your database as in the same agrupation (like a kind of clan or something). However, I suggest you to use attachrid() instead, since it's easier to manage.

 

Please remember to assignment vars directly instead of use set command, because set command is deprecated in Hercules and may be removed in any future time.

 

R418.109263

Edited by Ragno

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.