Jump to content
  • 0

R>script


Blue Jem

Question


  • Group:  Members
  • Topic Count:  151
  • Topics Per Day:  0.04
  • Content Count:  393
  • Reputation:   3
  • Joined:  09/16/13
  • Last Seen:  

for this command @bst blablabla announce to every one use this annnounce " @input ";  and color for announce is blue after 1min she/he can use again 

/tnx /kis

how can add the timer if use this command after 1 min she/he can use again
and in display msg like this jemz -[market]- s> +10apple  
ACMD_FUNC(bst)
{
nullpo_retr(-1, sd);


memset(atcmd_output, '\0', sizeof(atcmd_output));


if (!message || !*message) {
clif_displaymessage(fd, "Please, enter a message (usage: @bst <message>).");
return -1;
}


sprintf(atcmd_output, "%s: %s", sd->status.name, message);
intif_bst(atcmd_output, strlen(atcmd_output) + 1, 0);


return 0;
}

this is example of script but when i change all broadcast to bst i got error


up

Edited by Blue Jem
Link to comment
Share on other sites

25 answers to this question

Recommended Posts


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

thx to @Lighta <3

[paste=1cvelflk4v6k]

 

@Blue Jem

replace

intif_broadcast2( aaa, (int)strlen(aaa)+1, strtol("0x9999FF", NULL, 0), 0x190, 12, 0, 0 );
with

clif_GlobalMessage( &sd->bl, aaa , ALL_CLIENT );
Edited by AnnieRuru
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

can you update this mam @AnnieRuru  if the player switch to another character they can use the command again supposed not and can you add a command to hide their broadcast like @bst on/@bst off

Link to comment
Share on other sites


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

Emistry did a script version

so I do a source version

