Samuel 83 Posted December 26, 2015 Hello everyone! This is a new command to reload the cashshop_db.conf So you don't need to restart the server when you add or delete items in the cash shop or just simply changed the price of items But due to a certain conflict wherein a player needs to relog in order for him to see the changes in Cash Shop, I added a 10 sec countdown and kick command. Special Thanks to: @@AnnieRuru Have a nice day! Link 2 REKT and Quazi reacted to this Quote Share this post Link to post Share on other sites
AnnieRuru 957 Posted December 26, 2015 LOL !!! you only asked me about how to kick players if you really told me about cashshop, I know which function to hook ..... #include "common/hercules.h"#include <stdio.h>#include <string.h>#include <stdlib.h>#include "map/pc.h"#include "map/clif.h"#include "common/HPMDataCheck.h"HPExport struct hplugin_info pinfo = { "reloadcashshop", SERVER_TYPE_MAP, "1.0", HPM_VERSION,};ACMD(reloadcashshop) { clif->cashshop_load(); clif->pCashShopSchedule( sd->fd, sd ); return true;}HPExport void plugin_init (void) { addAtcommand( "reloadcashshop", reloadcashshop );}what the ... the item appear twice in my window http://herc.ws/board/topic/1247-adding-reloadcashshop/?p=9041 so Ind was right it has to kick the player this is a client side restriction, because the client can only receive and add additional items but the client NEVER refresh or delete the cash item list maybe Samuel you can do that one post in the topic, only ask the player to relog when the server did @reloadcashshop so don't have to kick innocent players Quote Share this post Link to post Share on other sites
Samuel 83 Posted December 26, 2015 @@AnnieRuru yeah, it could be just ask the player to relog, the problem is when players who didn't relog can have problems like buying items wherein price has been changed, they'll see the old value but when they buy, the new value will be deducted i see your point that it could be a problem for players who are doing instance i think, or in maps where the character can't stau upon relogging Quote Share this post Link to post Share on other sites
AnnieRuru 957 Posted December 26, 2015 i see your point that it could be a problem for players who are doing instance i think, or in maps where the character can't stau upon reloggingisn't it still better than kick the whole server xDwell, if event maps, there are nocashshop mapflag, but if instance map, no comment just in case you don't know how to do this ... every time some one do @reloadcashshop, it adds the server variable +1 then there is also a player variable initialize when they log in if the player variable doesn't match the server variable, ask them to relog I used this trick for reset txt style pvp ladder 1 jTynne reacted to this Quote Share this post Link to post Share on other sites
ReckedCat 2 Posted January 20, 2016 FYI, I've noticed that the use of this script causes memory leakage from the cash shop being reloaded. I personally see around 763 bytes that fails to be released after a reload. Running the command twice left 1426 bytes that the Memory Manager had to clean up afterwards. Not that this is that much, but I imagine it could become an issue with extended use. Not sure if there's much that can be done on this one. The code looks like it frees up the struct it creates, and deletes the timer. I'll look at it later on when I have some time to see if there's something that can be done. Alternatively, is anyone else noticing this? 1 jTynne reacted to this Quote Share this post Link to post Share on other sites
REKT 10 Posted January 24, 2016 FYI, I've noticed that the use of this script causes memory leakage from the cash shop being reloaded. I personally see around 763 bytes that fails to be released after a reload. Running the command twice left 1426 bytes that the Memory Manager had to clean up afterwards. Not that this is that much, but I imagine it could become an issue with extended use. Not sure if there's much that can be done on this one. The code looks like it frees up the struct it creates, and deletes the timer. I'll look at it later on when I have some time to see if there's something that can be done. Alternatively, is anyone else noticing this? I haven;t try this but i'm planning to add but i notice that you've posted something about it, so you want to make another code for this one? Quote Share this post Link to post Share on other sites
Samuel 83 Posted January 24, 2016 @@ReckedCat hmm how were you able to get the leaks? could you point it to me? thanks! Quote Share this post Link to post Share on other sites
Dastgir 1246 Posted January 25, 2016 ACMD(cashreload) { int i, j; if ( countdown ) return false; for(i = 0; i < CASHSHOP_TAB_MAX; i++) { for( j = 0; j < clif->cs.item_count[i]; j++ ) { aFree(clif->cs.data[i][j]); } aFree(clif->cs.data[i]); } clif->cashshop_load(); cashreload_countid = timer->add( timer->gettick() + 1000, cashreload_countdown, 0, 0 ); clif->message(fd, "Cash Shop Reloaded"); countdown = 11; return true; } You forgot to free the CashShop array, and did cashshop_load, which recreated the memory while previous haven't been free'd Quote Share this post Link to post Share on other sites
hemagx 69 Posted January 25, 2016 actually, it should be possible to reload cashshop without need to kick player will see if my workaround works when i go back work soon! 1 jTynne reacted to this Quote Share this post Link to post Share on other sites
REKT 10 Posted January 27, 2016 Waiting for @@hemagx release Quote Share this post Link to post Share on other sites