Jump to content

Question

Posted

Hi! to all scripters,

Can I request an npc script like bindatcmd that when a player type "@sell <message>" his/her message will be broadcast to the whole server with a hexcolor on it?

Thank you so much! Have a good day!

4 answers to this question

Recommended Posts

  • 0
Posted
-	script	SellCommand	-1,{
OnInit:
	bindatcmd "sell",strnpcinfo(3) + "::OnSellCommand";
	end;
	
OnSellCommand:
	.@s$ = .@atcmd_parameters$[0];
	announce strcharinfo(0) + ": " + .@s$,bc_all,0x2fe24a;
	end;
}

 

  • 0
Posted (edited)
34 minutes ago, Start_ said:

-	script	SellCommand	-1,{
OnInit:
	bindatcmd "sell",strnpcinfo(3) + "::OnSellCommand";
	end;
	
OnSellCommand:
	.@s$ = .@atcmd_parameters$[0];
	announce strcharinfo(0) + ": " + .@s$,bc_all,0x2fe24a;
	end;
}

 

Thank you so much Sir! you're the best.

Is it okay if you can put a time on it so it wont be spammable?  Like, you can only use this every 30 seconds? then if you try to use again there is a message that will say you can only use this every 30 secconds

 

Edited by DrakeSky
  • 0
Posted (edited)
6 hours ago, DrakeSky said:

Thank you so much Sir! you're the best.

Is it okay if you can put a time on it so it wont be spammable?  Like, you can only use this every 30 seconds? then if you try to use again there is a message that will say you can only use this every 30 secconds

 

Haven't tested this, but I think this should work. @DrakeSky

-	script	SellCommand	-1,{
OnInit:
    set .sell_delay, 30; // Seconds
    bindatcmd "sell",strnpcinfo(3) + "::OnSellCommand";
    end;
	
OnSellCommand:
    set .@gettimetick, gettimetick(2);
    set .@sell_num, ( sell_cooldown - gettimetick(2) );
    if( sell_cooldown > .@gettimetick ) {
      dispbottom "You have to wait "+.@sell_num+" seconds before using @sell again.";
      end;
    }
    .@s$ = .@atcmd_parameters$[0];
    announce strcharinfo(0) + ": " + .@s$,bc_all,0x2fe24a;
    set sell_cooldown, ( .@gettimetick + ( .sell_delay ));
    end;
}

 

Edited by Katazui
  • 0
Posted
23 hours ago, Katazui said:

Haven't tested this, but I think this should work. @DrakeSky


-	script	SellCommand	-1,{
OnInit:
    set .sell_delay, 30; // Seconds
    bindatcmd "sell",strnpcinfo(3) + "::OnSellCommand";
    end;
	
OnSellCommand:
    set .@gettimetick, gettimetick(2);
    set .@sell_num, ( sell_cooldown - gettimetick(2) );
    if( sell_cooldown > .@gettimetick ) {
      dispbottom "You have to wait "+.@sell_num+" seconds before using @sell again.";
      end;
    }
    .@s$ = .@atcmd_parameters$[0];
    announce strcharinfo(0) + ": " + .@s$,bc_all,0x2fe24a;
    set sell_cooldown, ( .@gettimetick + ( .sell_delay ));
    end;
}

 

Thank you! Let me try this one. Last resort is via Channel

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...