Jump to content
  • 0

@commands delay


Limestone

Question


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.03
  • Content Count:  647
  • Reputation:   16
  • Joined:  11/21/11
  • Last Seen:  

hi guys.. please help me on this request.. how can i add cooldown or delay on some GM commands?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

maybe you can try refer to this and edit your command

@go_delay_when_hit

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.03
  • Content Count:  647
  • Reputation:   16
  • Joined:  11/21/11
  • Last Seen:  

hmm thats not what i want emistry, hmm example.. delay for @pk command

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

:)

please read the article 1st...

follow the way how they implant the @go delay...

the way is the same..just different commands...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  87
  • Reputation:   1
  • Joined:  11/20/11
  • Last Seen:  

Emistry is right. You should read the guide from the link he provided. You may learn how to add a delay for other commands. Anyway, here's my reply to your question.

Add this piece of code under nullpo_retr(-1, sd); on every command you want to have a delay.

  	 if( DIFF_TICK(gettick(),sd->pkmode_cd) < 60000 ) {
			char timeleft[100];
			sprintf(timeleft,"@pkmode is cooling down, you may use it again after %d seconds",60-(DIFF_TICK(gettick(),sd->pkmode_cd)/1000));
			clif_displaymessage(fd,timeleft);
			return -0;
	}
	sd->pkmode_cd = gettick();

And on pc.h

  unsigned short mapindex;
  unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left.
  unsigned int client_tick;
+  unsigned int pkmode_cd;

You just have to change every pkmode_cd for other commands.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  78
  • Reputation:   0
  • Joined:  02/18/12
  • Last Seen:  

Well, it is "nullpo_h" or "nullpo_c" and where did you add the text ? At the end of all ?

And on "pc.h" do you enter litteraly "client_tick" or the number ?

[because seriously, with the link, it is not so easy to understand...]

Edited by Maxlam
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  43
  • Reputation:   2
  • Joined:  01/17/12
  • Last Seen:  

Well, it is "nullpo_h" or "nullpo_c" and where did you add the text ? At the end of all ?

atcommand.c, in functions ATCMD_FUNC("something"), below "nullpo_retr()" line.

And on "pc.h" do you enter litteraly "client_tick" or the number ?

[because seriously, with the link, it is not so easy to understand...]

"client_tick" should already be there (literally. it's a variable declaration).

The only line you have to add is the line with "+" before it (others should already be there; find them, then add the one line.)

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