Jump to content
  • 0

GM Commands


Hijirikawa

Question


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  193
  • Reputation:   41
  • Joined:  07/21/16
  • Last Seen:  

I'm trying to put an announcement whenever a GM inputs these following commands
 

  • @item and any of its variants (including #)
  • @monster and any of its variants
  • @killmonster and any of its variants

For instance, @item -> will announce "[ Quality Control ]: <name here> created <name of item>(item id) with the <command used> command"
For @monster -> will announce "[ Quality Control ]: <name here> summoned <name of monsters>(mob id) with the <command used> command in <name of map>"

For #item -> will announce "[ Quality Control ]: <name here> created <name of item>(item id) for <player name> with the <command used> command"

For @killmonster -> will announce "[ Quality Control ]: <name here> has killed all monsters in <name of map>"

 

I can probably do this if someone can provide me a few hints here and there on how to implement it. Thanks and appreciate it!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  911
  • Reputation:   166
  • Joined:  11/27/14
  • Last Seen:  

Get GM Level then add Condition Statement on your script

Try this Idea and make your own twist 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  193
  • Reputation:   41
  • Joined:  07/21/16
  • Last Seen:  

i could do it via script, however I do want to learn how to fiddle around with source, and I believe this might be a good area to start.

Also, I have no clue if I can capture a #command via script. Not that I am aware of.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

7 hours ago, Hijirikawa said:

however I do want to learn how to fiddle around with source, and I believe this might be a good area to start.

 src/custom/atcommand.inc     | 24 ++++++++++++++++++++++++
 src/custom/atcommand_def.inc |  2 ++
 2 files changed, 26 insertions(+)

diff --git a/src/custom/atcommand.inc b/src/custom/atcommand.inc
index 9dd4a3856..44d8d7b11 100644
--- a/src/custom/atcommand.inc
+++ b/src/custom/atcommand.inc
@@ -17,3 +17,27 @@
 //	clif_specialeffect(&sd->bl, EF_HEARTCASTING, AREA);
 //	return 0;
 //}
+
+ACMD_FUNC(custom) {
+	intif_broadcast( message, strlen(message) + 1, BC_DEFAULT );
+	return 0;
+}
+
+ACMD_FUNC(custom_item) {
+	char item_name[99];
+	int number = 0;
+	struct item_data *item_data;
+
+	if ( sscanf( message, "\"%99[^\"]\" %11d", item_name, &number) < 1 && sscanf( message, "%99s %11d", item_name, &number ) < 1 ) {
+		clif_displaymessage(fd, msg_txt(sd,983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>).
+		return -1;
+	}
+	if ( (item_data = itemdb_searchname(item_name)) == NULL && (item_data = itemdb_exists(atoi(item_name))) == NULL ) {
+		clif_displaymessage(fd, msg_txt(sd,19)); // Invalid item ID or name.
+		return -1;
+	}
+
+	safesnprintf( atcmd_output, CHAT_SIZE_MAX, "[ Quality Control ]: %s created %s(%d) with the %s command", sd->status.name, item_data->jname, item_data->nameid, command );
+	intif_broadcast( atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT );
+	return 0;
+}
\ No newline at end of file
diff --git a/src/custom/atcommand_def.inc b/src/custom/atcommand_def.inc
index 54d9e74ba..86acf41da 100644
--- a/src/custom/atcommand_def.inc
+++ b/src/custom/atcommand_def.inc
@@ -9,3 +9,5 @@
  **/
 
 //ACMD_DEF(newcommand),
+ACMD_DEF(custom),
+ACMD_DEF(custom_item),

http://www.cplusplus.com/doc/tutorial/structures/
http://www.cplusplus.com/reference/cstdio/sscanf/
http://www.cplusplus.com/reference/cstdio/sprintf/

screen2019rAthena006.jpg

 

EDIT: apparently rAthena the client has a bug for char-command , the command repeat itself, due to the # symbol

Spoiler

ACMD_FUNC(custom2) {
	int number = 0;
	char item_name[99];
	struct item_data *item_data;

	if ( sscanf( message, "\"%99[^\"]\" %11d", item_name, &number) < 1 && sscanf( message, "%99s %11d", item_name, &number ) < 1 ) {
		clif_displaymessage(fd, msg_txt(sd,983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>).
		return -1;
	}
	if ( (item_data = itemdb_searchname(item_name)) == NULL && (item_data = itemdb_exists(atoi(item_name))) == NULL ) {
		clif_displaymessage(fd, msg_txt(sd,19)); // Invalid item ID or name.
		return -1;
	}

	if ( command[0] == '@' )
		safesnprintf( atcmd_output, CHAT_SIZE_MAX, "[ Quality Control ]: %s created %s(%d) with the %s command", sd->status.name, item_data->jname, item_data->nameid, command );
	else if ( command[0] == '#' ) {
		char *temp = (char*)aMalloc( strlen( command ) +1 );
		struct map_session_data *ssd;
		struct s_mapiterator* iter = mapit_getallusers();
		for ( ssd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); ssd = (TBL_PC*)mapit_next(iter) )
			if ( ssd->fd == fd )
				break;
		mapit_free(iter);
		safesnprintf( temp, CHAT_SIZE_MAX, "%s", command );
		temp[0] = ' '; // replace this space into '#' and you get the bug, due to the client
		safesnprintf( atcmd_output, CHAT_SIZE_MAX, "[ Quality Control ]: %s created %s(%d) for %s with the %s command", ssd->status.name, item_data->jname, item_data->nameid, sd->status.name, temp );
	}

	intif_broadcast( atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT );
	return 0;
}

 

 

Edited by AnnieRuru
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  193
  • Reputation:   41
  • Joined:  07/21/16
  • Last Seen:  

Thanks Annie, I'll go ahead and test it out and see how it works on my end!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  911
  • Reputation:   166
  • Joined:  11/27/14
  • Last Seen:  

My bad. This is source . I though its a script 

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