Jump to content
  • 0

Broadcast depending on GM level


Question

Posted

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;
}

22 answers to this question

Recommended Posts

Posted

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));

Posted

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;
}

Posted

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;
}

Posted

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?

Posted

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
Posted

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;
}

Posted

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

Posted

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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...