greenieken 0 Posted August 24, 2017 Hi. Is there a way to put a delay when using @request like 1 @request per minute? Thanks! Quote Share this post Link to post Share on other sites
1 meko 170 Posted August 25, 2017 - 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: bindatcmd add_group_command atcommand has_permission Quote Share this post Link to post Share on other sites
0 meko 170 Posted August 24, 2017 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() Quote Share this post Link to post Share on other sites
0 greenieken 0 Posted August 24, 2017 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. Quote Share this post Link to post Share on other sites
0 greenieken 0 Posted August 25, 2017 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: bindatcmd add_group_command atcommand has_permission Thanks! Will try this Quote Share this post Link to post Share on other sites
Hi. Is there a way to put a delay when using @request like 1 @request per minute? Thanks!
Share this post
Link to post
Share on other sites