Jump to content
  • 0

Broadcast depending on GM level


Diconfrost VaNz

Question


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

An Original Post From http://ro-resources.net/topic/285-broadcast-depending-on-gm-level/

It Doesn't work for me, i dnt know what is the error. I'm using 3ceam revision 650.

/*==========================================
* @broadcast by [Valaris]
* Edited by Jake Red
*------------------------------------------*/
ACMD_FUNC(broadcast)
{
    nullpo_retr(-1, sd);
    memset(atcmd_output, '\0', sizeof(atcmd_output));
    if(!message || !*message) {
				    clif_displaymessage(fd, "Please, enter a message (usage: @adm <message>).");
				    return -1;
		    }
		    if(gm_lvl >= 20 && gm_lvl <=40){
		    sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
		    intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0xFF0000, 0x190, 12, 0, 0);
		    }
		    else if(gm_lvl>=41 && gm_lvl<=60){
		    sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
		    intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0x800000, 0x190, 12, 0, 0);
		    }
		    else if (gm_lvl>=61 && gm_lvl<=80){
		    sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
		    intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0x4B0082, 0x190, 12, 0, 0);
		   }
		   else if (gm_lvl>=81 && gm_lvl<=98){
		    sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
		    intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0x0000FF, 0x190, 12, 0, 0);
		   }
		   else if(gm_lvl== 99){
			 sprintf(atcmd_output, "[Admin] %s : %s", sd->status.name, message);
		    intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0xFF0000, 0x190, 12, 0, 0);
		   }
    return 0;
}

Link to comment
Share on other sites

22 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  87
  • Reputation:   1
  • Joined:  11/20/11
  • Last Seen:  

Here. Thanks to Ind for the fix.

/*==========================================
* @broadcast by [Valaris]
*------------------------------------------*/
ACMD_FUNC(broadcast)
{
+  int gm_lvl = pc_isGM(sd);
   nullpo_retr(-1, sd);
   memset(atcmd_output, '0', sizeof(atcmd_output));

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

so meaning it will be like this?

/*==========================================
* @broadcast by [Valaris]
*------------------------------------------*/
ACMD_FUNC(broadcast)
{
+  int gm_lvl = pc_isGM(sd);
   nullpo_retr(-1, sd);
   memset(atcmd_output, '0', sizeof(atcmd_output));
 if(!message || !*message) {
	 clif_displaymessage(fd, "Please, enter a message (usage: @adm <message>).");
	 return -1;
   }
   if(gm_lvl >= 20 && gm_lvl <=40){
   sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
   intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0xFF0000, 0x190, 12, 0, 0);
   }
   else if(gm_lvl>=41 && gm_lvl<=60){
   sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
   intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0x800000, 0x190, 12, 0, 0);
   }
   else if (gm_lvl>=61 && gm_lvl<=80){
   sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
   intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0x4B0082, 0x190, 12, 0, 0);
  }
  else if (gm_lvl>=81 && gm_lvl<=98){
   sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
   intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0x0000FF, 0x190, 12, 0, 0);
  }
  else if(gm_lvl== 99){
 sprintf(atcmd_output, "[Admin] %s : %s", sd->status.name, message);
   intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0xFF0000, 0x190, 12, 0, 0);
  }
 return 0;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  193
  • Reputation:   14
  • Joined:  12/02/11
  • Last Seen:  

FYI it's the src not script ok..

remove the "+"

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

i only understand "remove the +" but the "FYI it's the src not script ok.." thingy...what do you by that?

/*==========================================
* @broadcast by [Valaris]
*------------------------------------------*/
ACMD_FUNC(broadcast)
{
 int gm_lvl = pc_isGM(sd);
   nullpo_retr(-1, sd);
   memset(atcmd_output, '0', sizeof(atcmd_output));
 if(!message || !*message) {
  clif_displaymessage(fd, "Please, enter a message (usage: @adm <message>).");
  return -1;
   }
   if(gm_lvl >= 20 && gm_lvl <=40){
   sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
   intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0xFF0000, 0x190, 12, 0, 0);
   }
   else if(gm_lvl>=41 && gm_lvl<=60){
   sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
   intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0x800000, 0x190, 12, 0, 0);
   }
   else if (gm_lvl>=61 && gm_lvl<=80){
   sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
   intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0x4B0082, 0x190, 12, 0, 0);
  }
  else if (gm_lvl>=81 && gm_lvl<=98){
   sprintf(atcmd_output, "[support and Order] %s : %s", sd->status.name, message);
   intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0x0000FF, 0x190, 12, 0, 0);
  }
  else if(gm_lvl== 99){
 sprintf(atcmd_output, "[Admin] %s : %s", sd->status.name, message);
   intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0xFF0000, 0x190, 12, 0, 0);
  }
 return 0;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  193
  • Reputation:   14
  • Joined:  12/02/11
  • Last Seen:  

