BuLaLaKaW Posted November 25, 2011 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 November 25, 2011 src/map/atcommand.c add in line 1842: /*========================================== * @afk by Rad, built on by Tubby * same as autotrade, but works without vending *------------------------------------------*/ int atcommand_afk(const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag ) { if (!message || !*message) { chat_createpcchat(sd, "(@afk) mail me~", "", 1, 1); trade_tradeack(sd,4); sd->state.autotrade = 1; if( battle_config.at_timeout ) { int timeout = atoi(message); status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); } clif_authfail_fd(fd, 15); } if((strlen(message) < 0)||(strlen(message) > 36)) { chat_createpcchat(sd, "(@afk) mail me~", "", 1, 1); trade_tradeack(sd,4); sd->state.autotrade = 1; if( battle_config.at_timeout ) { int timeout = atoi(message); status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); } clif_authfail_fd(fd, 15); } chat_createpcchat(sd, message, "", 1, 1); trade_tradeack(sd,4); sd->state.autotrade = 1; if( battle_config.at_timeout ) { int timeout = atoi(message); status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); } clif_authfail_fd(fd, 15); } else clif_displaymessage(fd, "AFK is not allowed on this map."); return 0; } src/map/atcommand.c add in line 8927: { "afk", 40,40, atcommand_afk }, I would like to ask on how to place a check like only this range of class can use @afk command if ( class <= 6 ) mes "Not possible"; close; Quote Link to comment Share on other sites More sharing options...
Dinze Posted November 25, 2011 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 34 Reputation: 4 Joined: 11/09/11 Last Seen: August 4, 2016 Share Posted November 25, 2011 (edited) Try pcdb_checkid(job/class id). I am not sure with this but you give it a try. Edited November 25, 2011 by Genuine Quote Link to comment Share on other sites More sharing options...
Kenpachi Posted November 25, 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 November 25, 2011 You can check the players class with sd->class_&MAPID_UPPERMASK and this enumaration (taken from map.h): enum {MAPID_NOVICE = 0x0,MAPID_SWORDMAN,MAPID_MAGE,MAPID_ARCHER,MAPID_ACOLYTE,MAPID_MERCHANT,MAPID_THIEF,MAPID_TAEKWON,MAPID_WEDDING,MAPID_GUNSLINGER,MAPID_NINJA,MAPID_XMAS,MAPID_SUMMER,//2_1 classesMAPID_SUPER_NOVICE = JOBL_2_1|0x0,MAPID_KNIGHT,MAPID_WIZARD,MAPID_HUNTER,MAPID_PRIEST,MAPID_BLACKSMITH,MAPID_ASSASSIN,MAPID_STAR_GLADIATOR,//2_2 classesMAPID_CRUSADER = JOBL_2_2|0x1,MAPID_SAGE,MAPID_BARDDANCER,MAPID_MONK,MAPID_ALCHEMIST,MAPID_ROGUE,MAPID_SOUL_LINKER,//1-1, advancedMAPID_NOVICE_HIGH = JOBL_UPPER|0x0,MAPID_SWORDMAN_HIGH,MAPID_MAGE_HIGH,MAPID_ARCHER_HIGH,MAPID_ACOLYTE_HIGH,MAPID_MERCHANT_HIGH,MAPID_THIEF_HIGH,//2_1 advancedMAPID_LORD_KNIGHT = JOBL_UPPER|JOBL_2_1|0x1,MAPID_HIGH_WIZARD,MAPID_SNIPER,MAPID_HIGH_PRIEST,MAPID_WHITESMITH,MAPID_ASSASSIN_CROSS,//2_2 advancedMAPID_PALADIN = JOBL_UPPER|JOBL_2_2|0x1,MAPID_PROFESSOR,MAPID_CLOWNGYPSY,MAPID_CHAMPION,MAPID_CREATOR,MAPID_STALKER,//1-1 babyMAPID_BABY = JOBL_BABY|0x0,MAPID_BABY_SWORDMAN,MAPID_BABY_MAGE,MAPID_BABY_ARCHER,MAPID_BABY_ACOLYTE,MAPID_BABY_MERCHANT,MAPID_BABY_THIEF,MAPID_BABY_TAEKWON,//2_1 babyMAPID_SUPER_BABY = JOBL_BABY|JOBL_2_1|0x0,MAPID_BABY_KNIGHT,MAPID_BABY_WIZARD,MAPID_BABY_HUNTER,MAPID_BABY_PRIEST,MAPID_BABY_BLACKSMITH,MAPID_BABY_ASSASSIN,MAPID_BABY_STAR_GLADIATOR,//2_2 babyMAPID_BABY_CRUSADER = JOBL_BABY|JOBL_2_2|0x1,MAPID_BABY_SAGE,MAPID_BABY_BARDDANCER,MAPID_BABY_MONK,MAPID_BABY_ALCHEMIST,MAPID_BABY_ROGUE,MAPID_BABY_SOUL_LINKER,};[/codeBOX]Example:[code]if(sd->class_&MAPID_UPPERMASK == MAPID_NOVICE) clif_displaymessage(sd->fd, "You're a Novice.");[/code]//EDIT:I think you want to disable @afk for Novices and 1st class characters.Just add this:[code]if(sd->class_&MAPID_UPPERMASK < MAPID_TAEKWON){ clif_displaymessage(sd->fd, "You are not allowed to use @afk!"); return -1;}[/code]below:[code]nullpo_retr(-1, sd);[/code]and recompile. Quote Link to comment Share on other sites More sharing options...
BuLaLaKaW Posted December 1, 2011 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 125 Reputation: 7 Joined: 11/19/11 Last Seen: August 20, 2021 Author Share Posted December 1, 2011 Hi Kenpach! I would like to restrict all jobs that are not transcendent and base level of 90 to do @afk , how will I do it ? thanks Quote Link to comment Share on other sites More sharing options...
manabeast Posted December 2, 2011 Group: Members Topic Count: 138 Topics Per Day: 0.03 Content Count: 835 Reputation: 25 Joined: 11/22/11 Last Seen: December 4, 2012 Share Posted December 2, 2011 i also need this guide =) i no understand here.(in map.h) enum { if(sd->class_&MAPID_UPPERMASK == MAPID_NOVICE) clif_displaymessage(sd->fd, "You're a Novice."); (edit MAPID_NOVICE = 0x0, if i dun wan novice use @afk?) if(sd->class_&MAPID_UPPERMASK < MAPID_TAEKWON) { clif_displaymessage(sd->fd, "You are not allowed to use @afk!"); return -1; } nullpo_retr(-1, sd); MAPID_SWORDMAN, MAPID_MAGE, MAPID_ARCHER, MAPID_ACOLYTE, MAPID_MERCHANT, MAPID_THIEF, do the same for other like this on every job i dun wan they have ? (swordman,acolyte,merchant etc.) Quote Link to comment Share on other sites More sharing options...
Kenpachi Posted December 2, 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 2, 2011 Hi Kenpach! I would like to restrict all jobs that are not transcendent and base level of 90 to do @afk , how will I do it ? thanks Just change the condition from if(sd->class_&MAPID_UPPERMASK < MAPID_TAEKWON) to if(sd->class_&MAPID_UPPERMASK >= MAPID_NOVICE_HIGH && sd->class_&MAPID_UPPERMASK < MAPID_BABY && sd->status.base_level >= 90) @manabeast: Sorry, I don't understand your problem. Quote Link to comment Share on other sites More sharing options...
BuLaLaKaW Posted December 3, 2011 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 125 Reputation: 7 Joined: 11/19/11 Last Seen: August 20, 2021 Author Share Posted December 3, 2011 (edited) Hi Kenpachi, Tried to do this to allow @afk only good for 90 or above. if( sd->status.base_level >= 90 ) { clif_displaymessage(sd->fd, "Characters with base level 90 or above can use @afk!"); return -1; } but it did not work help ... Can I also ask how to do the same as with @autotrade /*========================================== * @autotrade by durf [Lupus] [Paradox924X] * Turns on/off Autotrade for a specific player *------------------------------------------*/ ACMD_FUNC(autotrade) { nullpo_retr(-1, sd); if( sd->status.base_level >= 90 ) { clif_displaymessage(sd->fd, "Characters with base level 90 or above can use @autotrade or @at!"); return -1; } if( map[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag ) { clif_displaymessage(fd, "Autotrade is not allowed on this map."); return -1; } if( pc_isdead(sd) ) { clif_displaymessage(fd, "Cannot Autotrade if you are dead."); return -1; } if( !sd->state.vending && !sd->state.buyingstore ) { //check if player is vending or buying clif_displaymessage(fd, msg_txt(549)); // "You should have a shop open to use @autotrade." return -1; } sd->state.autotrade = 1; if( battle_config.at_timeout ) { int timeout = atoi(message); status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 6000$ } clif_authfail_fd(fd, 15); return 0; } Edited December 3, 2011 by MarcuZ Quote Link to comment Share on other sites More sharing options...
Kenpachi Posted December 5, 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 5, 2011 Hi Kenpachi, Tried to do this to allow @afk only good for 90 or above. if( sd->status.base_level >= 90 ) { clif_displaymessage(sd->fd, "Characters with base level 90 or above can use @afk!"); return -1; } but it did not work The message will be shown if the characters base level is greater than 89. Change >= 90 to < 90 Now you'll see the message if your characters base level islower than 90. Can I also ask how to do the same as with @autotrade Same thing. just add a check like this below nullpo_retr(-1, sd); Quote Link to comment Share on other sites More sharing options...
manabeast Posted December 5, 2011 Group: Members Topic Count: 138 Topics Per Day: 0.03 Content Count: 835 Reputation: 25 Joined: 11/22/11 Last Seen: December 4, 2012 Share Posted December 5, 2011 (edited) pls ignore previous question. becos i change my mind. can i ask one thing? default is people who active vending skill can @afk / autotrade? because i just wan ppl vending only can @afk/autotrade include people using pushcart clips(any job) Edited December 5, 2011 by manabeast Quote Link to comment Share on other sites More sharing options...
Kenpachi Posted December 5, 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 5, 2011 So your goal is to allow @afk only if the player is vending? If yes add if(!sd->state.vending) { clif_displaymessage(fd, "@AFK is only allowed when vending!"); return -1; } below nullpo_retr(-1, sd); and recompile. Quote Link to comment Share on other sites More sharing options...
BuLaLaKaW Posted December 8, 2011 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 125 Reputation: 7 Joined: 11/19/11 Last Seen: August 20, 2021 Author Share Posted December 8, 2011 @kenpachi, I think it did work before. It was a logical error I made. Thanks a lot! Quote Link to comment Share on other sites More sharing options...
Question
BuLaLaKaW
I would like to ask on how to place a check like only this range of class can use @afk command
if ( class <= 6 )
mes "Not possible";
close;
Link to comment
Share on other sites
10 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.