aboutsummaryrefslogtreecommitdiff
path: root/gamemode/server/sv_loadplayer.lua
blob: f8c25685c2b513f9baa3ff5bdcd8cd417cc30c3b (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
local sql = nrequire("core/database/sv_setup.lua")
print("in sv_loadplayer.lua sql is", sql)
local models = {}
for k = 1,9 do
    models[#models + 1] = "models/player/Group01/male_0" .. k .. ".mdl"
    models[#models + 1] = "models/player/Group02/Male_0" .. k .. ".mdl"
end

local function delayplayerload(ply)
    if ply:Alive() and IsValid(ply) then
        sql.GetPlayerData(ply)
    else
        timer.Simple(1,function()
            delayplayerload(ply)
        end)
    end
end

hook.Add("PlayerInitialSpawn","ArteryPlayerLoad",function(pl)
    local modelnum = pl:UniqueID() % (#models)
    timer.Simple(1,function()
        delayplayerload(pl)
    end)
    pl:SetModel(models[modelnum])
    pl:Give("hands")
    pl:SelectWeapon("hands")
end)