Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- timer.Create("AskForRank",5,0,function()
- local tbl = {}
- for v,i in pairs(player.GetAll()) do
- if not i:IsBot() and not i:GetDataValue("rank") then
- table.insert(tbl,i:SteamID())
- end
- end
- if table.Count(tbl)>0 then
- net.Start("SS.AskForRank")
- net.WriteTable(tbl)
- net.SendToServer()
- end
- end)
- net.Receive("SS.AskForRank",function()
- local tbl = net.ReadTable()
- for v,i in pairs(tbl) do
- local ply = SS:FindSteamID(i.steamid)
- if ply and IsValid(ply) then
- ply:SetDataValue("rank",i.value)
- print(ply,ply:GetDataString("rank"))
- end
- end
- end)
- SS.Joined = false
- local queue = {}
- net.Receive("SS.SendVariable",function()
- local steamid = net.ReadString()
- local tbl = net.ReadTable()
- local key = tbl.key
- local val = tbl.val
- SS:GiveVariable(steamid,key,val)
- end)
- function SS:GiveVariable(steamid,key,val,times)
- local ply = SS:FindSteamID(steamid)
- if not ply or not IsValid(ply) then
- table.insert(queue,{
- steamid = steamid,
- key = key,
- val = val,
- times = times and (times+1) or 1
- })
- return
- end
- print(ply,key,val)
- ply:SetDataValue(key,val)
- end
- local max = 20//wanna make sure it can get through safely.. if not chuck it
- timer.Create("VariableQueue",.5,0,function()//do one every .5 seconds
- local e = queue
- queue = {}//empty
- for v,i in pairs(e) do
- if i.times>max then continue end//chuck it
- SS:GiveVariable(i.steamid,i.key,i.val,i.times)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement