Jump to content

Add Time of Use to a Button


Recommended Posts

  • Premium
char.h
#ifdef ENABLE_TIME_USE	
	public:
		int m_iUpdate;
		int GetUpdatetTime() { return m_iUpdate; }
		void SetUpdatetTime() { m_iUpdate = thecore_pulse(); }	
#endif

in cmd_general.cpp
#ifdef ENABLE_TIME_USE	
ACMD(do_funciontime)
	int iPulse = thecore_pulse();
	
	if (iPulse - ch->GetUpdatetTime() < PASSES_PER_SEC(10))
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("in 10 secon i´m use the button"));
		return;
	}
	
	ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Hi Fire"));
	ch->SetUpdatetTime()();
#endif

in cmd.cpp
#ifdef ENABLE_TIME_USE
ACMD(do_funciontime);
#endif

#ifdef ENABLE_TIME_USE	
{ "funciontime",			do_funciontime, 0, POS_DEAD, GM_PLAYER },
#endif

function in .py

net.SendChatPacket("/funciontime")

for the developers, who suddenly want to put a restriction when using a button and do not use it many times, they can put a time, I do not know if it is already public use, I only share how to do it in a simple way

08412-5bb2eb07-718c-4433-a72c-1bf24ff6ba

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.