Onplayerrest script

What it Does
This is a modified Onplayerrest Script, it allow's you to decide how often pc's may rest and whether you would like to save the character when they click rest.

The Script
// OnPlayerRest // Written By Scarface // Set the player resting time limit in minutes const int RESTING_LIMIT = 5; // Do you want players characters to be saved on a full rest ? const int SAVE_ON_REST = TRUE; //TRUE = YES  |   FALSE = NO void main {   object oPC = GetLastPCRested, oMod = GetModule; string sPlayerID = GetPCPlayerName(oPC) + GetName(oPC); effect eSleep = EffectVisualEffect(VFX_IMP_SLEEP); switch(GetLastRestEventType) {       case REST_EVENTTYPE_REST_STARTED: {           if (GetLocalInt(oMod, "REST_STATUS_" + sPlayerID)) {               AssignCommand(oPC, ClearAllActions); FloatingTextStringOnCreature("You may only rest once per " +               IntToString(RESTING_LIMIT) + " minutes.", oPC); DelayCommand(IntToFloat(RESTING_LIMIT) * 60,               DeleteLocalInt(oMod, "REST_STATUS_" + sPlayerID)); return; }           else {               SetLocalInt(oMod, "REST_STATUS_" + sPlayerID, TRUE); ApplyEffectToObject(DURATION_TYPE_INSTANT, eSleep, oPC); }           break; }       case REST_EVENTTYPE_REST_CANCELLED: {           break; }       case REST_EVENTTYPE_REST_FINISHED: {           if (SAVE_ON_REST) {               ExportSingleCharacter(oPC); SendMessageToPC(oPC, " Character Saved"); }           break; }   }
 * 1) include "x2_inc_switches"