ACMD_FUNC(bst) {
	struct map_session_data *pl_sd;
	struct s_mapiterator* iter;
	char aaa[255];
	nullpo_retr(-1, sd);
	if ( !message || !*message ) {
		clif_displaymessage(fd, "Please, enter a message (usage: @bst <message>).");
		return -1;
	}
	sprintf( aaa, "[Market] %s : %s", sd->status.name, message );
	iter = mapit_getallusers();
	for ( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
		clif_broadcast2( &pl_sd->bl, aaa, strlen(aaa) +1 , strtol("0x9999FF", NULL, 0), 0x190, 12, 0, 0, SELF);
	mapit_free(iter);
	return 0;
}
ACMD_DEF(bst),

if ACMD_DEF(bst), doesn't work can try

{ "bst", 0,0, atcommand_bst },
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  151
  • Topics Per Day:  0.04
  • Content Count:  393
  • Reputation:   3
  • Joined:  09/16/13
  • Last Seen:  

i try script emistry is not working on eathena but thanks emistry and you :D for this


one thing i saw :D there are no timer master

AnnieRuru  when use the command after 1min she/he can use again master
Link to comment
Share on other sites


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

opsssss ~~

bst_delay.patch

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  151
  • Topics Per Day:  0.04
  • Content Count:  393
  • Reputation:   3
  • Joined:  09/16/13
  • Last Seen:  

s

post-20646-0-16380300-1388774885_thumb.jpg

Link to comment
Share on other sites


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

open your pc.h file

make sure the int bst_delay; is inside the struct map_session_data

struct map_session_data {
....
int bst_delay;
};
I think you add it in manually but you put that line inside wrong function
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  151
  • Topics Per Day:  0.04
  • Content Count:  393
  • Reputation:   3
  • Joined:  09/16/13
  • Last Seen:  

is not working madam im usint eathena /sob

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  4
  • Reputation:   0
  • Joined:  03/15/13
  • Last Seen:  

Pretty nice topic. mam Annie ur have a great skills in this topic. when i try yours its working. but i got the problem when i try to add Some delays in this @bst command.

 

When i try your Diff file. i got an error in recompiling.

 

this code is working.

 

 

ACMD_FUNC(bst) {
    struct map_session_data *pl_sd;
    struct s_mapiterator* iter;
    char aaa[255];
    nullpo_retr(-1, sd);
    if ( !message || !*message ) {
        clif_displaymessage(fd, "Please, enter a message (usage: @bst <message>).");
        return -1;
    }
    sprintf( aaa, "[Market] %s : %s", sd->status.name, message );
    iter = mapit_getallusers();
    for ( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
        clif_broadcast2( &pl_sd->bl, aaa, strlen(aaa) +1 , strtol("0x9999FF", NULL, 0), 0x190, 12, 0, 0, SELF);
    mapit_free(iter);
    return 0;
}

 

may i ask how to fixed it? very much appreciate if u help me. 

Link to comment
Share on other sites


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

I just tested in latest clean rathena, it should be working

and this should be working in eathena,

at least what tells me since I have been making source code since I was still in eathena forum

these 2 functions belongs to atcommand.c

ACMD_FUNC(bst)

ACMD_DEF(bst),

and bst_delay goes inside map_session_data function inside pc.h file ...

come on have some common sense !

@Blue Jem

I don't understand a single bit when you just say "not working"

@Psy

fix ... fix what ? I don't even know what kind of error you are getting

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  151
  • Topics Per Day:  0.04
  • Content Count:  393
  • Reputation:   3
  • Joined:  09/16/13
  • Last Seen:  

can you show the script madam

Link to comment
Share on other sites


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

on post#4 ? :ani_swt3:

 

bst_delay.patch

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  151
  • Topics Per Day:  0.04
  • Content Count:  393
  • Reputation:   3
  • Joined:  09/16/13
  • Last Seen:  

there no timer when i use this @bst 

post-20646-0-95181000-1389066224_thumb.jpg

Link to comment
Share on other sites


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

post-8685-0-80802600-1389083084_thumb.jpg

how about you post your pc.h and atcommand.c file in this pastebin

http://rathena.org/board/pastebin/

so I make the edit for ya

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  151
  • Topics Per Day:  0.04
  • Content Count:  393
  • Reputation:   3
  • Joined:  09/16/13
  • Last Seen:  

ill send the code 


you recieved my files madam?

Link to comment
Share on other sites


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

yeah I got it ...

and yes that coding style belongs to zephyrus .. I can read it

no wonder this patch doesn't compatible with eamod

check your inbox

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

i'm just wondering why you ain't using ALL_CLIENT in broadcast2 but refer looping yourself.

 

nb2 : This with broadcast to all players in that mapserv. if you have a multimap setup (2 mapserv) and want to broadcast to all you should use 'intif_broadcast(const char* mes, int len, int type)' instead.

 

 src/custom/atcommand.inc     | 22 ++++++++++++++++++++++
 src/custom/atcommand_def.inc |  2 ++
 src/map/pc.h                 |  1 +
 3 files changed, 25 insertions(+)

diff --git a/src/custom/atcommand.inc b/src/custom/atcommand.inc
index afb74b2..76fe9c8 100644
--- a/src/custom/atcommand.inc
+++ b/src/custom/atcommand.inc
@@ -17,3 +17,25 @@
 //    clif_specialeffect(&sd->bl, 343, AREA);
 //    return 0;
 //}
+
+ACMD_FUNC(bst) {
+    struct map_session_data *pl_sd;
+    struct s_mapiterator* iter;
+    char aaa[255];
+    nullpo_retr(-1, sd);
+    if ( !message || !*message ) {
+        clif_displaymessage(fd, "Please, enter a message (usage: @bst <message>).");
+        return -1;
+    }
+    if ( sd->bst_delay + 60 > (int)time(NULL) ) {
+        clif_displaymessage(fd, "There is a 60 seconds delay of using this command again");
+        return 0;
+    }
+    sprintf( aaa, "[Market] %s : %s", sd->status.name, message );
+     intif_broadcast(aaa, strlen(aaa), 0); //broadcasting to all mapserv and all players
+    sd->bst_delay = (int)time(NULL);
+    return 0;
+}
\ No newline at end of file
diff --git a/src/custom/atcommand_def.inc b/src/custom/atcommand_def.inc
index 300944c..c739f71 100644
--- a/src/custom/atcommand_def.inc
+++ b/src/custom/atcommand_def.inc
@@ -9,3 +9,5 @@
  **/
 
 //ACMD_DEF(newcommand),
+
+ACMD_DEF(bst),
\ No newline at end of file
diff --git a/src/map/pc.h b/src/map/pc.h
index 12b36dd..bcf4dd9 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -580,6 +580,7 @@ struct map_session_data {
         int16 icon;
         int tid;
     } bonus_script[MAX_PC_BONUS_SCRIPT];
+    int bst_delay;
 };
 
 enum weapon_type {
 
  • Upvote 1
Link to comment
Share on other sites


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

LMAO !!

I totally forgot about it because I copy-pasted from my old source edits

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

yes yours will run much smoother

my source coding skill still sux big time ...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

=) na you were close enough, it will have work smoothly too.

and that intif_broadcast only use clif_broadcast atm, while it seem you wanted to use clif_broadcast2

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  151
  • Topics Per Day:  0.04
  • Content Count:  393
  • Reputation:   3
  • Joined:  09/16/13
  • Last Seen:  

if i change to globalmessage?? how

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  4
  • Reputation:   0
  • Joined:  03/15/13
  • Last Seen:  

@Annie i already fixed it. :) i just analyze what uve post. :) great skill on src. thank you mam :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  4
  • Reputation:   0
  • Joined:  03/15/13
  • Last Seen:  

