Jump to content
  • 0

rathena don't have cartcountitem script command?


Question

Posted

i use old npc for eathena to check item in player cart but i can't use this npc with rathena

how to check item in cart like eathena?

hope this feature add to rathena server

2 answers to this question

Recommended Posts

Posted

really? i think it's have in eathena, maybe i forgot it

i find in script.c

/*================================================
* Check how many items/cards in the list are
* in the user's cart [Zohan]
*------------------------------------------------*/
BUILDIN_FUNC(cartcountitem)
{
int nameid, i;
int count=0;

struct script_data *data;
TBL_PC* sd = script_rid2sd(st);
if (!sd) {
script_pushint(st,0);
return 0;
}

data = script_getdata(st,2);
get_val(st,data);
if( data_isstring(data) ) {
const char* name = conv_str(st,data);
struct item_data* item_data;
if((item_data = itemdb_searchname(name)) != NULL)
nameid = item_data->nameid;
else
nameid = 0;
} else
nameid = conv_num(st,data);

if (nameid < 500) {
ShowError("wrong item ID : countitem(%i)n", nameid);
script_reportsrc(st);
script_pushint(st,0);
return 1;
}
for(i = 0; i < MAX_CART; i++)
{

if(sd->status.cart[i].nameid == nameid)
{
count += sd->status.cart[i].amount;
}
}
script_pushint(st,count);
return 0;
}

BUILDIN_DEF(cartcountitem,"i"),

thx for answer

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...