Jump to content
  • 0
Sign in to follow this  
Helena

How to also block/check for items in cart?

Question

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! :(

 

How can i also disable cart items?

 

 

 

-	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 

 

Share this post


Link to post
Share on other sites

12 answers to this question

Recommended Posts

  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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!! :D

 

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

Is there any solution for that?

Edited by Helena

Share this post


Link to post
Share on other sites
  • 0

 

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!! :D

 

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

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.

Share this post


Link to post
Share on other sites
  • 0

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

Hm ok. So how will i do that? How can i properly inject it in this script?

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

 

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. :( 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?

 

 

-	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 

 

Edited by Dastgir
codebox

Share this post


Link to post
Share on other sites
  • 0

 

 

-	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

Share this post


Link to post
Share on other sites
  • 0

 

 

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

Share this post


Link to post
Share on other sites
  • 0

http://herc.ws/board/topic/6029-script-cmd-cartcountitem/

 

 Try this command that will immediately check cart inventory item 

 

  without waiting  the emulator to save player's cart data

 

why not use strcharinfo(3) instead of getmapxy? xD

Share this post


Link to post
Share on other sites
  • 0

 

http://herc.ws/board/topic/6029-script-cmd-cartcountitem/

 

 Try this command that will immediately check cart inventory item 

 

  without waiting  the emulator to save player's cart data

 

why not use strcharinfo(3) instead of getmapxy? xD

Coz Helena use getmapxy ...XD

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.