Jump to content
  • 0
greenieken

@request limit

Question

4 answers to this question

Recommended Posts

  • 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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

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