summaryrefslogtreecommitdiff
path: root/gamemode/client/cl_syncronize.lua
blob: 32d667cfb278e0eee303f9b05b592c55a9f7433e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--Makes sure the player knows about things like inventory, skills, experience ect.

net.Receive( "gms_SetResource", function( length, pl)
  print("Setresources message sent from server")
  local name = net.ReadString()
  if(GMS.GetResourceByName(name).UniqueData) then
    local restable = net.ReadTable()
    PrintTable(restable)
    if(Resources[name] == nil) then
      Resources[name] = {}
    end
    table.insert(Resources[name],restable.UniqueDataID,restable)
  else
    if(Resources[name] == nil) then
      Resources[name] = 0
    end
    print("Getting with bitcount:" .. GMS.NETINT_BITCOUNT)
    local num = net.ReadInt(GMS.NETINT_BITCOUNT)
    print("Resource name: " .. name)
    print("Resource num: " .. num)
    Resources[name] = num
  end
  print("Finished resource get")
end)

concommand.Add("gms_cl_printresources",function(ply,cmd,args)
  PrintTable(Resources)
end)