@Annie. May i ask. how to disable this command during woe ? Interesting Topic <3

Link to comment
Share on other sites


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

@Annie. May i ask. how to disable this command during woe ? Interesting Topic <3

[paste=8psg16aqahr]

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  31
  • Reputation:   0
  • Joined:  05/28/12
  • Last Seen:  

Help me please im using a 16797 rathena svn . and i cant find atcommand.inc and atcommand_def.inc and the line on pc.h

diff --git a/src/custom/atcommand.inc b/src/custom/atcommand.inc
index afb74b2..76fe9c8 100644
--- a/src/custom/atcommand.inc
+++ b/src/custom/atcommand.inc
@@ -17,3 +17,25 @@
 //	clif_specialeffect(&sd->bl, 343, AREA);
 //	return 0;
 //}
+
+ACMD_FUNC(bst) {
+	struct map_session_data *pl_sd;
+	struct s_mapiterator* iter;
+	char aaa[255];
+	nullpo_retr(-1, sd);
+	if ( !message || !*message ) {
+		clif_displaymessage(fd, "Please, enter a message (usage: @bst <message>).");
+		return -1;
+	}
+	if ( sd->bst_delay + 60 > (int)time(NULL) ) {
+		clif_displaymessage(fd, "There is a 60 seconds delay of using this command again");
+		return 0;
+	}
+	sprintf( aaa, "[Market] %s : %s", sd->status.name, message );
+	iter = mapit_getallusers();
+	for ( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
+		clif_broadcast2( &pl_sd->bl, aaa, strlen(aaa) +1 , strtol("0x9999FF", NULL, 0), 0x190, 12, 0, 0, SELF);
+	mapit_free(iter);
+	sd->bst_delay = (int)time(NULL);
+	return 0;
+}
\ No newline at end of file
diff --git a/src/custom/atcommand_def.inc b/src/custom/atcommand_def.inc
index 300944c..c739f71 100644
--- a/src/custom/atcommand_def.inc
+++ b/src/custom/atcommand_def.inc
@@ -9,3 +9,5 @@
  **/
 
 //ACMD_DEF(newcommand),
+
+ACMD_DEF(bst),
\ No newline at end of file
diff --git a/src/map/pc.h b/src/map/pc.h
index 12b36dd..bcf4dd9 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -580,6 +580,7 @@ struct map_session_data {
 		int16 icon;
 		int tid;
 	} bonus_script[MAX_PC_BONUS_SCRIPT];
+	int bst_delay;
 };
 
 enum weapon_type {

help me how to add this src by not updating my svn because i changed alot of src on my svn now :((

Edited by venomxxvii
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  151
  • Topics Per Day:  0.04
  • Content Count:  393
  • Reputation:   3
  • Joined:  09/16/13
  • Last Seen:  

clif_GlobalMessage( &sd->bl, aaa , ALL_CLIENT );

 

this script how can chang the color to violet


6>..\src\map\atcommand.c(11615): warning C4020: 'clif_GlobalMessage' : too many actual parameters

6>..\src\map\achievement.c(143): warning C4013: 'npc_event' undefined; assuming extern returning int

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