Jump to content
  • 0

Auto Reward 3x Guilds


Mahiro

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   10
  • Joined:  08/02/18
  • Last Seen:  

Hi,


next I'm trying to make in DAY X, TIME X, the script below happens. So far so good.


The problem starts when I'm trying to get the ID all three different Guild characters to send everyone email with items, but that does not happen he just delivers to everyone from the first Guild, and ignores the other two.


I believe the problem is in SQL Query

if someone can give help, tell me where I'm wrong thank you ^^

 

PS: It's been a while since I started scripting so let's take it easy

 

if(gettime(DT_DAYOFMONTH) == 16){
	OnClock2127:
	query_sql "UPDATE `rwoe` SET `kd`= (`kills`-`deaths`) WHERE `rwoe`.`guild_id` >=1";
	query_sql "SELECT `guild_id` FROM `rwoe` ORDER BY `kd` DESC LIMIT 3",.@guild_id;
	query_sql "SELECT `char_id` FROM `char` WHERE `guild_id`="+.@guild_id+"",.@charid;
	for(.@i=0; .@i<getarraysize(.@charid); .@i++) {
	.@sender$ = "1";
	.@title$ = "1";
	.@body$ = "1";
	.@zeny = 0;
	setarray .@mailitem[0], 607, 608, 609, 610; 
	setarray .@mailamount[0], 10, 5, 1, 1; 
	setarray .@mailcard0[0], 0, 0, 0, 0;  
	setarray .@mailcard1[0], 0, 0, 0, 0; 
	setarray .@mailcard2[0], 0, 0, 0, 0; 
	// EMAIL
	mail .@charid[.@i], .@sender$, .@title$, .@body$, .@zeny, .@mailitem, .@mailamount, .@mailcard0, .@mailcard1, .@mailcard2;
	}
	end;
	}

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   10
  • Joined:  08/02/18
  • Last Seen:  

3 hours ago, Sehrentos said:

Hey, you can do one extra for loop for the .@guild_id too.

Well I tried like that but it failed.
I've been giving a search to try via SQL and it worked out fine:

 

query_sql "SELECT `guild_id` FROM `rwoe` ORDER BY `kd` DESC LIMIT 3",.@guild_id;
	for(.@i=0; .@i<getarraysize(.@guild_id); .@i++){
	query_sql "UPDATE rwoe SET ord = "+(.@i+1)+" WHERE guild_id="+.@guild_id[.@i]+"";
	}
	query_sql "SELECT `guild_id`,`ord` FROM `rwoe` WHERE `ord`=1",.@guild_id1,.@top1;	// G1
	query_sql "SELECT `guild_id`,`ord` FROM `rwoe` WHERE `ord`=2",.@guild_id2,.@top2;	// G2
	query_sql "SELECT `guild_id`,`ord` FROM `rwoe` WHERE `ord`=3",.@guild_id3,.@top3;	// G3

soon after I joined with an If:

if(.@top1 == 1){	// TOP 1
	query_sql "SELECT `char_id` FROM `char` WHERE `guild_id`="+.@guild_id1+"",.@charid;
	for(.@i=0; .@i<getarraysize(.@charid); .@i++) {
	.@sender$ = "1";
	.@title$ = "1";
	.@body$ = "1";
	.@zeny = 0;
	setarray .@mailitem[0], 607, 608, 609, 613;
	setarray .@mailamount[0], 10, 5, 1, 1; 
	setarray .@mailcard0[0], 0, 0, 0, 0; 
	setarray .@mailcard1[0], 0, 0, 0, 0; 
	setarray .@mailcard2[0], 0, 0, 0, 0; 
	mail .@charid[.@i], .@sender$, .@title$, .@body$, .@zeny, .@mailitem, .@mailamount, .@mailcard0, .@mailcard1, .@mailcard2;
	}

One for each TOP.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

On 9/17/2018 at 3:36 AM, Mahiro said:

for(.@i=0; .@i<getarraysize(.@charid); .@i++)

Hey, you can do one extra for loop for the .@guild_id too.

  • Upvote 1
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...