Diconfrost VaNz Posted December 8, 2011 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
Legato Posted December 8, 2011 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
Diconfrost VaNz Posted December 8, 2011 Author 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
whitesn Posted December 8, 2011 Posted December 8, 2011 FYI it's the src not script ok.. remove the "+" Quote
Diconfrost VaNz Posted December 8, 2011 Author 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
whitesn Posted December 8, 2011 Posted December 8, 2011 that is a source modification or addition not an NPC script.. yourserver/src/map/atcommand.c Quote
Diconfrost VaNz Posted December 8, 2011 Author 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
Kenpachi Posted December 8, 2011 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
Diconfrost VaNz Posted December 9, 2011 Author 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
Diconfrost VaNz Posted December 9, 2011 Author Posted December 9, 2011 how to disable the /b command? xD Quote
Kenpachi Posted December 10, 2011 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
Ind Posted December 10, 2011 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
Diconfrost VaNz Posted December 11, 2011 Author Posted December 11, 2011 @Ind = but how can i integrate the /b to my new @broadcast command? Quote
CalciumKid Posted December 12, 2011 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
FatalEror Posted December 12, 2011 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
Diconfrost VaNz Posted December 12, 2011 Author Posted December 12, 2011 where will i put that? here? clif.c -> clif_parse_Broadcast Quote
Kenpachi Posted December 12, 2011 Posted December 12, 2011 Yes, replace your current clif_parse_Broadcast in clif.c with the one FatalEror posted and recompile. 1 Quote
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.
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.