Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if CLIENT then return end
- SPAWNPOINTS_TWS = {}
- if not file.Exists("spawnpoints_tws", "DATA") then
- file.CreateDir("spawnpoints_tws")
- else
- local sp = file.Find("spawnpoints_tws/*.txt", "DATA")
- for i = 1, #sp do
- table.insert(SPAWNPOINTS_TWS, sp[i])
- end
- end
- hook.Add("PlayerSay", "custom_spawnp_tws", function(ply, text, team)
- if not ply:IsAdmin() then return end
- local str = string.Explode(" ", text)
- if str[1] == "/addspawnpoint" then
- if file.Exists("spawnpoints_tws/" .. str[2] .. ".txt", "DATA") then ply:ChatPrint("This spawnpoint is already existst!") return end
- file.Write("spawnpoints_tws/" .. str[2] .. ".txt", tostring(ply:GetEyeTrace().HitPos))
- table.insert(SPAWNPOINTS_TWS, str[2] .. ".txt")
- ply:ChatPrint(str[2] .. " spawnpoint is done!")
- end
- if str[1] == "/printallsp" then
- for k, v in pairs(SPAWNPOINTS_TWS) do
- ply:ChatPrint(v .. " " .. file.Read("spawnpoints_tws/" .. v, "DATA"))
- end
- end
- end)
- hook.Add("PlayerSpawn", "ply_spawn_tws", function(ply)
- local pos = file.Read("spawnpoints_tws/" .. table.Random(SPAWNPOINTS_TWS), "DATA")
- pos = string.Explode(" ", pos)
- local num = {}
- for i = 1, 3 do num[i] = pos[i] end
- ply:SetPos(Vector(num[1], num[2], num[3]))
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement