Best tactic for saving entities?

  • Hey GT-MP-Community,


    i have a question:


    Im building up a new Gamemode and before im implementing my new Package/Feature (saving Clients, Vehicles etc.) i started to Brainstorm a bit.


    Could you guys suggest some good tactics for saving those Entities?


    Like:
    - Save the positions on every Disconnect

    - Save the positions every X seconds/minutes

    - Save the positions of a specific Entity on specific Events


    Maybe you can talk about your Experience with some of these (or even new) cases.

  • Save positions in array.

    Save array to file on Disconnect and on timer.

    Thanks for you post.

    Does the Client send a disconnectEvent on Serverrestart(shutdown)?



    And what if following scenario happens:


    Client1 buys a Vehicle1 and drive around. (Entities will be saved meanwhile in the Array/List)

    Client1 leaves his Vehicle1 on the street (unlocked) and disconnects (Server is saving those Array/List-Values of Client1 and his Vehicle1 (because its his car) to the Database)
    Client2 takes the unlocked Vehicle1 and drive around (im saving the position of Client2 and Vehicle1 (because Client2 sits in it) in Array/List-Values)

    Client2 leaves the Vehicle1 and walks somewhere else and continue playing

    Client2 disconnects (Server is saving Array/List-Values of Client2 and his own vehicles (none) to the Database)


    after a server restart Vehicle1 will spawn where Client1 has leaved it, because the Server didnt knew that he should save Vehicle1 on Client2_disconnect



    How should i patch that?