@drop on / off command

glemor123

New member
Messages
287
Points
0
when a player login. @dropoff is automatically initiated.

functions of drop off and drop on

drop off= any item cannot be drop but can be stored to the storage and can be sold.

drop on= can drop the item and etc.

I'm requesting for .diff for hercules and rathena

 
its so simple that I can write this on the fly until I can cry

Code:
 src/map/atcommand.c | 26 ++++++++++++++++++++++++++ src/map/pc.c        |  5 +++++ src/map/pc.h        |  2 ++ 3 files changed, 33 insertions(+)diff --git a/src/map/atcommand.c b/src/map/atcommand.cindex b5e8fa7..af092eb 100644--- a/src/map/atcommand.c+++ b/src/map/atcommand.c@@ -9374,6 +9374,31 @@ static inline void atcmd_channel_help(int fd, const char *command, bool can_crea 	clif->message(fd,atcmd_output); 	return true; }++ACMD(drop) {+	if ( stristr( message, "on" ) ) {+		if ( sd->candrop )+			clif->message( fd, "You already turn on @drop." );+		else {+			sd->candrop = 1;+			clif->message( fd, "You are now turn ON @drop. You can drop items now." );+		}+	}+	else if ( stristr( message, "off" ) ) {+		if ( !sd->candrop )+			clif->message( fd, "You already turn off @drop" );+		else {+			sd->candrop = 0;+			clif->message( fd, "You are now turn OFF @drop. You can't drop items now." );+		}+	}+	else {+		clif->message( fd, "Syntax: @drop on|off." );+		return false;+	}+	return true;+}+ /**  * Fills the reference of available commands in atcommand DBMap  **/@@ -9384,6 +9409,7 @@ void atcommand_basecommands(void) { 	 * Command reference list, place the base of your commands here 	 **/ 	AtCommandInfo atcommand_base[] = {+		ACMD_DEF(drop), 		ACMD_DEF2("warp", mapmove), 		ACMD_DEF(where), 		ACMD_DEF(jumpto),diff --git a/src/map/pc.c b/src/map/pc.cindex 2372d31..1c0c934 100644--- a/src/map/pc.c+++ b/src/map/pc.c@@ -4123,6 +4123,11 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) 		return 0; //Can't drop items in nodrop mapflag maps. 	} +	if ( !sd->candrop ) {+		clif->message( sd->fd, "You can't drop items. Type '@drop on' to allow drop items." );+		return 0;+	}+ 	if( !pc->candrop(sd,&sd->status.inventory[n]) ) 	{ 		clif->message (sd->fd, msg_txt(263));diff --git a/src/map/pc.h b/src/map/pc.hindex bec4522..c84c9a3 100644--- a/src/map/pc.h+++ b/src/map/pc.h@@ -547,6 +547,8 @@ struct map_session_data { 	const char* delunit_prevfile; 	int delunit_prevline; +	bool candrop;+ };  #define EQP_WEAPON EQP_HAND_R
its should be simple to convert to rathena
 
Last edited by a moderator:
its so simple that I can write this on the fly until I can cry

src/map/atcommand.c | 26 ++++++++++++++++++++++++++ src/map/pc.c | 5 +++++ src/map/pc.h | 2 ++ 3 files changed, 33 insertions(+)diff --git a/src/map/atcommand.c b/src/map/atcommand.cindex b5e8fa7..af092eb 100644--- a/src/map/atcommand.c+++ b/src/map/atcommand.c@@ -9374,6 +9374,31 @@ static inline void atcmd_channel_help(int fd, const char *command, bool can_crea clif->message(fd,atcmd_output); return true; }++ACMD(drop) {+ if ( stristr( message, "on" ) ) {+ if ( sd->candrop )+ clif->message( fd, "You already turn on @drop." );+ else {+ sd->candrop = 1;+ clif->message( fd, "You are now turn ON @drop. You can drop items now." );+ }+ }+ else if ( stristr( message, "off" ) ) {+ if ( !sd->candrop )+ clif->message( fd, "You already turn off @drop" );+ else {+ sd->candrop = 0;+ clif->message( fd, "You are now turn OFF @drop. You can't drop items now." );+ }+ }+ else {+ clif->message( fd, "Syntax: @drop on|off." );+ return false;+ }+ return true;+}+ /** * Fills the reference of available commands in atcommand DBMap **/@@ -9384,6 +9409,7 @@ void atcommand_basecommands(void) { * Command reference list, place the base of your commands here **/ AtCommandInfo atcommand_base[] = {+ ACMD_DEF(drop), ACMD_DEF2("warp", mapmove), ACMD_DEF(where), ACMD_DEF(jumpto),diff --git a/src/map/pc.c b/src/map/pc.cindex 2372d31..1c0c934 100644--- a/src/map/pc.c+++ b/src/map/pc.c@@ -4123,6 +4123,11 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) return 0; //Can't drop items in nodrop mapflag maps. } + if ( !sd->candrop ) {+ clif->message( sd->fd, "You can't drop items. Type '@drop on' to allow drop items." );+ return 0;+ }+ if( !pc->candrop(sd,&sd->status.inventory[n]) ) { clif->message (sd->fd, msg_txt(263));diff --git a/src/map/pc.h b/src/map/pc.hindex bec4522..c84c9a3 100644--- a/src/map/pc.h+++ b/src/map/pc.h@@ -547,6 +547,8 @@ struct map_session_data { const char* delunit_prevfile; int delunit_prevline; + bool candrop;+ }; #define EQP_WEAPON EQP_HAND_Rits should be simple to convert to rathena
Thank you! I hope someone will also convert this to rathena
default_smile.png


 
Back
Top