Jump to content
  • 0
greenieken

@request limit

Question

4 answers to this question

Recommended Posts

  • 0

You could make @request only usable by group id 99 (admin) and create a custom command (with bindatcmd()) in which you put your extra checks and call the real @request with atcommand()

Share this post


Link to post
Share on other sites
  • 0
6 hours ago, meko said:

You could make @request only usable by group id 99 (admin) and create a custom command (with bindatcmd()) in which you put your extra checks and call the real @request with atcommand()

Could you make one for me please? Coz I honestly dont know how to do it.

Share this post


Link to post
Share on other sites
  • 1
-	script	@request	32767,{
OnCall:
	if (gettimetick(2) <= @COMMAND_LOCK[getnpcid(0)] && !has_permission(PERM_RECEIVE_REQUESTS)) {
		dispbottom(sprintf("You must wait at least %i seconds to call this command again.", .delay));
	} else {
		@COMMAND_LOCK[getnpcid(0)] = gettimetick(2) + .delay; // update the lock
		atcommand("@request " + implode(.@atcmd_parameters$[0], " ")); // call the true command
	}
	end;

OnInit:
	.delay = 10; // number of seconds to wait in between calls
	bindatcmd("request", strnpcinfo(NPC_NAME) + "::OnCall", 99, 99, 0); // bind the custom atcommand
	add_group_command("request", 0, true, false); // allow group 0 to use the custom atcommand
	add_group_command("request", 1, true, false); // allow group 1 to use the custom atcommand
	add_group_command("request", 2, true, false); // allow group 2 to use the custom atcommand
	add_group_command("request", 3, true, false); // allow group 3 to use the custom atcommand
	add_group_command("request", 4, true, false); // allow group 4 to use the custom atcommand
	add_group_command("request", 10, true, false); // allow group 10 to use the custom atcommand
	// ^ add or remove groups to match your groups.conf
}


In the OnInit section change .delay to the amount of seconds to wait and add your groups to the add_group_command() lines if any is missing.
Any group that has the "receive_requests" permission will bypass the delay entirely.

 

Relevant documentation:

Share this post


Link to post
Share on other sites
  • 0
23 hours ago, meko said:

-	script	@request	32767,{
OnCall:
	if (gettimetick(2) <= @COMMAND_LOCK[getnpcid(0)] && !has_permission(PERM_RECEIVE_REQUESTS)) {
		dispbottom(sprintf("You must wait at least %i seconds to call this command again.", .delay));
	} else {
		@COMMAND_LOCK[getnpcid(0)] = gettimetick(2) + .delay; // update the lock
		atcommand("@request " + implode(.@atcmd_parameters$[0], " ")); // call the true command
	}
	end;

OnInit:
	.delay = 10; // number of seconds to wait in between calls
	bindatcmd("request", strnpcinfo(NPC_NAME) + "::OnCall", 99, 99, 0); // bind the custom atcommand
	add_group_command("request", 0, true, false); // allow group 0 to use the custom atcommand
	add_group_command("request", 1, true, false); // allow group 1 to use the custom atcommand
	add_group_command("request", 2, true, false); // allow group 2 to use the custom atcommand
	add_group_command("request", 3, true, false); // allow group 3 to use the custom atcommand
	add_group_command("request", 4, true, false); // allow group 4 to use the custom atcommand
	add_group_command("request", 10, true, false); // allow group 10 to use the custom atcommand
	// ^ add or remove groups to match your groups.conf
}


In the OnInit section change .delay to the amount of seconds to wait and add your groups to the add_group_command() lines if any is missing.
Any group that has the "receive_requests" permission will bypass the delay entirely.

 

Relevant documentation:

Thanks! Will try this

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.