Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local players = entities.FindByClass( "CCSPlayer" )
- local isBot = false
- --AW Gui--
- local Ref_BotCmd = gui.Reference( "MISC", "Part 1" );
- local Checkbox_BotCmd = gui.Checkbox( Ref_BotCmd, "msc_holdpos_active", "Auto Hold Position", 0 );
- --Timer--
- local timer = timer or {}
- local timers = {}
- ---------
- local function checkBot() --Checking if there is a Bot in your team (*exept u)
- for i = 1, #players do
- local player = players[ i ];
- botDificulty = entities.GetPlayerResources():GetPropInt("m_iBotDifficulty", player:GetIndex());
- if player:GetTeamNumber() == entities.GetLocalPlayer():GetTeamNumber() then
- if botDificulty >= 0 then --Yup... I am to dumb and lazy to find a proper way
- isBot = true
- else
- isBot = false
- end
- else
- end
- end
- end
- function holdPos(event) --Holdpos function
- if Checkbox_BotCmd:GetValue() then
- if event:GetName() == "round_freeze_end" then
- checkBot()
- if isBot then
- timer.Create("holdpos_delay", 1.0, 1, function()
- client.Command("holdpos", false)
- end)
- end
- end
- end
- end
- client.AllowListener("round_freeze_end")
- callbacks.Register( "FireGameEvent", "Hold BOT Pos", holdPos );
- function timer.Create(name, delay, times, func)
- table.insert(timers, {["name"] = name, ["delay"] = delay, ["times"] = times, ["func"] = func, ["lastTime"] = globals.RealTime()})
- end
- function timer.Remove(name)
- for k,v in pairs(timers or {}) do
- if (name == v["name"]) then table.remove(timers, k) end
- end
- end
- function timer.Tick()
- for k,v in pairs(timers or {}) do
- if (v["times"] <= 0) then table.remove(timers, k) end
- if (v["lastTime"] + v["delay"] <= globals.RealTime()) then
- timers[k]["lastTime"] = globals.RealTime()
- timers[k]["times"] = timers[k]["times"] - 1
- v["func"]()
- end
- end
- end
- callbacks.Register( "Draw", "timerTick", timer.Tick);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement