Jump to content
  • 0

Help to disable @sleep command on pvp and gvg maps


Petey Pablo

Question


  • Group:  Members
  • Topic Count:  152
  • Topics Per Day:  0.03
  • Content Count:  569
  • Reputation:   11
  • Joined:  11/24/11
  • Last Seen:  

How to disable @sleep command on pvp and gvg maps? See my source code below

int atcommand_sleep(const int fd, struct map_session_data* sd, const char* command, const char* message)
{

   if(!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > 10) {
   if(sd->sc.opt1 != 0 && sd->sc.opt1 != OPT1_SLEEP){
       clif_displaymessage(fd, msg_txt(707)); //Please refrain from trying to abuse this command.
           return -1;
   }
   if(sd->sc.opt1 != OPT1_SLEEP){
       sc_start(&sd->bl, SC_TRICKDEAD, 100, 1, 1000); //Duration does not matters as Trick Dead is "eternal"
       sd->sc.opt1 = OPT1_SLEEP;
       sc_start(&sd->bl,SC_COMA,100,1,skill_get_time2(185,1));
       clif_displaymessage(fd, msg_txt(705)); //You are now asleep.
   } else {
       sd->sc.opt1 = 0;
       clif_emotion(&sd->bl,45);
       status_change_end(&sd->bl, SC_TRICKDEAD, -1);
       sc_start(&sd->bl,SC_COMA,100,1,skill_get_time2(185,1));
       clif_displaymessage(fd, msg_txt(706)); //You are now awake.
   }

       clif_changeoption(&sd->bl);
           return 0;
   }
       clif_displaymessage(fd, msg_txt(707)); //Please refrain from trying to abuse this command.
           return -1;
}

Link to comment
Share on other sites

11 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  

if(map_flag_gvg(sd->bl.m) || map_flag_vs(sd->bl.m)){
   clif_displaymessage(fd, "you can't....");
   return -1;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  152
  • Topics Per Day:  0.03
  • Content Count:  569
  • Reputation:   11
  • Joined:  11/24/11
  • Last Seen:  

if(map_flag_gvg(sd->bl.m) || map_flag_vs(sd->bl.m)){
clif_displaymessage(fd, "you can't....");
return -1;
}

Nothing happens. Not working

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

Show us how you added the check mapflag snippet by QQ.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  152
  • Topics Per Day:  0.03
  • Content Count:  569
  • Reputation:   11
  • Joined:  11/24/11
  • Last Seen:  

here

int atcommand_sleep(const int fd, struct map_session_data* sd, const char* command, const char* message)
{


if(map_flag_gvg(sd->bl.m) || map_flag_vs(sd->bl.m)){
clif_displaymessage(fd, "you can't....");
return -1;
}
if(!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > 10) {
if(sd->sc.opt1 != 0 && sd->sc.opt1 != OPT1_SLEEP){
	clif_displaymessage(fd, msg_txt(707)); //Please refrain from trying to abuse this command.
		return -1;
}
if(sd->sc.opt1 != OPT1_SLEEP){
	sc_start(&sd->bl, SC_TRICKDEAD, 100, 1, 1000); //Duration does not matters as Trick Dead is "eternal"
	sd->sc.opt1 = OPT1_SLEEP;
	sc_start(&sd->bl,SC_COMA,100,1,skill_get_time2(185,1));
	clif_displaymessage(fd, msg_txt(705)); //You are now asleep.
} else {
	sd->sc.opt1 = 0;
	clif_emotion(&sd->bl,45);
	status_change_end(&sd->bl, SC_TRICKDEAD, -1);
	sc_start(&sd->bl,SC_COMA,100,1,skill_get_time2(185,1));
	clif_displaymessage(fd, msg_txt(706)); //You are now awake.
}

	clif_changeoption(&sd->bl);
		return 0;
}
	clif_displaymessage(fd, msg_txt(707)); //Please refrain from trying to abuse this command.
		return -1;
}

Edited by WillSuranol
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

can I ask something 1st ?

isn't that currently atcommand should be looking like this ?

ACMD_FUNC(<command name>)
{
   struct map_session_data* pl_sd;
   nullpo_retr(-1, sd);
.....
   clif_displaymessage(fd, blahblah);
   return 0;
}
.....
ACMD_DEF(<command name>),

how comes yours still using something like 3~4 years old eathena source

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

He is using eAthena.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

how comes yours still using something like 3~4 years old eathena source
He is using eAthena.

xD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

ibrutcOPIRwT26.png

XD

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Development Manager
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  732
  • Reputation:   525
  • Joined:  12/13/11
  • Last Seen:  

@AnnieRuru

It's just a define, nothing more.

#define ACMD_FUNC(x) int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message)

@WillSuranol

Make sure you recompile your source.

There's nothing wrong with using eAthena. :| I use eAthena with bits of merged things from rAthena. I'm just not satisfied with the stability of rAthena yet so I have all my stuff in eAthena since I have renewal working just fine.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Yes, I agree with you Aleos, there's nothing wrong with it ;)

The forum is rA specific, and if the poster doesn't give any information about what is she/he using, then it'll be confusing...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  152
  • Topics Per Day:  0.03
  • Content Count:  569
  • Reputation:   11
  • Joined:  11/24/11
  • Last Seen:  

Topic closed. Thank you guys!

Link to comment
Share on other sites

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.

×
×
  • Create New...