| Code: |
use uo;
use os;
CONST WAIT_TIME := 60; // must wait 60 seconds
program Barter(mobile)
var last_barter := CInt(GetObjProperty(mobile, "#LastBarter"));
// If last_barter was set, and the difference between then and now is less than WAIT_TIME, fail with a message
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
// Set #LastBarter prop on moible
// the "#" will tell POL to not save this prop
// when the server restarts, the prop is gone
SetObjProperty(mobile, "#LastBarter", Polcore().systime);
endif
// Do barter stuff here
endprogram |