that is a source modification or addition not an NPC script..

yourserver/src/map/atcommand.c

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

yeah...i know...that's why i posted here in the source modification support xD

that's a basic common sense xD

another problem:

it only works on @broadcast...how can i apply it also to /b command?

Anyone?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

another problem:

it only works on @broadcast...how can i apply it also to /b command?

Anyone?

This is hardcoded in the client which makes it impossible to edit unless you find someone who knows ASM and the client very well
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

oh i see...so the only option here is to disable the /b command? :D)

or force my GM to use the @broadcast command xD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

how to disable the /b command? xD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

any help?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

HELP! xD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

AFAIK you can't disable those commands without modifying the client. (Maybe Harmony mod is able to do this... I don't know.)

I said nothing... :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  169
  • Topics Per Day:  0.04
  • Content Count:  1260
  • Reputation:   750
  • Joined:  11/19/11
  • Last Seen:  

you can disable /b this way, clif.c -> clif_parse_Broadcast

void clif_parse_Broadcast(int fd, struct map_session_data* sd)
{
char* msg = (char*)RFIFOP(fd,4);
unsigned int len = RFIFOW(fd,2)-4;
int lv;
if( battle_config.atc_gmonly && !pc_isGM(sd) )
 return;
if( pc_isGM(sd) < (lv=get_atcommand_level(atcommand_broadcast)) )
 return;
// as the length varies depending on the command used, just block unreasonably long strings
len = mes_len_check(msg, len, CHAT_SIZE_MAX);
intif_broadcast(msg, len, 0);
if(log_config.gm && lv >= log_config.gm) {
 char logmsg[CHAT_SIZE_MAX+4];
 sprintf(logmsg, "/b %s", msg);
 log_atcommand(sd, logmsg);
}
}

change to

void clif_parse_Broadcast(int fd, struct map_session_data* sd) {
return;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

@Ind = but how can i integrate the /b to my new @broadcast command?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

bump*

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

bump*

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  257
  • Reputation:   253
  • Joined:  11/29/11
  • Last Seen:  

Stop bumping.

This is hardcoded in the client which makes it impossible to edit unless you find someone who knows ASM and the client very well

Kenpachi already made it clear it was impossible. Either you disable /b or you leave it.

//EDIT by Kenpachi:

But Ind poited out that I don't know what I'm saying. :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  67
  • Reputation:   23
  • Joined:  11/14/11
  • Last Seen:  

Here:

void clif_parse_Broadcast(int fd, struct map_session_data* sd)
{
char* msg = (char*)RFIFOP(fd,4);
char output[CHAT_SIZE_MAX];
char title[25]; // 25 should be enough..
char lv_gm, len;
int lv, color;

lv_gm = pc_isGM(sd);

if( battle_config.atc_gmonly && !lv_gm )
return;
if( lv_gm < (lv=get_atcommand_level(atcommand_broadcast)) )
return;

if (lv_gm >= 20 && lv_gm < 40)
  { color = 0xFF0000; strcpy(title, "Support"); }
else if (lv_gm >= 40 && lv_gm < 60)
  { color = 0x800000; strcpy(title, "Event GM"); }
else if (lv_gm >= 60 && lv_gm < 80)
  { color = 0x4B0082; strcpy(title, "Sub GM"); }
else if (lv_gm >= 80 && lv_gm < 99)
  { color = 0x0000FF; strcpy(title, "GM"); }
else if (lv_gm == 99)
  { color = 0xFF0000; strcpy(title, "Administrator"); }

sprintf(output, "[%s] %s", title, msg);
// as the length varies depending on the command used, just block unreasonably long strings
len = mes_len_check(output, strlen(output) + 1, CHAT_SIZE_MAX);

intif_broadcast2(output, len, color, 0x190, 12, 0, 0);

if(log_config.gm && lv >= log_config.gm) {
char logmsg[CHAT_SIZE_MAX+4];
sprintf(logmsg, "/b %s", msg);
log_atcommand(sd, logmsg);
}
}

And yeah, stop bumping like that

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

where will i put that?

here? clif.c -> clif_parse_Broadcast

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

Yes, replace your current clif_parse_Broadcast in clif.c with the one FatalEror posted and recompile.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

okay thanks guys /no1

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