Advertisement
Guest User

Custom Gmod Bot

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