Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CONFIG = {}
- CONFIG.Ranks = {"moderator"}
- CONFIG.VIPRanks = {"donator","vip"}
- CONFIG.SlotsReserverd = 2
- hook.Add("PlayerInitialSpawn","GiveSlot",function(ply)
- ply.PlayTime = CurTime()
- timer.Simple(3,function()
- if(table.HasValue(CONFIG.Ranks,ply:GetUserGroup()) || table.HasValue(CONFIG.VIPRanks,ply:GetUserGroup())) then
- file.CreateDir("customRSlot")
- if(table.HasValue(CONFIG.Ranks,ply:GetUserGroup())) then
- file.Write("customRSlot/"..ply:SteamID64()..".txt","vip")
- else
- file.Write("customRSlot/"..ply:SteamID64()..".txt","supervip")
- end
- else
- file.Delete("customRSlot/"..ply:SteamID64())
- end
- end)
- end)
- local function sortByPlayTime(a,b)
- return a.PlayTime - CurTime() < b.PlayTime - CurTime()
- end
- hook.Add("CheckPassword","ReserverSlot",function(id,ip,pass,clpass,name)
- if(#player.GetAll() >= game.MaxPlayers() - CONFIG.SlotsReserverd) then
- if(file.Read("customRSlot/"..id..".txt") == nil) then
- return false,"Reserved slot."
- else
- if(#player.GetAll() == GetConVar("maxplayers")) then
- local tbl = table.sort( player.GetAll(), sortByPlayTime )
- for k,v in pairs(tbl) do
- if(file.Read("customRSlot/"..v:SteamID64()..".txt") != nil && (file.Read("customRSlot/"..v:SteamID64()..".txt") == "vip" || file.Read("customRSlot/"..v:SteamID64()..".txt") == "supervip")) then
- table.RemoveByValue(tbl,v)
- end
- end
- table.Random(tbl):Kick("Kicked for a slot for a donator")
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement