Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. function PANEL:SetImage( img )
  2.  
  3. self.mat = Material( img .. ".png" )
  4. self.bg = Material( img .. "_overlay.png" )
  5. self.bot = Material( "gangwars/minigames/hand/bot.png" )
  6.  
  7. // lets find the green spot
  8. local gx = 0
  9. local gy = 0
  10. local c = 0
  11. for x=1,512,2 do
  12. for y=1,512,2 do
  13. local col = self.mat:GetColor(x, y)
  14. if col.a == 255 and col.g >= 255 then
  15. gx = gx + x
  16. gy = gy + y
  17. c = c + 1
  18. end
  19. end
  20. end
  21.  
  22. gx = (ScrW() / 2) - 256 + (gx / c)
  23. gy = (ScrH() / 2) - 256 + 12 + (gy / c)
  24.  
  25. //gx, gy = self:LocalToScreen( gx, gy )
  26. //MsgN("spot is " .. gx .. ", " .. gy)
  27. input.SetCursorPos( gx, gy )
  28.  
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement