blob: 332708a8a1ca15702bc771b1f6da33e01175accb (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
local EPT = FindMetaTable("Entity")
local SHQTab = 0
local SHQLimit = 200
local SHQSend = {}
local SHNonTemp = {}
GM._GlobalSHVars = {}
if (CLIENT) then
net.Receive("_ReceiveGlobalSHVar",function(size)
local Dat = net.ReadTable()
self._GlobalSHVars[Dat.Name] = Dat.Value
end)
else
hook.Add("PlayerAuthed","_AddGlobalSHVar",function(pl,sid,uid)
GM = GM or GAMEMODE
for k,v in pairs( GM._GlobalSHVars ) do
GM:SetGlobalSHVar(k,v,pl)
end
end)
util.AddNetworkString("_ReceiveGlobalSHVar")
end
function GM:GetGlobalSHVarTable()
return self._GlobalSHVars
end
function GM:SetGlobalSHVar(Name,Var,ply)
self._GlobalSHVars[Name] = Var
if (CLIENT) then return end
local Dat = {
Name = Name,
Value = Var,
}
net.Start( "_ReceiveGlobalSHVar" )
net.WriteTable( Dat )
if (IsValid(ply)) then
net.Send(ply)
else
net.Broadcast()
end
end
function GM:GetGlobalSHVar(Name,Var)
if (!self._GlobalSHVars or self._GlobalSHVars[Name] == nil) then return Var or nil end
return self._GlobalSHVars[Name]
end
|