Jump to content
  • 0
mirabell

how to prevent spamming @command

Question

I took this from another post but i want to add to it.

-	script	refresh_pvp	-1,{
OnInit:
	bindatcmd "refresh",strnpcinfo(0) +"::OnRefresh";
	end;
OnRefresh:
	if( getmapflag( strcharinfo(3),mf_pvp ) )
		message strcharinfo(0),"@refresh is not allowed in pvp map.";
	end;
}

i would like to be able to limit the ability to use this @command once every 4 sec in any map. In addition to disabling it in pvp. Who would i be able to do that. Thanks

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
-	script	refresh_pvp	-1,{
OnInit:
	bindatcmd "refresh",strnpcinfo(0) +"::OnRefresh";
	end;
OnRefresh:
	if( getmapflag( strcharinfo(3),mf_pvp ) ) {
		message strcharinfo(0),"@refresh is not allowed in pvp map.";
	end;
	} else {
		message strcharinfo(0),"You must wait 4 seconds for re-use this command.";
		if (@refdelay) end;
		set @refdelay, 1;
		atcommand "@refresh";
		sleep2 4000; // 4sec Delay
		set @refdelay, 0;
		end;
	}
}

Tested and works fine

  • Upvote 1
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...

Important Information

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