AFAIK, LFS will send the ISP_PEN packet when a driver receives a penalty. Maybe set up a boolean in the player list that will turn to true when a driver receives a DT or SG penalty.
struct IS_PEN // PENalty (given or cleared)
{
byte Size; // 8
byte Type; // ISP_PEN
byte ReqI; // 0
byte PLID; // player's unique id
byte OldPen; // old penalty value (see below)
byte NewPen; // new penalty value (see below)
byte Reason; // penalty reason (see below)
byte Sp3;
};
// Penalty values (VALID means the penalty can now be cleared)
enum
{
PENALTY_NONE, // 0
PENALTY_DT, // 1
PENALTY_DT_VALID, // 2
PENALTY_SG, // 3
PENALTY_SG_VALID, // 4
PENALTY_30, // 5
PENALTY_45, // 6
PENALTY_NUM
};
// Penalty reasons
enum
{
PENR_UNKNOWN, // 0 - unknown or cleared penalty
PENR_ADMIN, // 1 - penalty given by admin
PENR_WRONG_WAY, // 2 - wrong way driving
PENR_FALSE_START, // 3 - starting before green light
PENR_SPEEDING, // 4 - speeding in pit lane
PENR_STOP_SHORT, // 5 - stop-go pit stop too short
PENR_STOP_LATE, // 6 - compulsory stop is too late
PENR_NUM
};
As for exiting the pits, maybe setup a routine that will detect when the penalty clears.