Restricting a cmd to once every 24 hour period?

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Terryl
Neophyte Poster
Posts: 32
Joined: Thu Aug 10, 2006 9:59 am

Restricting a cmd to once every 24 hour period?

Post by Terryl »

Hey, if I want a cmd to work once every 24 hour period and then give a message like "no no cant use for another bla bla bla".

Whats the easiest way to do it?should I write another function in time.inc or can I use one of the functions allready in there? Anyone have any idea?
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post by Poi »

Heres a barter script i have, hope this helps you.

Code: Select all

use uo;
use os;

CONST WAIT_TIME := 60;

program Barter(mobile, text)
   var last_barter := CInt(GetObjProperty(mobile, "#LastBarter"));
   
   if ( last_barter  && (Polcore().systime - last_barter) < WAIT_TIME )
      SendSysMessage(mobile, "You must wait at least "+WAIT_TIME+" seconds before bartering again.");
      return 0;
   else
      SetObjProperty(mobile, "#LastBarter", Polcore().systime);
   endif
   
Broadcast( mobile.name + " barters: " + text, 0, 41);
endprogram

So basicly, change the wait time, then add what you want it to do when they have no wait time right befor endprogram(in place of broadcast)
Post Reply