Jump to content
  • 0

How Can I Prevent Fly Wing/Butterfly Wing and Teleport Skill


KazumaSatou

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  145
  • Reputation:   36
  • Joined:  05/15/20
  • Last Seen:  

Can anyone help me on how to prevent usage of Fly Wing, Butterfly Wing and Teleport Skill when attacked by "Player" on a field/dungeon that is PVP On?
But if the player didn't attack/attacked by any player, he/she can use those items/skill and like a normal map.

But if the player attack other player or being attacked by other player, he/she can't use it.

I tried to add this on skill.cpp but it doesn't work.

	case AL_TELEPORT:
	case ALL_ODINS_RECALL:
		if(sd)
		{
			+ if (!battle_config.prevent_logout || sd->canlog_tick == 0 || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) {
			+ 	char output[128];
			+ 	sprintf(output, "Please wait %d seconds before warping.", battle_config.prevent_logout/1000);
			+ 	clif_displaymessage(sd->fd, output);
			+ 	break;
			+ }

This code is from @Mabuhay's @go/@warp prevents when attacked/attack.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  215
  • Reputation:   45
  • Joined:  05/03/13
  • Last Seen:  

Hello,

I didn't try it but maybe you need this:

				clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
				skill_failed(sd);
				return 0;

inside your new if?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  145
  • Reputation:   36
  • Joined:  05/15/20
  • Last Seen:  

1 hour ago, Kreustoo said:

Hello,

I didn't try it but maybe you need this:


				clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
				skill_failed(sd);
				return 0;

inside your new if?

Maybe, but it won't show the message so it didn't trigger the script I added.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  215
  • Reputation:   45
  • Joined:  05/03/13
  • Last Seen:  

@KazumaSatou Ah you didn't precise it wasn't even going in your if in your first message ?

If someone can just tell you were you're wrong it'll be faster but I never worked with logout protection and when I don't know where the problem is coming from, I print everything:

			+ 	char output2[128];
			+ 	sprintf(output2, "Info prev: %d, tick: %d, difftick: %d", battle_config.prevent_logout,sd->canlog_tick == 0,DIFF_TICK(gettick(), sd->canlog_tick));
			+ 	clif_displaymessage(sd->fd, output2);

Just before the if

And even if it works, you'll have to figure out how to make the protetion pop out only for pvp players. So you'll have to put add a new parameter to struct map_session_data and add new verification next to sd->canlog_tick.

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...