Jump to content
  • 0

How to put delay of 30secs on @main shout


zmref

Question


  • Group:  Members
  • Topic Count:  148
  • Topics Per Day:  0.03
  • Content Count:  299
  • Reputation:   6
  • Joined:  06/14/12
  • Last Seen:  

*===================================
* Main chat [LuzZza]
* Usage: @main <on|off|message>
*-----------------------------------*/
ACMD_FUNC(main)
{
    if( message[0] ) {

        if(strcmpi(message, "on") == 0) {
            if(!sd->state.mainchat) {
                sd->state.mainchat = 1;
                clif_displaymessage(fd, msg_txt(380)); // Main chat has been activated.
            } else {
                clif_displaymessage(fd, msg_txt(381)); // Main chat already activated.
            }
        } else if(strcmpi(message, "off") == 0) {
            if(sd->state.mainchat) {
                sd->state.mainchat = 0;
                clif_displaymessage(fd, msg_txt(382)); // Main chat has been disabled.
            } else {
                clif_displaymessage(fd, msg_txt(383)); // Main chat already disabled.
            }
        } else {
            if(!sd->state.mainchat) {
                sd->state.mainchat = 1;
                clif_displaymessage(fd, msg_txt(380)); // Main chat has been activated.
            }
            if (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) {
                clif_displaymessage(fd, msg_txt(387));
                return -1;
            }

            // send the message using inter-server system
            intif_main_message( sd, message );
        }
        
    } else {
    
        if(sd->state.mainchat)
            clif_displaymessage(fd, msg_txt(384)); // Main chat currently enabled. Usage: @main <on|off>, @main <message>.
        else
            clif_displaymessage(fd, msg_txt(385)); // Main chat currently disabled. Usage: @main <on|off>, @main <message>.
    }
    return 0;
}
 

 

 

How to put a delay time of 30 seconds per @main shout? what do I put and where? please help

 

 

Link to comment
Share on other sites

3 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:  

you can refer this ...and edit your @main

@go_delay_when_hit

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  148
  • Topics Per Day:  0.03
  • Content Count:  299
  • Reputation:   6
  • Joined:  06/14/12
  • Last Seen:  

you can refer this ...and edit your @main

@go_delay_when_hit

 

not working

 

 

We are still in the @go function

  • scroll down until you find this inside the function:nullpo_retr(-1, sd);
  • then add below:
if(DIFF_TICK(sd->warpgodelay_tick,tick)>0) { //This is for computing the delay if the cooldown or delay is not yet finish restrict using @go clif_displaymessage(fd,"There is a 5 seconds delay in using @go command"); return 0; }
 

 

here's mine

*===================================
* Main chat [LuzZza]
* Usage: @main <on|off|message>
*-----------------------------------*/
ACMD_FUNC(main)
{
unsigned int tick = gettick(); //@main
if( message[0] ) {

if(strcmpi(message, "on") == 0) {
if(!sd->state.mainchat) {
sd->state.mainchat = 1;
clif_displaymessage(fd, msg_txt(380)); // Main chat has been activated.
} else {
clif_displaymessage(fd, msg_txt(381)); // Main chat already activated.
}
} else if(strcmpi(message, "off") == 0) {
if(sd->state.mainchat) {
sd->state.mainchat = 0;
clif_displaymessage(fd, msg_txt(382)); // Main chat has been disabled.
} else {
clif_displaymessage(fd, msg_txt(383)); // Main chat already disabled.
}
} else {
if(!sd->state.mainchat) {
sd->state.mainchat = 1;
clif_displaymessage(fd, msg_txt(380)); // Main chat has been activated.
}
if (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) {
clif_displaymessage(fd, msg_txt(387));
return -1;
}

if(DIFF_TICK(sd->maindelay_tick,tick)>0) { //This is for computing the delay if the cooldown or delay is not yet finish restrict using @main clif_displaymessage(fd,"There is a 30 seconds delay in using @main command"); return 0; }

// send the message using inter-server system intif_main_message( sd, message ); } } else { if(sd->state.mainchat) clif_displaymessage(fd, msg_txt(384)); // Main chat currently enabled. Usage: @main <on|off>, @main <message>. else clif_displaymessage(fd, msg_txt(385)); // Main chat currently disabled. Usage: @main <on|off>, @main <message>. } return 0; }

 

 

 

there's no nullpo_retr(-1, sd);

so that's why I put the command somewhere

 

please correct me.

 

Edited by zmref
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  148
  • Topics Per Day:  0.03
  • Content Count:  299
  • Reputation:   6
  • Joined:  06/14/12
  • Last Seen:  

Hi can anybody script me the @main with 30 secs delay to use and only the GM can use @main on and off not the normal player.

the normal player only uses @main with 30 secs delay

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