How to also block/check for items in cart?

Helena

New member
Messages
238
Points
0
Emulator
rAthena
Hello Hercules

I have a question, I have this script, what it does in short: it kicks out players that have certain items in their inventory.

but there is one problem with it. If I have the items in the array in my cart, I don't get kicked out. So, in this case of war of emperium, if i go to the emp-room, take my items out of my cart i can equips or use them just fine!
default_sad.png


How can i also disable cart items?

Code:
-	script	Restrict	-1,{OnPCLoadMapEvent:getmapxy(.@map$,.@mapx,.@mapy,0);if(.@map$ == "prtg_cas01"){    for(set .@i,0; .@i < getarraysize(.itemcheck); set .@i, .@i + 1){        if(countitem(.itemcheck[.@i])){            dispbottom "[ Info ] :  ["+getitemname(.itemcheck[.@i])+"] found. Kicking you out!";                        warp "prontera",200,180;            end;            }        }    }end;OnInit:setarray .itemcheck[0],2383,2204,30873,20009,20010,etc;end;}prtg_cas01	mapflag	loadevent 
 
Last edited by a moderator:
There's no current script command to retrieve the item list from a character's cart (or storage, or gstorage if ever needed), so you'd have to rethink and hope the player's cart has been saved previously to entering the WoE map and do a SQL query like this:

query_sql("SELECT `nameid` FROM `cart_inventory` WHERE `char_id` = " + getcharid(0), .@itemids);

You'll get all Item IDs the player has on this cart on the array .@itemids, so you have now to loop through it and check for every blacklisted item on each entry.

 
There's no current script command to retrieve the item list from a character's cart (or storage, or gstorage if ever needed), so you'd have to rethink and hope the player's cart has been saved previously to entering the WoE map and do a SQL query like this:

query_sql("SELECT `nameid` FROM `cart_inventory` WHERE `char_id` = " + getcharid(0), .@itemids);

You'll get all Item IDs the player has on this cart on the array .@itemids, so you have now to loop through it and check for every blacklisted item on each entry.
Great it works, thanks!!
default_biggrin.png


Problem though that even when i empty my cart and relog, it still regocnized the item in the cart...
default_sad.png


Is there any solution for that?

 
Last edited by a moderator:
There's no current script command to retrieve the item list from a character's cart (or storage, or gstorage if ever needed), so you'd have to rethink and hope the player's cart has been saved previously to entering the WoE map and do a SQL query like this:

query_sql("SELECT `nameid` FROM `cart_inventory` WHERE `char_id` = " + getcharid(0), .@itemids);

You'll get all Item IDs the player has on this cart on the array .@itemids, so you have now to loop through it and check for every blacklisted item on each entry.
Great it works, thanks!!
default_biggrin.png


Problem though that even when i empty my cart and relog, it still regocnized the item in the cart...
default_sad.png


Is there any solution for that?
It is stuck in the RO memory itself and has not updated yet, hence sometimes when you close a server abruptly, people get duplicate items, lose their items etc.

 
It needs to get saved on the DB so that the changes take effect.

 
Maybe you want to alter these confs:

conf/map-server.conf

Code:
// Database autosave time// All characters are saved on this time in seconds (example:// autosave of 60 secs with 60 characters online -> one char is saved every// second)autosave_time: 300// Min database save intervals (in ms)// Prevent saving characters faster than at this rate (prevents char-server// save-load getting too high as character-count increases)minsave_time: 100// Apart from the autosave_time, players will also get saved when involved// in the following (add as needed):// 1: After every successful trade// 2: After every vending transaction// 4: After closing storage/guild storage.// 8: After hatching/returning to egg a pet.// 16: After successfully sending a mail with attachment// 32: After successfully submitting an item for auction// 64: After successfully get/delete/complete a quest// 128: After every buying store transaction// 256: After every bank transaction (deposit/withdraw)// NOTE: These settings decrease the chance of dupes/lost items when there's a// server crash at the expense of increasing the map/char server lag. If your// server rarely crashes, but experiences interserver lag, you may want to set// these off.save_settings: 511
 
Maybe you want to alter these confs:

conf/map-server.conf

