Announcement

Collapse
No announcement yet.

PlayerPropertyValue VS PlayerData[player]-like table data storage

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    PlayerPropertyValue VS PlayerData[player]-like table data storage

    Hello everyone,

    I started to code some basic stuff and i'm really enjoying it.

    While learning the basic how to code, i always find people using a table server-end like PlayerData[player] to store all the data during a session.
    But on the dev wiki i found the functions Set/GetPlayerPropertyValue which could allow to do exactly the same stuff.
    PlayerData[player].steamid = GetPlayerSteamid() is the same as SetPlayerPropertyValue(player, steamid, GetPlayerSteamid()) (right ??)

    My question is: why do people use the PlayerData[player] way to store the data and not the built-in functions Set/GetPlayerPropertyValue ?

    From what i could understand, Set/GetPlayerPropertyValue are functions accessible from server and client-side ? Is that for this reason ? security reason ? If yes, Can we set a Property accessible only from one side ?

    Thanks for you time and answers

    Best'
    Willzy_x


    #2
    PlayerData[player] is a table, it stores server data, setPlayerPropertyValue stores data in player RAM memory (With many setPlayerPropertyValue, low performance for players may occur)
    👑 DID I HELP YOU?
    Give me 👍 Like
    MY SITE: https://www.tommybr.com
    MY STEAM: https://steamcommunity.com/id/TommyID/

    Comment


      #3
      Thanks Tommy for that clarification.
      So when will you use the PlayerPropertyValue rather than PlayerData table ?

      Comment


        #4
        Example, I want to keep the information that the player has started a job. I will use:

        Code:
        PlayerData = {}
        PlayerData[player] = "job_started"
        I don't know if my example was good.
        👑 DID I HELP YOU?
        Give me 👍 Like
        MY SITE: https://www.tommybr.com
        MY STEAM: https://steamcommunity.com/id/TommyID/

        Comment


          #5
          Ok for the PlayerData part, but when will you use preferably built-in Set/GetPlayerPropertyValues rather than PlayerData[] ? What are the advantage of these functions ?

          Comment


            #6
            Its advantage is that it is shared with Client-side and Server-side. You can easily get the stored information with GetPlayerPropertyValues.

            Sry for my bad english
            👑 DID I HELP YOU?
            Give me 👍 Like
            MY SITE: https://www.tommybr.com
            MY STEAM: https://steamcommunity.com/id/TommyID/

            Comment

            Working...
            X