Advertisement
Chronos_Ouroboros

Untitled

Feb 25th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. #DEFINE SCREEN_WIDTH 800
  2. #DEFINE SCREEN_HEIGHT 600
  3.  
  4. #DEFINE SENSITIVITY_X 30
  5. #DEFINE SENSITIVITY_Y 30
  6.  
  7. int mouseX;
  8. int mouseY;
  9.  
  10. function int BasicButton(str image, int bx, int by, int bwidth, int bheight, int bid)
  11. {
  12. SetHudSize(SCREEN_WIDTH, SCREEN_HEIGHT, 0);
  13. if(mouseX > bx - bwidth/2 && mouseX < bx + bwidth/2 && mouseY > by - bheight/2 && mouseY < by + bheight/2)
  14. {
  15. if(keyPressed(BT_ATTACK) == 1)
  16. {
  17. return 1;
  18. }
  19. else if(keyPressed(BT_ALTATTACK) == 1)
  20. {
  21. return 2;
  22. }
  23. }
  24.  
  25. SetFont(image);
  26. HudMessage(s:"A"; HUDMSG_PLAIN, bid, 0, bx*1.0, by*1.0, 0);
  27.  
  28. return false;
  29. }
  30.  
  31. script "ShopSystemz" (void)
  32. {
  33. int mouseX+ = GetPlayerInput(-1, INPUT_YAW);
  34. int mouseY+ = GetPlayerInput(-1, INPUT_PITCH);
  35.  
  36. while(TRUE)
  37. {
  38.  
  39. mouseX -= mouseX+ / SENSITIVITY_X;
  40. mouseY -= mouseY+ / SENSITIVITY_Y;
  41. // move the cursor
  42. mouseX+ = GetPlayerInput(-1, INPUT_YAW);
  43. mouseY+ = GetPlayerInput(-1, INPUT_PITCH);
  44. // prevent the cursor from going offscreen
  45. if(mouseX < 0) mouseX = 0;
  46. if(mouseX > SCREEN_WIDTH) mouseX = SCREEN_WIDTH;
  47. if(mouseY < 0) mouseY = 0;
  48. if(mouseY > SCREEN_HEIGHT) mouseY = SCREEN_HEIGHT;
  49.  
  50. SetHudSize(SCREEN_WIDTH, SCREEN_HEIGHT, 0);
  51. SetFont("CURSOR");
  52. HudMessage(s:"A"; HUDMSG_PLAIN, 0, CR_UNTRANSLATED, mouseX*1.0, mouseY*1.0, 0);
  53. Delay(1);
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement