Jump to content
  • 0

Help with KOE Auto reward, reward script not working


BabaVoss

Question


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.03
  • Content Count:  79
  • Reputation:   0
  • Joined:  06/17/20
  • Last Seen:  

//=============================== Reward Engine ===============================//
OnRewardHolder:
	set .@sql$, ((.Options&4)?"position = 0":"online = 1");
	freeloop(1);
		set .@gid, getarg(0);
		set .@size, query_sql ("SELECT `account_id`, `char_id` FROM `guild_member` WHERE `guild_id` = '"+.@gid+"' AND "+.@sql$,.@aid,.@cid);
		for(set .@j,0; .@j<.@size; set .@j,.@j+1) {
			if ((.Options&8) && !(.Options&4)) {
				set .@ip$, replacestr(getcharip(.@aid[.@j]),".","a");
				if (getd(".@ip_"+.@i+"_"+.@ip$)) continue;
				setd ".@ip_"+.@i+"_"+.@ip$,1;
			}
			if (isloggedin(.@aid[.@j])) {
				for(set .@k,0; .@k<getarraysize(.holderprize); set .@k,.@k+2)
					getitem .holderprize[.@k], .holderprize[.@k+1], .@aid[.@j];
				message rid2name(.@aid[.@j]),"You have been rewarded for being part of the guild at "+callsub(OnKoeMap)+" King of Emperium.";
			}
		}
	return;	

OnRewardDefender:
	set .@sql$, ((.Options&4)?"position = 0":"online = 1");
	freeloop(1);
		set .@gid, getarg(0);
		set .@size, query_sql ("SELECT `account_id`, `char_id` FROM `guild_member` WHERE `guild_id` = '"+.@gid+"' AND "+.@sql$,.@aid,.@cid);
		for(set .@j,0; .@j<.@size; set .@j,.@j+1) {
			if ((.Options&8) && !(.Options&4)) {
				set .@ip$, replacestr(getcharip(.@aid[.@j]),".","a");
				if (getd(".@ip_"+.@i+"_"+.@ip$)) continue;
				setd ".@ip_"+.@i+"_"+.@ip$,1;
			}
			if (isloggedin(.@aid[.@j])) {
				for(set .@k,0; .@k<getarraysize(.defenderprize); set .@k,.@k+2)
					getitem .defenderprize[.@k], .defenderprize[.@k+1], .@aid[.@j];
				message rid2name(.@aid[.@j]),"You have been rewarded for gracefully defending your Emperium "+callsub(OnKoeMap)+" King of Emperium.";
			}
		}
	freeloop(0);
	return;
	
OnRewardBoth:
	set .@sql$, ((.Options&4)?"position = 0":"online = 1");
	freeloop(1);
		set .@gid, getarg(0);
		set .@size, query_sql ("SELECT `account_id`, `char_id` FROM `guild_member` WHERE `guild_id` = '"+.@gid+"' AND "+.@sql$,.@aid,.@cid);
		for(set .@j,0; .@j<.@size; set .@j,.@j+1) {
			if ((.Options&8) && !(.Options&4)) {
				set .@ip$, replacestr(getcharip(.@aid[.@j]),".","a");
				if (getd(".@ip_"+.@i+"_"+.@ip$)) continue;
				setd ".@ip_"+.@i+"_"+.@ip$,1;
			}
			if (isloggedin(.@aid[.@j])) {
				for(set .@k,0; .@k<getarraysize(.bothprize); set .@k,.@k+2)
					getitem .bothprize[.@k], .bothprize[.@k+1], .@aid[.@j];
				message rid2name(.@aid[.@j]),"You have been rewarded for being a part of the best defender guild and King Of Emperium Holder at "+callsub(OnKoeMap)+".";
			}
		}
	freeloop(0);
	return;	
	
OnKoeMap:
	for(.@i=0;.@i<getarraysize(.maps$);.@i+=2)
		if(.maps$[.@i]==strnpcinfo(2))
			return .maps$[.@i+1];
return;

and this error mes appears, pls help thank you in advance.image.thumb.png.6bf561d713e3d39cad8792bb502a1807.png

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

may refer this post for guide to fix the account_id issue.

https://rathena.org/board/topic/131467-need-help-sql-db-error-pls-thanks/#comment-407968

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  98
  • Reputation:   74
  • Joined:  12/04/14
  • Last Seen:  

So many errors in this script.

* SQL `guild_member` table doesn't have `account_id`

* "getarraysize(.holderprize)" you should not use item ID as array size, ItemID is way too big for this

* same with the "getarraysize(.defenderprize)" and "getarraysize(.bothprize)"

* freeloop - you don't need to activate freeloop if you use the correct size for getarraysize since max guild member is only 50 (by default).

* getitem - this function only requires 2 values ( getitem item ID, Amount; ). Making  "getitem .bothprize[.@k], .bothprize[.@k+1], .@aid[.@j];" is too much.

 

 

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