Diconfrost VaNz Posted December 8, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Share Posted December 8, 2011 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; } Quote Link to comment Share on other sites More sharing options...
Legato Posted December 8, 2011 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 87 Reputation: 1 Joined: 11/20/11 Last Seen: September 10, 2013 Share Posted December 8, 2011 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)); Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 8, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 8, 2011 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; } Quote Link to comment Share on other sites More sharing options...
whitesn Posted December 8, 2011 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 193 Reputation: 14 Joined: 12/02/11 Last Seen: October 30, 2018 Share Posted December 8, 2011 FYI it's the src not script ok.. remove the "+" Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 8, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 8, 2011 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; } Quote Link to comment Share on other sites More sharing options...
whitesn Posted December 8, 2011 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 193 Reputation: 14 Joined: 12/02/11 Last Seen: October 30, 2018 Share Posted December 8, 2011 that is a source modification or addition not an NPC script.. yourserver/src/map/atcommand.c Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 8, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 8, 2011 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? Quote Link to comment Share on other sites More sharing options...
Kenpachi Posted December 8, 2011 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 764 Reputation: 220 Joined: 11/14/11 Last Seen: November 19, 2020 Share Posted December 8, 2011 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 1 Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 9, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 9, 2011 oh i see...so the only option here is to disable the /b command? ) or force my GM to use the @broadcast command xD Quote Link to comment Share on other sites More sharing options...
CalciumKid Posted December 9, 2011 Group: Members Topic Count: 25 Topics Per Day: 0.01 Content Count: 257 Reputation: 253 Joined: 11/29/11 Last Seen: February 21, 2014 Share Posted December 9, 2011 Correct. Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 9, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 9, 2011 how to disable the /b command? xD Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 9, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 9, 2011 any help? Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 10, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 10, 2011 HELP! xD Quote Link to comment Share on other sites More sharing options...
Kenpachi Posted December 10, 2011 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 764 Reputation: 220 Joined: 11/14/11 Last Seen: November 19, 2020 Share Posted December 10, 2011 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... Quote Link to comment Share on other sites More sharing options...
Ind Posted December 10, 2011 Group: Members Topic Count: 169 Topics Per Day: 0.03 Content Count: 1260 Reputation: 750 Joined: 11/19/11 Last Seen: April 11, 2013 Share Posted December 10, 2011 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; } Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 11, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 11, 2011 @Ind = but how can i integrate the /b to my new @broadcast command? Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 11, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 11, 2011 bump* Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 11, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 11, 2011 bump* Quote Link to comment Share on other sites More sharing options...
CalciumKid Posted December 12, 2011 Group: Members Topic Count: 25 Topics Per Day: 0.01 Content Count: 257 Reputation: 253 Joined: 11/29/11 Last Seen: February 21, 2014 Share Posted December 12, 2011 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. Quote Link to comment Share on other sites More sharing options...
FatalEror Posted December 12, 2011 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 67 Reputation: 23 Joined: 11/14/11 Last Seen: October 3, 2014 Share Posted December 12, 2011 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 1 Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 12, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 12, 2011 where will i put that? here? clif.c -> clif_parse_Broadcast Quote Link to comment Share on other sites More sharing options...
Kenpachi Posted December 12, 2011 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 764 Reputation: 220 Joined: 11/14/11 Last Seen: November 19, 2020 Share Posted December 12, 2011 Yes, replace your current clif_parse_Broadcast in clif.c with the one FatalEror posted and recompile. 1 Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted December 13, 2011 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 996 Reputation: 47 Joined: 11/13/11 Last Seen: Saturday at 06:24 PM Author Share Posted December 13, 2011 okay thanks guys Quote Link to comment Share on other sites More sharing options...
Question
Diconfrost VaNz
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.
Link to comment
Share on other sites
22 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.