Advertisement
Guest User

Custom Gmod Bot

a guest
Nov 25th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. bot = nil
  2. comd = nil
  3. local plyr = player.GetHumans()[math.random(1,#player.GetHumans())]
  4.  
  5. function mainbotfunc(ply,cmd)
  6.     if ply:IsBot() then
  7.         while true do
  8.         comd = cmd
  9.         bot = ply
  10.         local botpos = ply:GetPos()
  11.         bot:SetModel("models/player/phoenix.mdl")
  12.         ply:SelectWeapon("none")
  13.         ply:Give("none")
  14.             local plypos = plyr:GetPos()
  15.             local yaxis = plypos.y - botpos.y
  16.             local xaxis = plypos.x - botpos.x
  17.             yaw = math.deg(math.atan2(yaxis,xaxis))
  18.             comd:SetViewAngles(Angle(0,yaw,0))
  19.             if plypos:Distance(botpos) > 9999 then
  20.                 comd:SetForwardMove(1000)
  21.                 comd:ClearMovement()
  22.             end
  23.             if plypos:Distance(botpos) < 80 then
  24.                 comd:SetForwardMove(-1000)
  25.                 comd:ClearMovement()
  26.             end
  27.         end
  28.         local plyr = player.GetHumans()[math.random(1,#player.GetHumans())]
  29. end
  30. end
  31. hook.Add("StartCommand","mainbotfunc",mainbotfunc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement