iconrag Posted October 10, 2022 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 5 Reputation: 0 Joined: 09/03/22 Last Seen: October 25, 2022 Share Posted October 10, 2022 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 Quote Link to comment Share on other sites More sharing options...
0 Tokei Posted October 11, 2022 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 695 Reputation: 721 Joined: 11/12/12 Last Seen: 19 hours ago Share Posted October 11, 2022 (edited) 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 October 11, 2022 by Tokei Quote Link to comment Share on other sites More sharing options...
0 Angeluz Posted October 10, 2022 Group: Members Topic Count: 10 Topics Per Day: 0.00 Content Count: 109 Reputation: 19 Joined: 07/28/12 Last Seen: Sunday at 06:16 PM Share Posted October 10, 2022 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; Quote Link to comment Share on other sites More sharing options...
Question
iconrag
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.