Jump to content

Recommended Posts

thumb-7851e21f3c4d7a2ef9375abab50a3191-rentitem2.png

File Name: rentitem2 plugins

File Submitter: Mhalicot

File Submitted: 04 Jan 2014

File Category: Plugins

 

HPM (Script command: rentitem2) (AtCommand: @rentitem) complete package.

 

Compatible with Windows System Only

 

if you are using Linux, ignore other files and use only rentitem2.c

some Linux Systwem got many bugs with files what are all ready compiled under VS2010 .

(Windows Compiled wont work on *nix)

 

Instruction.

 

1. Download and extract files using 7z or any application that can extract it.

2. extract it in your server directory ex: C:/RO Server/Hercules/

2.1. edit conf/plugins.conf and add rentitem2

3. find rentitem2/rentitem2.sln and recompile it.

4. You can now start using your ready made plugins :no1:

Pre-Compiled features, ready made MSVC. you can easily rebuild and its ready to go without any trouble on setup.

as simple as Download>Recomple>Play

 

if you are using VS2010/VS2009/vs2013 or whatsoever and you are failing to compile because of platform issue.

this is what you need to do.

rightclick rentitem2>Configuration Properties>General>

 

search for Platform Toolset, change VS2012(v110) to VS2010(v100) or VS2009(v90)

 

then try to recompile again..

Note: Recompile if you modify the script.

the command is rentitem2

If you want to edit look for src/plugins/rentitem2.c


Sample Script:

// Structure*rentitem2 <Item_ID>,<time>, <identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;*rentitem2 "<Item_Name>",<time>, <identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;// Scriptrentitem2 @inventorylist_id[.@item],.rentime,@inventorylist_identify[.@item],@inventorylist_refine[.@item],@inventorylist_attribute[.@item],@inventorylist_card1[.@item],@inventorylist_card2[.@item],@inventorylist_card3[.@item],@inventorylist_card4[.@item];


Note: cannot rent pet eggs/armor, stackable items.

// AtCommand Structureusage: @rentitem <item name/ID> <Minutes>


*getequipexpiretick(<equipment slot>)

Returns the number of seconds before the item expires.0 means it never expires (not a rental item)-1 means no item is equipped 

Sample Script:

if (getequipexpiretick(.@part)) {            mes "Sorry. I don't sign rental items.";            emotion e_sry;            close;        } 

If you have any questions feel free to drop a comment.

 

for more info on how to to use HPM visit Here

(Tested on Hercules rev. 137**)

Credit: Original file by Brian and converted by Me

 

Click here to download this file

Share this post


Link to post
Share on other sites

Update 2.0: 

 

Note: cannot rent pet eggs/armor, stackable items.

// AtCommand Structure

usage: @rentitem <item name/ID> <Minutes> 

Share this post


Link to post
Share on other sites

Update: 3.0

*getequipexpiretick(<equipment slot>)Returns the number of seconds before the item expires.0 means it never expires (not a rental item)-1 means no item is equipped

Sample Script:

 

if (getequipexpiretick(.@part)) {	mes "Sorry. I don't sign rental items.";	emotion e_sry;	close;}

Share this post


Link to post
Share on other sites

post-1086-0-70784300-1389406787_thumb.jpg

 

I use @rentitem2  it Unknown command..

 

Only can use @rentitem but can not add more field to do like refine, slot enchent.

 

why this??

 

My system is centos6.5 hercules last svn

 

Share this post


Link to post
Share on other sites

@mahlicot

can i use it in pre-renwal server? because after adding the plugin, i am getting unknown command if i use @rentitem.

Edited by jahrasta06

Share this post


Link to post
Share on other sites
 

@mahlicot

can i use it in pre-renwal server? because after adding the plugin, i am getting unknown command if i use @rentitem.

 

What version you use? are you sure there is no error upon compiling? please review..

Share this post


Link to post
Share on other sites

 

 

@mahlicot

can i use it in pre-renwal server? because after adding the plugin, i am getting unknown command if i use @rentitem.

 

What version you use? are you sure there is no error upon compiling? please review..

 

yeah. there is no error during compiling. but its working now. I am really interested only in @rentitem. So what i did was i manually put the code below under atcommand.c.

 

