Jump to content
  • 0

Rental item with refine


solid2005

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  145
  • Reputation:   15
  • Joined:  01/06/12
  • Last Seen:  

example i rent a knife with +10

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

well..you can try refer to this post made by Brian long time ago...

http://www.eathena.ws/board/index.php?s=&showtopic=241313&view=findpost&p=1315831

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  145
  • Reputation:   15
  • Joined:  01/06/12
  • Last Seen:  

Rathena not compatible.

if( (flag = pc_additem(sd, &it, 1)) )
{
clif_additem(sd, 0, 0, flag);
return 1;
}

clif_rental_time(sd->fd, nameid, seconds);
pc_inventory_rental_add(sd, seconds);

if( log_config.enable_logs&LOG_SCRIPT_TRANSACTIONS )
log_pick_pc(sd, "N", nameid, 1, NULL);

return 0;

Edited by Emistry
Codeboxed Content.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   8
  • Joined:  01/09/12
  • Last Seen:  

Look, I have a function here that i think will serve you:

/*==========================================
* rentitemr <item id>,<seconds>,<refine>
* rentitemr "<item name>",<seconds>,<refine>
*------------------------------------------*/
BUILDIN_FUNC(rentitemr)
{
struct map_session_data *sd;
struct script_data *data;
struct item it;
int seconds, refines = 0;
int nameid = 0, flag;

data = script_getdata(st,2);
get_val(st,data);

if( (sd = script_rid2sd(st)) == NULL )
return 0;

if( data_isstring(data) )
{
const char *name = conv_str(st,data);
struct item_data *itd = itemdb_searchname(name);
if( itd == NULL )
{
ShowError("buildin_rentitem: Nonexistant item %s requested.\n", name);
return 1;
}
nameid = itd->nameid;
}
else if( data_isint(data) )
{
nameid = conv_num(st,data);
if( nameid <= 0 || !itemdb_exists(nameid) )
{
ShowError("buildin_rentitem: Nonexistant item %d requested.\n", nameid);
return 1;
}
}
else
{
ShowError("buildin_rentitem: invalid data type for argument #1 (%d).\n", data->type);
return 1;
}

seconds = script_getnum(st,3);
refines = script_getnum(st,4);
memset(&it, 0, sizeof(it));
it.nameid = nameid;
it.identify = 1;
it.expire_time = (unsigned int)(time(NULL) + seconds);
it.refine=refines;

  it.vid = 0;
if( (flag = pc_additem(sd, &it, 1)) )
{
clif_additem(sd, 0, 0, flag);
return 1;
}

clif_rental_time(sd->fd, nameid, seconds);
pc_inventory_rental_add(sd, seconds);

if( log_config.enable_logs&LOG_SCRIPT_TRANSACTIONS )
log_pick_pc(sd, "N", nameid, 1, NULL);

return 0;
}

I will suppose that you know how to add a script command /no1

Edited by Emistry
Please use [CODEBOX] or Attachments for long contents.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  15
  • Reputation:   0
  • Joined:  04/24/12
  • Last Seen:  

Rathena not compatible.

if( (flag = pc_additem(sd, &it, 1)) )
{
clif_additem(sd, 0, 0, flag);
return 1;
}

clif_rental_time(sd->fd, nameid, seconds);
pc_inventory_rental_add(sd, seconds);

if( log_config.enable_logs&LOG_SCRIPT_TRANSACTIONS )
log_pick_pc(sd, "N", nameid, 1, NULL);

return 0;

try this

if( (flag = pc_additem(sd, &it, 1, LOG_TYPE_SCRIPT)) )
{
clif_additem(sd, 0, 0, flag);
return 1;
}

clif_rental_time(sd->fd, nameid, seconds);
pc_inventory_rental_add(sd, seconds);

log_pick_pc(sd, LOG_TYPE_SCRIPT, nameid, 1, &it);

return 0;

Link to comment
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.   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.

×
×
  • Create New...