Vengeance Posted January 9, 2012 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 65 Reputation: 13 Joined: 01/08/12 Last Seen: February 19, 2015 Share Posted January 9, 2012 (edited) Hi guys i made this simple modification to stop corruption in my server... This little snippet would allow you to stop GMs from abusing @monster command.. it will announce the Monster name, Amount and also the location with the GM name so its very easy to know if it was for an Purpose or just for abuse.... /*========================================== * *------------------------------------------*/ ACMD_FUNC(monster) { char name[NAME_LENGTH]; char monster[NAME_LENGTH]; int mob_id; int number = 0; int count; int i, k, range; short mx, my; nullpo_retr(-1, sd); memset(name, '0', sizeof(name)); memset(monster, '0', sizeof(monster)); memset(atcmd_output, '0', sizeof(atcmd_output)); if (!message || !*message) { clif_displaymessage(fd, msg_txt(80)); // Give the display name or monster name/id please. return -1; } if (sscanf(message, ""%23[^"]" %23s %d", name, monster, &number) > 1 || sscanf(message, "%23s "%23[^"]" %d", monster, name, &number) > 1) { //All data can be left as it is. } else if ((count=sscanf(message, "%23s %d %23s", monster, &number, name)) > 1) { //Here, it is possible name was not given and we are using monster for it. if (count < 3) //Blank mob's name. name[0] = '0'; } else if (sscanf(message, "%23s %23s %d", name, monster, &number) > 1) { //All data can be left as it is. } else if (sscanf(message, "%23s", monster) > 0) { //As before, name may be already filled. name[0] = '0'; } else { clif_displaymessage(fd, msg_txt(80)); // Give a display name and monster name/id please. return -1; } if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number) mob_id = mobdb_checkid(atoi(monster)); if (mob_id == 0) { clif_displaymessage(fd, msg_txt(40)); // Invalid monster ID or name. return -1; } if (mob_id == MOBID_EMPERIUM) { clif_displaymessage(fd, msg_txt(83)); // Monster 'Emperium' cannot be spawned. return -1; } if (number <= 0) number = 1; if (strlen(name) < 1) strcpy(name, "--ja--"); // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive if (battle_config.atc_spawn_quantity_limit && number > battle_config.atc_spawn_quantity_limit) number = battle_config.atc_spawn_quantity_limit; if (battle_config.etc_log) ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)n", command, monster, name, mob_id, number, sd->bl.x, sd->bl.y); count = 0; range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around) for (i = 0; i < number; i++) { map_search_freecell(&sd->bl, 0, &mx, &my, range, range, 0); k = mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, ""); count += (k != 0) ? 1 : 0; } if (count != 0) if (number == count){ if(pc_isGM(sd)==99){ // Checks if the GM level is below 99 Announcement is made [Vengeance] clif_displaymessage(fd, msg_txt(39)); // All monster summoned! } else { sprintf(atcmd_output, "%s summoned %d %s in %s,%d,%d", sd->status.name,number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y); intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0); clif_displaymessage(fd, msg_txt(39)); // All monster summoned! } } else { sprintf(atcmd_output, "%s summoned %d %s in %s,%d,%d", sd->status.name,number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y); intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0); sprintf(atcmd_output, msg_txt(240), count); // %d monster(s) summoned! clif_displaymessage(fd, atcmd_output); } else { clif_displaymessage(fd, msg_txt(40)); // Invalid monster ID or name. return -1; } return 0; } // small monster spawning [Valaris] ACMD_FUNC(monstersmall) { char name[NAME_LENGTH] = ""; char monster[NAME_LENGTH] = ""; int mob_id = 0; int number = 0; int x = 0; int y = 0; int count; int i; nullpo_retr(-1, sd); if (!message || !*message) { clif_displaymessage(fd, "Give a monster name/id please."); return -1; } if (sscanf(message, ""%23[^"]" %23s %d %d %d", name, monster, &number, &x, &y) < 2 && sscanf(message, "%23s "%23[^"]" %d %d %d", monster, name, &number, &x, &y) < 2 && sscanf(message, "%23s %d %23s %d %d", monster, &number, name, &x, &y) < 1) { clif_displaymessage(fd, "Give a monster name/id please."); return -1; } // If monster identifier/name argument is a name if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number) mob_id = atoi(monster); if (mob_id == 0) { clif_displaymessage(fd, msg_txt(40)); return -1; } if (mob_id == MOBID_EMPERIUM) { clif_displaymessage(fd, msg_txt(83)); // Cannot spawn emperium return -1; } if (mobdb_checkid(mob_id) == 0) { clif_displaymessage(fd, "Invalid monster ID"); // Invalid Monster ID. return -1; } if (number <= 0) number = 1; if (strlen(name) < 1) strcpy(name, "--ja--"); // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive if (battle_config.atc_spawn_quantity_limit >= 1 && number > battle_config.atc_spawn_quantity_limit) number = battle_config.atc_spawn_quantity_limit; count = 0; for (i = 0; i < number; i++) { int mx, my; if (x <= 0) mx = sd->bl.x + (rand() % 11 - 5); else mx = x; if (y <= 0) my = sd->bl.y + (rand() % 11 - 5); else my = y; count += (mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, "2") != 0) ? 1 : 0; } if (count != 0) { if(pc_isGM(sd)==99){// Checks if the GM level is below 99 Announcement is made [Vengeance] clif_displaymessage(fd, msg_txt(39)); // All monster summoned! } else{ sprintf(atcmd_output, "%s summoned %d small %s in %s,%d,%d", sd->status.name, number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y); intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0); clif_displaymessage(fd, msg_txt(39)); // Monster Summoned!! } } else clif_displaymessage(fd, msg_txt(40)); // Invalid Monster ID. return 0; } // big monster spawning [Valaris] ACMD_FUNC(monsterbig) { char name[NAME_LENGTH] = ""; char monster[NAME_LENGTH] = ""; int mob_id = 0; int number = 0; int x = 0; int y = 0; int count; int i; nullpo_retr(-1, sd); if (!message || !*message) { clif_displaymessage(fd, "Give a monster name/id please."); return -1; } if (sscanf(message, ""%23[^"]" %23s %d %d %d", name, monster, &number, &x, &y) < 2 && sscanf(message, "%23s "%23[^"]" %d %d %d", monster, name, &number, &x, &y) < 2 && sscanf(message, "%23s %d %23s %d %d", monster, &number, name, &x, &y) < 1) { clif_displaymessage(fd, "Give a monster name/id please."); return -1; } // If monster identifier/name argument is a name if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number) mob_id = atoi(monster); if (mob_id == 0) { clif_displaymessage(fd, msg_txt(40)); return -1; } if (mob_id == MOBID_EMPERIUM) { clif_displaymessage(fd, msg_txt(83)); // Cannot spawn emperium return -1; } if (mobdb_checkid(mob_id) == 0) { clif_displaymessage(fd, "Invalid monster ID"); // Invalid Monster ID. return -1; } if (number <= 0) number = 1; if (strlen(name) < 1) strcpy(name, "--ja--"); // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive if (battle_config.atc_spawn_quantity_limit >= 1 && number > battle_config.atc_spawn_quantity_limit) number = battle_config.atc_spawn_quantity_limit; count = 0; for (i = 0; i < number; i++) { int mx, my; if (x <= 0) mx = sd->bl.x + (rand() % 11 - 5); else mx = x; if (y <= 0) my = sd->bl.y + (rand() % 11 - 5); else my = y; count += (mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, "4") != 0) ? 1 : 0; } if (count != 0) { if(pc_isGM(sd)==99){// Checks if the GM level is below 99 Announcement is made [Vengeance] clif_displaymessage(fd, msg_txt(39)); // All monster summoned! } else{ sprintf(atcmd_output, "%s summoned %d big %s in %s,%d,%d", sd->status.name, number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y); intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0); clif_displaymessage(fd, msg_txt(39)); // Monster Summoned!! } } else clif_displaymessage(fd, msg_txt(40)); // Invalid Monster ID. return 0; } Just copy paste this Snippet. Download from here Edited January 9, 2012 by Vengeance 5 Quote Link to comment Share on other sites More sharing options...
Team Infamous Posted January 9, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 18 Reputation: 0 Joined: 01/04/12 Last Seen: July 17, 2016 Share Posted January 9, 2012 Nice. Quote Link to comment Share on other sites More sharing options...
Vengeance Posted January 9, 2012 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 65 Reputation: 13 Joined: 01/08/12 Last Seen: February 19, 2015 Author Share Posted January 9, 2012 thank you please give reviews about the mod to motivate so I release more useful mods to the community Quote Link to comment Share on other sites More sharing options...
Igniz Posted January 9, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 69 Reputation: 15 Joined: 12/06/11 Last Seen: August 7, 2024 Share Posted January 9, 2012 Pretty nice, but it will be better if you set a battle configuration to set the gm level that will broadcast the info and broadcast the spawner gm, would be better. Tnks in advance, good mod Quote Link to comment Share on other sites More sharing options...
Vengeance Posted January 10, 2012 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 65 Reputation: 13 Joined: 01/08/12 Last Seen: February 19, 2015 Author Share Posted January 10, 2012 Well thats possible but I just made it for a request so I thought that this much would be enough... Quote Link to comment Share on other sites More sharing options...
Nigthscrawler Posted January 16, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 1 Reputation: 0 Joined: 01/16/12 Last Seen: January 3, 2014 Share Posted January 16, 2012 Nice, but i have a question, how install this code in the server, i new in this xD and need help =) Quote Link to comment Share on other sites More sharing options...
Vengeance Posted January 20, 2012 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 65 Reputation: 13 Joined: 01/08/12 Last Seen: February 19, 2015 Author Share Posted January 20, 2012 You need to copy the code and edit the original monster code and then compile your server Quote Link to comment Share on other sites More sharing options...
Syllabear Posted January 20, 2012 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 13 Reputation: 0 Joined: 12/27/11 Last Seen: August 8, 2013 Share Posted January 20, 2012 Wow...this is cool.... Sir can u also make a source if a GM creates an item or @item command and only the lvl 99 GM only will see Quote Link to comment Share on other sites More sharing options...
Diconfrost VaNz Posted January 21, 2012 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 January 21, 2012 where would i put that? map.h? Quote Link to comment Share on other sites More sharing options...
Gerome Posted January 21, 2012 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 185 Reputation: 26 Joined: 12/07/11 Last Seen: January 31 Share Posted January 21, 2012 Nice Im Using it Now.. hehe Keep it up! Quote Link to comment Share on other sites More sharing options...
myieee Posted January 23, 2012 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 83 Reputation: 0 Joined: 12/07/11 Last Seen: November 29, 2020 Share Posted January 23, 2012 where would i put that? map.h? src > map > atcommand.c Quote Link to comment Share on other sites More sharing options...
Vengeance Posted January 25, 2012 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 65 Reputation: 13 Joined: 01/08/12 Last Seen: February 19, 2015 Author Share Posted January 25, 2012 Wow...this is cool.... Sir can u also make a source if a GM creates an item or @item command and only the lvl 99 GM only will see I will try to do that... Quote Link to comment Share on other sites More sharing options...
Innos Posted March 5, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.01 Content Count: 62 Reputation: 5 Joined: 08/23/17 Last Seen: March 11, 2019 Share Posted March 5, 2012 Nice small Snippet. But i mean the most GM spawn with Monster ID. for normal Player looks this abnormal. A Broadcast with GM XX spawned 1002 100 on Map x,x isn't better to change all id's automatically in monster name? Quote Link to comment Share on other sites More sharing options...
BuLaLaKaW Posted March 5, 2012 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 125 Reputation: 7 Joined: 11/19/11 Last Seen: August 20, 2021 Share Posted March 5, 2012 Nice small Snippet. But i mean the most GM spawn with Monster ID. for normal Player looks this abnormal. A Broadcast with GM XX spawned 1002 100 on Map x,x isn't better to change all id's automatically in monster name? it is very simple, see script command below. *getmonsterinfo(<mob ID>,<type>) This function will look up the monster with the specified ID number in the mob database and return the info set by TYPE argument. It will return -1 if there is no such monster (or the type value is invalid), or "null" if you requested the monster's name. Valid types are listed in const.txt: MOB_NAME 0 MOB_LV 1 MOB_MAXHP 2 MOB_BASEEXP 3 MOB_JOBEXP 4 MOB_ATK1 5 MOB_ATK2 6 MOB_DEF 7 MOB_MDEF 8 MOB_STR 9 MOB_AGI 10 MOB_VIT 11 MOB_INT 12 JOB_DEX 13 MOB_LUK 14 MOB_RANGE 15 MOB_RANGE2 16 MOB_RANGE3 17 MOB_SIZE 18 MOB_RACE 19 MOB_ELEMENT 20 MOB_MODE 21 so you can just replace the part where it will announce the mob id into "+getmonsterinfo(<mob ID>,0)+" thanks for the share! another option is not to let your GM summon any monster at all. imagine summoning 1000 treasure chest Quote Link to comment Share on other sites More sharing options...
Sharpienero Posted March 5, 2012 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 386 Reputation: 28 Joined: 01/16/12 Last Seen: January 6, 2023 Share Posted March 5, 2012 Awesome! I think this should log it into cmd file though, instead of broadcasting it. Quote Link to comment Share on other sites More sharing options...
Belkan Posted March 23, 2012 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 33 Reputation: 0 Joined: 03/09/12 Last Seen: April 15, 2020 Share Posted March 23, 2012 can you update the @monster patch pls? it isn't compatible with new rathena svn change if(pc_isGM(sd)==99) to if(pc_get_group_level(sd)==99) Quote Link to comment Share on other sites More sharing options...
Trevned Posted May 5, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 18 Reputation: 0 Joined: 04/29/12 Last Seen: October 24, 2013 Share Posted May 5, 2012 Great script thanks alot Quote Link to comment Share on other sites More sharing options...
Meister Posted May 13, 2012 Group: Members Topic Count: 280 Topics Per Day: 0.06 Content Count: 841 Reputation: 17 Joined: 04/16/12 Last Seen: March 4, 2024 Share Posted May 13, 2012 Nice small Snippet. But i mean the most GM spawn with Monster ID. for normal Player looks this abnormal. A Broadcast with GM XX spawned 1002 100 on Map x,x isn't better to change all id's automatically in monster name? it is very simple, see script command below. *getmonsterinfo(<mob ID>,<type>) This function will look up the monster with the specified ID number in the mob database and return the info set by TYPE argument. It will return -1 if there is no such monster (or the type value is invalid), or "null" if you requested the monster's name. Valid types are listed in const.txt: MOB_NAME 0 MOB_LV 1 MOB_MAXHP 2 MOB_BASEEXP 3 MOB_JOBEXP 4 MOB_ATK1 5 MOB_ATK2 6 MOB_DEF 7 MOB_MDEF 8 MOB_STR 9 MOB_AGI 10 MOB_VIT 11 MOB_INT 12 JOB_DEX 13 MOB_LUK 14 MOB_RANGE 15 MOB_RANGE2 16 MOB_RANGE3 17 MOB_SIZE 18 MOB_RACE 19 MOB_ELEMENT 20 MOB_MODE 21 so you can just replace the part where it will announce the mob id into "+getmonsterinfo(<mob ID>,0)+" thanks for the share! another option is not to let your GM summon any monster at all. imagine summoning 1000 treasure chest where can I see the "+getmonserinfo" Quote Link to comment Share on other sites More sharing options...
Brynner Posted July 8, 2012 Group: Members Topic Count: 120 Topics Per Day: 0.02 Content Count: 1962 Reputation: 202 Joined: 01/08/12 Last Seen: 1 minute ago Share Posted July 8, 2012 the patch is now outdated to the latest revision. how to implement this on the latest revision? bump for this. is there anyone knows how to implement this on the latest version? Quote Link to comment Share on other sites More sharing options...
Cydh Posted September 7, 2012 Group: Developer Topic Count: 153 Topics Per Day: 0.03 Content Count: 2285 Reputation: 748 Joined: 06/16/12 Last Seen: February 21 Share Posted September 7, 2012 nice. Quote Link to comment Share on other sites More sharing options...
Brynner Posted September 7, 2012 Group: Members Topic Count: 120 Topics Per Day: 0.02 Content Count: 1962 Reputation: 202 Joined: 01/08/12 Last Seen: 1 minute ago Share Posted September 7, 2012 nice. i think this is not working on the latest revision. Quote Link to comment Share on other sites More sharing options...
Cydh Posted September 7, 2012 Group: Developer Topic Count: 153 Topics Per Day: 0.03 Content Count: 2285 Reputation: 748 Joined: 06/16/12 Last Seen: February 21 Share Posted September 7, 2012 nice. i think this is not working on the latest revision. i didnt try yet, i said "nice" for the share, I'll try this soon. and badly I dont use latest revision too. Quote Link to comment Share on other sites More sharing options...
Brynner Posted September 7, 2012 Group: Members Topic Count: 120 Topics Per Day: 0.02 Content Count: 1962 Reputation: 202 Joined: 01/08/12 Last Seen: 1 minute ago Share Posted September 7, 2012 nice. i think this is not working on the latest revision. i didnt try yet, i said "nice" for the share, I'll try this soon. and badly I dont use latest revision too. oh ok. goodluck Quote Link to comment Share on other sites More sharing options...
Cydh Posted September 7, 2012 Group: Developer Topic Count: 153 Topics Per Day: 0.03 Content Count: 2285 Reputation: 748 Joined: 06/16/12 Last Seen: February 21 Share Posted September 7, 2012 It's work bro . u just need patch ur mapserver or open the patch file an rewrite ur atcommand.c file based on @monster patch file. and edit inside ACMD_FUNC(monster), ACMD_FUNC(monstersmall), ACMD_FUNC(monsterbig) Quote Link to comment Share on other sites More sharing options...
Belkan Posted August 25, 2013 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 33 Reputation: 0 Joined: 03/09/12 Last Seen: April 15, 2020 Share Posted August 25, 2013 is there a new version compatible with the new update of rathena? Quote Link to comment Share on other sites More sharing options...
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.