Results 1 to 1 of 1

Thread: Confused With SetNextSessionAttributes

  1. #1
    Superkart Pilot
    Join Date
    Jun 2015
    Posts
    123
    Platform
    PC

    Confused With SetNextSessionAttributes

    I'm working on an addon and I need to make use of SetNextSessionAttributes, however I can't seem to figure out what the proper use of this should look like. The guide just arbitrarily says "attributes".

    Is it a JSON string similar to the config for the sms_rotate addon? Or is it a Lua table? If I use this function, does it default attributes that are left out? For example if I don't provide a DamageType parameter - will it be reset to the default value?

    I've been looking at the lib_rotate addon a bit, but it uses metatables which are the bane of my existence.

    Also, is there a way to get the current number of players in the session? I'm a bit worried things will go all wonky if I set a map that has a starting grid of let's say 20 but there's 32 players on the server.

    Edit:

    Figured it out by trial and error, if anyone else gets stuck on this - here's how to work it with it for future reference;
    Code:
    local setupAttributes = {
    	-- Generated Session Setup
    	TrackId = randomTrack[2],
    	VehicleClassId = randomClass[1],
    	Flags = -1714683208,
    	ServerControlsVehicleClass = 1,
    	ServerControlsVehicle = 0,
    	-- Default Generic Session Settings
    	PracticeLength = 10,
    	QualifyLength = 10,
    	RaceLength = lapCount
    }
    SetNextSessionAttributes(setupAttributes)
    On a side-note, if the attributes aren't set and you're trying to do it on an empty dedicated server. Use SetNextSessionAttributes instead of SetSessionAttributes. As the former will apply once the first player has connected.
    Last edited by Dealman; 02-10-2017 at 21:11.
    OS: Windows 10 64-Bit
    CPU: Intel Core i7 7700k
    RAM: 16GB Corsair Vengeance DDR4 3200MHz
    GPU: KFA2/Galaxy GeForce GTX 1070 Ti EX
    Wheel: Xbox One Controller

Similar Threads

  1. Confused by TC & ABS Settings
    By Miker in forum General Discussion
    Replies: 3
    Last Post: 01-10-2017, 14:56
  2. [RESOLVED] Confused
    By Fabian Fa5 in forum General Discussion
    Replies: 9
    Last Post: 10-05-2016, 17:10
  3. Invitations....still confused...
    By vglnte102 in forum Project CARS on Xbox One
    Replies: 5
    Last Post: 14-07-2015, 18:53
  4. I'm quite confused.
    By Blind Speed in forum Project CARS on Playstation 4
    Replies: 3
    Last Post: 31-05-2015, 04:14

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •