Page 1 of 1
Restricting a cmd to once every 24 hour period?
Posted: Thu Aug 31, 2006 3:44 am
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?
Posted: Thu Aug 31, 2006 5:06 am
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)