Jump to content
  • 0

how to limit this Gstorage Log to 30 only?


iconrag

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.01
  • Content Count:  5
  • Reputation:   0
  • Joined:  09/03/22
  • Last Seen:  

		case 4:
			if(!getcharid(2)){
				mes "you don't have guild";
				close;
			}
			if(!guild_has_permission(GUILD_PERM_STORAGE)){
				mes "you don't have permission for the guild storage";
				close;
			}
			query_sql("SELECT `time`,`name`,`nameid`,`amount` FROM `guild_storage_log` WHERE `guild_id` = '" + getcharid(2) + "' order by `id` ASC", .@time$ ,.@name$,.@item_id,.@amount);
			if(!.@item_id){
				mes "there is no log yet";
				close;
			}
			dispbottom "=========================================================",0xFFD64F;
			dispbottom "===================== Guild Storage Log =======================",0xFFD64F;
			dispbottom "=========================================================",0xFFD64F;
			for(.@i=0;.@i<getarraysize(.@item_id);.@i++)
				dispbottom .@time$[.@i] + " Player[" + .@name$[.@i] + "] Item Name[" + getitemname(.@item_id[.@i]) + "] Item Amount[" + .@amount[.@i] + "]",((.@amount[.@i] > 0)?0x03c6fc:0xFF0000);
			dispbottom "=========================================================",0xFFD64F;


Hello guys, Need help
i want to make this Guild Storage Logs show 30 last Logs Only
can someone help me ?
thanks

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  663
  • Reputation:   671
  • Joined:  11/12/12
  • Last Seen:  

Change the query to do just that, and reverse the output displayed to the player.

			.@count = query_sql("SELECT `time`,`name`,`nameid`,`amount` FROM `guild_storage_log` WHERE `guild_id` = '" + getcharid(2) + "' ORDER BY `id` DESC LIMIT 30", .@time$ ,.@name$,.@item_id,.@amount);
			if(!.@item_id){
				mes "there is no log yet";
				close;
			}
			dispbottom "=========================================================",0xFFD64F;
			dispbottom "===================== Guild Storage Log =======================",0xFFD64F;
			dispbottom "=========================================================",0xFFD64F;
			for(.@i=.@count-1;.@i>=0;.@i--)
				dispbottom .@time$[.@i] + " Player[" + .@name$[.@i] + "] Item Name[" + getitemname(.@item_id[.@i]) + "] Item Amount[" + .@amount[.@i] + "]",((.@amount[.@i] > 0)?0x03c6fc:0xFF0000);
			dispbottom "=========================================================",0xFFD64F;

Though...! At this point, why not simply use the script command guildopenstorage_log ? It sounds like it does exactly what you want to do with an UI in-game as well. You'd have to change the constant MAX_GUILD_STORAGE_LOG_PACKET to

const int16 MAX_GUILD_STORAGE_LOG_PACKET = 30;

 

Edited by Tokei
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  103
  • Reputation:   17
  • Joined:  07/28/12
  • Last Seen:  

53 minutes ago, iconrag said:
		case 4:
			if(!getcharid(2)){
				mes "you don't have guild";
				close;
			}
			if(!guild_has_permission(GUILD_PERM_STORAGE)){
				mes "you don't have permission for the guild storage";
				close;
			}
			query_sql("SELECT `time`,`name`,`nameid`,`amount` FROM `guild_storage_log` WHERE `guild_id` = '" + getcharid(2) + "' order by `id` ASC", .@time$ ,.@name$,.@item_id,.@amount);
			if(!.@item_id){
				mes "there is no log yet";
				close;
			}
			dispbottom "=========================================================",0xFFD64F;
			dispbottom "===================== Guild Storage Log =======================",0xFFD64F;
			dispbottom "=========================================================",0xFFD64F;
			for(.@i=0;.@i<getarraysize(.@item_id);.@i++)
				dispbottom .@time$[.@i] + " Player[" + .@name$[.@i] + "] Item Name[" + getitemname(.@item_id[.@i]) + "] Item Amount[" + .@amount[.@i] + "]",((.@amount[.@i] > 0)?0x03c6fc:0xFF0000);
			dispbottom "=========================================================",0xFFD64F;


Hello guys, Need help
i want to make this Guild Storage Logs show 30 last Logs Only
can someone help me ?
thanks

try with this

		case 4:
			if(!getcharid(2)){
				mes "you don't have guild";
				close;
			}
			if(!guild_has_permission(GUILD_PERM_STORAGE)){
				mes "you don't have permission for the guild storage";
				close;
			}
			query_sql("SELECT `time`,`name`,`nameid`,`amount` FROM `guild_storage_log` WHERE `guild_id` = '" + getcharid(2) + "' order by `id` ASC", .@time$ ,.@name$,.@item_id,.@amount);
			if(!.@item_id){
				mes "there is no log yet";
				close;
			}
			dispbottom "=========================================================",0xFFD64F;
			dispbottom "===================== Guild Storage Log =======================",0xFFD64F;
			dispbottom "=========================================================",0xFFD64F;
+			if( getarraysize(.@item_id) > 30 )
+				set .@aux, 30;
+			else
+				set .@aux, getarraysize(.@item_id);
-			for(.@i=0;.@i<getarraysize(.@item_id) ;.@i++)
+			for(.@i=0;.@i<.@aux ;.@i++)
				dispbottom .@time$[.@i] + " Player[" + .@name$[.@i] + "] Item Name[" + getitemname(.@item_id[.@i]) + "] Item Amount[" + .@amount[.@i] + "]",((.@amount[.@i] > 0)?0x03c6fc:0xFF0000);
			dispbottom "=========================================================",0xFFD64F;

 

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