// Database autosave time// All characters are saved on this time in seconds (example:// autosave of 60 secs with 60 characters online -> one char is saved every// second)autosave_time: 300// Min database save intervals (in ms)// Prevent saving characters faster than at this rate (prevents char-server// save-load getting too high as character-count increases)minsave_time: 100// Apart from the autosave_time, players will also get saved when involved// in the following (add as needed):// 1: After every successful trade// 2: After every vending transaction// 4: After closing storage/guild storage.// 8: After hatching/returning to egg a pet.// 16: After successfully sending a mail with attachment// 32: After successfully submitting an item for auction// 64: After successfully get/delete/complete a quest// 128: After every buying store transaction// 256: After every bank transaction (deposit/withdraw)// NOTE: These settings decrease the chance of dupes/lost items when there's a// server crash at the expense of increasing the map/char server lag. If your// server rarely crashes, but experiences interserver lag, you may want to set// these off.save_settings: 511
Hi Jabote, I tried, but alas.
default_sad.png
It still detects long deleted items from my cart, like my brynhild from 5 hours ago.

This is my script, did I do it wrong somewhere?

Code:
-	script	Vanilla1	-1,{OnPCLoadMapEvent:getmapxy(.@map$,.@mapx,.@mapy,0);if(.@map$ == "prtg_cas01"){    for(set .@i,0; .@i < getarraysize(.itemcheck); set .@i, .@i + 1){        if(countitem(.itemcheck[.@i])){            dispbottom "[ Info ] : item ["+getitemname(.itemcheck[.@i])+"] found (Inventory). Kicking..";                        warp "prontera",200,180;            end;            }		query_sql("SELECT `nameid` FROM `cart_inventory` WHERE `char_id` = " + getcharid(0), .itemcheck[0]);            dispbottom "[ Info ] : item ["+getitemname(.itemcheck[.@i])+"] found (Cart). Kicking..";                        warp "prontera",200,180;           end;		}	}end;OnInit:setarray .itemcheck[0],2383,2204,20025,20026,20027,20028,20029,20030,20031,20032,20033;end;}prtg_cas01	mapflag	loadevent 
 
Last edited by a moderator:
Code:
-	script	Vanilla1	-1,{OnPCLoadMapEvent:getmapxy(.@map$,.@mapx,.@mapy,0);if(.@map$ == "prtg_cas01"){	for(set .@i,0; .@i < getarraysize(.itemcheck); set .@i, .@i + 1){		if(countitem(.itemcheck[.@i])){			dispbottom "[ Info ] : item ["+getitemname(.itemcheck[.@i])+"] found (Inventory). Kicking..";            			warp "prontera",200,180;			end; 		}		if(query_sql("SELECT `nameid` FROM `cart_inventory` WHERE `char_id` = " + getcharid(0), .itemcheck[0]) {			dispbottom "[ Info ] : item ["+getitemname(.itemcheck[.@i])+"] found (Cart). Kicking..";            			warp "prontera",200,180;			end;		}    }end;OnInit:setarray .itemcheck[0],2383,2204,20025,20026,20027,20028,20029,20030,20031,20032,20033;end;}prtg_cas01    mapflag    loadevent
 
- script Vanilla1 -1,{OnPCLoadMapEvent:getmapxy(.@map$,.@mapx,.@mapy,0);if(.@map$ == "prtg_cas01"){ for(set .@i,0; .@i < getarraysize(.itemcheck); set .@i, .@i + 1){ if(countitem(.itemcheck[.@i])){ dispbottom "[ Info ] : item ["+getitemname(.itemcheck[.@i])+"] found (Inventory). Kicking.."; warp "prontera",200,180; end; } if(query_sql("SELECT `nameid` FROM `cart_inventory` WHERE `char_id` = " + getcharid(0), .itemcheck[0]) { dispbottom "[ Info ] : item ["+getitemname(.itemcheck[.@i])+"] found (Cart). Kicking.."; warp "prontera",200,180; end; } }end;OnInit:setarray .itemcheck[0],2383,2204,20025,20026,20027,20028,20029,20030,20031,20032,20033;end;}prtg_cas01 mapflag loadevent
Hi angelmelody. Thank you so much that works!

 
Back
Top