ACMD(rentitem){	char item_name[100];	int number = 0, item_id, flag = 0;	struct item item_tmp;	struct item_data *item_data;	int get_count;		memset(item_name, '0', sizeof(item_name));	if (!message || !*message || (		sscanf(message, ""%99[^"]" %d", item_name, &number) < 1 && 		sscanf(message, "%99s %d", item_name, &number) < 1 )) 		{ 		clif->message(fd, "Please enter an item name or ID (usage: @rentitem <item name/ID> <minutes>).");		return true;	}		if (number <= 0)		number = 1;		if ((item_data = itemdb->search_name(item_name)) == NULL &&	    (item_data = itemdb->exists(atoi(item_name))) == NULL)	{		clif->message(fd, "Invalid item ID or name.");		return false;	}	item_id = item_data->nameid;	get_count = number;	//Check if it's stackable.	if (itemdb->isstackable2(item_data)) {		clif->message(fd, "Cannot create rented stackable items.");		return false;	}	if(item_data->type == IT_PETEGG || item_data->type == IT_PETARMOR) {		clif->message(fd, "Cannot create rented pet eggs or pet armors.");		return false;	}		// if not pet egg		if (!pet->create_egg(sd, item_id)) {				number = get_count*60;				memset(&item_tmp, 0, sizeof(item_tmp));				item_tmp.nameid = item_id;				item_tmp.identify = 1;				item_tmp.expire_time = (unsigned int)(time(NULL) + number);				item_tmp.bound = 0;			if ((flag = pc->additem(sd, &item_tmp, 1, LOG_TYPE_COMMAND)))				clif->additem(sd, 0, 0, flag);		}		if (flag == 0)		clif->message(fd, "Item created.");	return true;}

 

thank you for sharing this tol. asitg! :D

 

btw. im am using version 3.0.7.

Share this post


Link to post
Share on other sites

getting error like this compiling in linux. looking forward that somebody would make plugin for linux like this :)

 

 

[Warning]: HPM:plugin_load: failed to retrieve 'HPMDataCheckLen' for 'plugins/rentitem2.dll', most likely not including HPMDataCheck.h, skipping...

Edited by Don Juan

Share this post


Link to post
Share on other sites

honestly you should try pull request these script commands

*rentitem2

*makeitem2

*getequipexpiretick

should go inside our repo

Share this post


Link to post
Share on other sites

Please correct me I'm wrong, I'm trying to add this feature but then; first let me say what I've d

 

1. Placed rentitem2.c inside 'src\plugins'

2. edited conf/plugins.conf file

 

plugins_list: [
    /* Enable HPMHooking when plugins in use rely on Hooking */
    //"HPMHooking",
    //"db2sql",
    //"sample",
    //"other",
    "rentitem2",
]

 

 
compiled using linux (centos 6)
 
./configure
make clean
make sql
 
started the server using ./athena-start start then there's an error  saying
 
HPM:plugin_load: failed to load 'plugins/rentitem2.so' (error: plugins/rentitem2.so: cannot open shared object file: no such file or directory)!
HPM:plugin_load: failed to load 'plugins/rentitem2.so' (error: plugins/rentitem2.so: cannot open shared object file: no such file or directory)!
HPM:plugin_load: failed to load 'plugins/rentitem2.so' (error: plugins/rentitem2.so: cannot open shared object file: no such file or directory)!

 

 

 

 

Share this post


Link to post
Share on other sites
make sql plugins
 

or even 

 

make plugins
 

 

 

you didn't build your plugins... that's why this error on startup...

Edited by Habilis

Share this post


Link to post
Share on other sites
	MAKE	mt19937ar
make[1]: Entering directory `/.../.../Hercules/3rdparty/mt19937ar'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/.../.../Hercules/3rdparty/mt19937ar'
	MAKE	libconfig
make[1]: Entering directory `/.../.../Hercules/3rdparty/libconfig'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/.../.../Hercules/3rdparty/libconfig'
	MAKE	common_sql
make[1]: Entering directory `/.../.../Hercules/src/common'
make[1]: Nothing to be done for `sql'.
make[1]: Leaving directory `/.../.../Hercules/src/common'
	CONFIGURE
Reconfiguring with options: 
config.status: creating Makefile
config.status: creating src/common/Makefile
config.status: creating 3rdparty/mt19937ar/Makefile
config.status: creating 3rdparty/libconfig/Makefile
config.status: creating src/char/Makefile
config.status: creating src/login/Makefile
config.status: creating src/map/Makefile
config.status: creating src/plugins/Makefile
config.status: creating src/tool/Makefile
config.status: creating src/test/Makefile
config.status: creating tools/HPMHookGen/Makefile
config.status: creating tools/doxygen/Makefile
	MAKE	plugins
make[1]: Entering directory `/.../.../Hercules/src/plugins'
	PLUGIN	sample
	PLUGIN	db2sql
	PLUGIN	HPMHooking_char
	PLUGIN	HPMHooking_login
	PLUGIN	HPMHooking_map
	CC	rentitem2.c
rentitem2.c: In function 'plugin_init':
rentitem2.c:193: warning: implicit declaration of function 'GET_SYMBOL'
rentitem2.c:193: warning: nested extern declaration of 'GET_SYMBOL'
rentitem2.c:193: warning: assignment makes pointer from integer without a cast
rentitem2.c:194: warning: assignment makes pointer from integer without a cast
rentitem2.c:195: warning: assignment makes pointer from integer without a cast
rentitem2.c:196: warning: assignment makes pointer from integer without a cast
rentitem2.c:197: warning: assignment makes pointer from integer without a cast
/tmp/ccP0MSOU.o: In function `plugin_init':
/.../.../Hercules/src/plugins/rentitem2.c:193: undefined reference to `GET_SYMBOL'
/.../.../Hercules/src/plugins/rentitem2.c:193: undefined reference to `script'
/.../.../Hercules/src/plugins/rentitem2.c:194: undefined reference to `GET_SYMBOL'
/.../.../Hercules/src/plugins/rentitem2.c:194: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:195: undefined reference to `GET_SYMBOL'
/.../.../Hercules/src/plugins/rentitem2.c:195: undefined reference to `pet'
/.../.../Hercules/src/plugins/rentitem2.c:196: undefined reference to `GET_SYMBOL'
/.../.../Hercules/src/plugins/rentitem2.c:196: undefined reference to `itemdb'
/.../.../Hercules/src/plugins/rentitem2.c:197: undefined reference to `GET_SYMBOL'
/.../.../Hercules/src/plugins/rentitem2.c:197: undefined reference to `pc'
/.../.../Hercules/src/plugins/rentitem2.c:206: undefined reference to `showmsg'
/.../.../Hercules/src/plugins/rentitem2.c:205: undefined reference to `showmsg'
/.../.../Hercules/src/plugins/rentitem2.c:201: undefined reference to `showmsg'
/tmp/ccP0MSOU.o: In function `buildin_rentitem2':
/.../.../Hercules/src/plugins/rentitem2.c:129: undefined reference to `script'
/.../.../Hercules/src/plugins/rentitem2.c:156: undefined reference to `showmsg'
/.../.../Hercules/src/plugins/rentitem2.c:148: undefined reference to `itemdb'
/.../.../Hercules/src/plugins/rentitem2.c:180: undefined reference to `pc'
/.../.../Hercules/src/plugins/rentitem2.c:182: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:137: undefined reference to `itemdb'
/.../.../Hercules/src/plugins/rentitem2.c:150: undefined reference to `showmsg'
/.../.../Hercules/src/plugins/rentitem2.c:140: undefined reference to `showmsg'
/tmp/ccP0MSOU.o: In function `buildin_getequipexpiretick':
/.../.../Hercules/src/plugins/rentitem2.c:93: undefined reference to `script'
/.../.../Hercules/src/plugins/rentitem2.c:105: undefined reference to `pc'
/tmp/ccP0MSOU.o: In function `atcommand_rentitem':
/.../.../Hercules/src/plugins/rentitem2.c:45: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:52: undefined reference to `itemdb'
/.../.../Hercules/src/plugins/rentitem2.c:72: undefined reference to `pet'
/.../.../Hercules/src/plugins/rentitem2.c:85: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:80: undefined reference to `pc'
/.../.../Hercules/src/plugins/rentitem2.c:81: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:63: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:67: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:55: undefined reference to `clif'
collect2: ld returned 1 exit status
make[1]: *** [../../plugins/rentitem2.so] Error 1
make[1]: Leaving directory `/.../.../Hercules/src/plugins'
make: *** [plugins] Error 2

Sorry I'm not really used on debugging c

Edited by jupeto

Share this post


Link to post
Share on other sites

try removing this

 

	/* map-server interfaces */
	script = GET_SYMBOL("script");
	clif = GET_SYMBOL("clif");
	pet = GET_SYMBOL("pet");
	itemdb = GET_SYMBOL("itemdb");
	pc = GET_SYMBOL("pc");

from 

HPExport void plugin_init (void) {

Share this post


Link to post
Share on other sites
	CC	rentitem2.c
/tmp/ccn7ox2q.o: In function `plugin_init':
/.../.../Hercules/src/plugins/rentitem2.c:206: undefined reference to `showmsg'
/.../.../Hercules/src/plugins/rentitem2.c:205: undefined reference to `showmsg'
/.../.../Hercules/src/plugins/rentitem2.c:201: undefined reference to `showmsg'
/tmp/ccn7ox2q.o: In function `buildin_rentitem2':
/.../.../Hercules/src/plugins/rentitem2.c:129: undefined reference to `script'
/.../.../Hercules/src/plugins/rentitem2.c:156: undefined reference to `showmsg'
/.../.../Hercules/src/plugins/rentitem2.c:148: undefined reference to `itemdb'
/.../.../Hercules/src/plugins/rentitem2.c:180: undefined reference to `pc'
/.../.../Hercules/src/plugins/rentitem2.c:182: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:137: undefined reference to `itemdb'
/.../.../Hercules/src/plugins/rentitem2.c:150: undefined reference to `showmsg'
/.../.../Hercules/src/plugins/rentitem2.c:140: undefined reference to `showmsg'
/tmp/ccn7ox2q.o: In function `buildin_getequipexpiretick':
/.../.../Hercules/src/plugins/rentitem2.c:93: undefined reference to `script'
/.../.../Hercules/src/plugins/rentitem2.c:105: undefined reference to `pc'
/tmp/ccn7ox2q.o: In function `atcommand_rentitem':
/.../.../Hercules/src/plugins/rentitem2.c:45: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:52: undefined reference to `itemdb'
/.../.../Hercules/src/plugins/rentitem2.c:72: undefined reference to `pet'
/.../.../Hercules/src/plugins/rentitem2.c:85: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:80: undefined reference to `pc'
/.../.../Hercules/src/plugins/rentitem2.c:81: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:63: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:67: undefined reference to `clif'
/.../.../Hercules/src/plugins/rentitem2.c:55: undefined reference to `clif'
collect2: ld returned 1 exit status
make[1]: *** [../../plugins/rentitem2.so] Error 1
make[1]: Leaving directory `/.../.../Hercules/src/plugins'
make: *** [plugins] Error 2


 

@Habilis

Edited by jupeto

Share this post


Link to post
Share on other sites

...

 

replace top with

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "common/hercules.h" /* Should always be the first Hercules file included! (if you don't make it first, you won't be able to use interfaces) */

#include "common/HPMi.h"
#include "common/timer.h"
#include "map/script.h"
#include "map/status.h"
#include "map/pc.h"
#include "map/clif.h"
#include "map/pet.h"
#include "map/script.h"
#include "map/itemdb.h"

#include "plugins/HPMHooking.h"
#include "common/HPMDataCheck.h" /* should always be the last Hercules file included! (if you don't make it last, it'll intentionally break compile time) */





Im not sure, but I think you can remove 

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

too

Share this post


Link to post
Share on other sites

...

 

replace top with

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "common/hercules.h" /* Should always be the first Hercules file included! (if you don't make it first, you won't be able to use interfaces) */

#include "common/HPMi.h"
#include "common/timer.h"
#include "map/script.h"
#include "map/status.h"
#include "map/pc.h"
#include "map/clif.h"
#include "map/pet.h"
#include "map/script.h"
#include "map/itemdb.h"

#include "plugins/HPMHooking.h"
#include "common/HPMDataCheck.h" /* should always be the last Hercules file included! (if you don't make it last, it'll intentionally break compile time) */




Im not sure, but I think you can remove 

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

too

 

Well errors are gone, and the ".so" file was successfully created. However, console says

 

 

[Error]: script error in file 'npc/custom/.../cro-newbie.txt' line 17column 5
    parse_line: expect command, missing function name or calling undeclared function
    15:     mes "[The Newbie]";
    16:     
*   17:     rentitem2(25511,1,1,1);
        ~~~~^


 

YAY! Got it, forgot to enable rentitem2 in conf/plugins.conf ... silly me ^__^ everything's working now

Edited by jupeto

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
Reply to this topic...

×   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...

×
×
  • Create New...

Important Information

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