Remove penalties through plugin interface

Discussion in 'Plugins' started by 1frey, Aug 1, 2023.

  1. 1frey

    1frey Registered

    Joined:
    Aug 9, 2017
    Messages:
    28
    Likes Received:
    3
    Hey everyone,

    do you know if there is a possibility to remove penalties from specific drivers using the plugin interface?

    There is
    Code:
    mNumPenalties
    in
    Code:
    VehicleScoringInfoV01
    but i assume its read-only.

    Maybe @Lazza has an idea? :)

    Best
    Frey
     
  2. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,388
    Likes Received:
    6,602
    @1frey scoring and telemetry are definitely read-only unfortunately, no mechanism exists to return a value.

    In the past I personally handled this by manipulating the dedi UI controls to run server commands, which can work but still looks pretty clumsy (an ability to vet penalties via server plugin would have been great, but fine details like this I think never got a look-in next to bigger issues).

    I don't recall the details of the REST interface now in rF2 to advise whether you can do it through there, if so that might be less error prone (since each request will be isolated from others; though with a single program/plugin manipulating the dedi I didn't have conflict issues anyway).
     
  3. Jeferson Richart

    Jeferson Richart Registered

    Joined:
    Oct 23, 2013
    Messages:
    174
    Likes Received:
    34
    Yes, you can withdraw penalties using the plugin.
    Just check if the driver has penalties with "mNumPenalties", and then execute a chat command to withdraw the penalty.

    Code
    /subpenalty [cod] [name]

    Example
    /subpenalty 3 Richie Spinner

    *Removes a penalty from the given player.
    The following are valid values for [cod]:
    0=remove one stop/go penalty,
    1=remove one drive-thru penalty,
    2=remove one longest line penalty,
    3=remove all penalties
     
    Last edited: Aug 7, 2023
    yashiman and DJCruicky like this.

Share This Page