Advertisement
Chronos_Ouroboros

Untitled

Feb 25th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 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. int ShopGUIOpen[8];
  10.  
  11. function int ButtonText(str text, int holdtime, str font, int color)
  12. {
  13. SetHudSize(SCREEN_WIDTH, SCREEN_HEIGHT, 0);
  14.  
  15. if(font == 0) SetFont("SmallFont");
  16. else SetFont(font);
  17. HudMessage(s:text; HUDMSG_FADEOUT, 8000, color, 0.5, 0.5, holdtime, 0.3);
  18.  
  19. return false;
  20. }
  21.  
  22. function int BasicButton(str image, str image2, int bx, int by, int bwidth, int bheight, int bid)
  23. {
  24. SetHudSize(SCREEN_WIDTH, SCREEN_HEIGHT, 0);
  25. if(mouseX > bx - bwidth && mouseX < bx + bwidth && mouseY > by - bheight && mouseY < by + bheight)
  26. {
  27. if(keyPressed(BT_ATTACK) == 1) return 1;
  28. else if(keyPressed(BT_ALTATTACK) == 1) return 2;
  29. }
  30.  
  31. SetFont(image);
  32. if(mouseX > bx - bwidth && mouseX < bx + bwidth && mouseY > by - bheight && mouseY < by + bheight) SetFont(image2);
  33. HudMessage(s:"A"; HUDMSG_FADEOUT, bid, 0, bx*1.0+0.1, by*1.0+0.1, 0.1, 0.3);
  34.  
  35. return false;
  36. }
  37.  
  38. script "ToggleShopSystem" (void)
  39. {
  40. if(ShopGUIOpen[PlayerNumber()] == 0)
  41. {
  42. SetPlayerProperty(0, 1, PROP_TOTALLYFROZEN);
  43. ACS_NamedExecute("ShopSystemz", 0);
  44. ShopGUIOpen[PlayerNumber()] = 1;
  45. mouseX = 0;
  46. mouseY = 0;
  47. }
  48. else
  49. {
  50. SetPlayerProperty(0, 0, PROP_TOTALLYFROZEN);
  51. ACS_NamedTerminate("ShopSystemz", 0);
  52. ShopGUIOpen[PlayerNumber()] = 0;
  53. mouseX = 0;
  54. mouseY = 0;
  55. }
  56. }
  57. script "ShopSystemz" (void)
  58. {
  59. int mouseXadd = GetPlayerInput(-1, INPUT_YAW);
  60. int mouseYadd = GetPlayerInput(-1, INPUT_PITCH);
  61.  
  62. while(TRUE)
  63. {
  64. if(BasicButton("ARTITOME", "ARTITOME", 50, 50, 12, 11, 1000) == 2) ButtonText("HUE", 1.0, "DBigFont", CR_UNTRANSLATED);
  65. else if(BasicButton("ARTITOME", "ARTITOME", 50, 50, 12, 11, 1000) == 1) ButtonText("SATURATION", 1.0, "DBigFont", CR_UNTRANSLATED);
  66. // move the cursor
  67. mouseXadd = GetPlayerInput(-1, INPUT_YAW);
  68. mouseYadd = GetPlayerInput(-1, INPUT_PITCH);
  69.  
  70. mouseX -= mouseXadd / SENSITIVITY_X;
  71. mouseY -= mouseYadd / SENSITIVITY_Y;
  72. // prevent the cursor from going offscreen
  73. if(mouseX < 0) mouseX = 0;
  74. if(mouseX > SCREEN_WIDTH) mouseX = SCREEN_WIDTH;
  75. if(mouseY < 0) mouseY = 0;
  76. if(mouseY > SCREEN_HEIGHT) mouseY = SCREEN_HEIGHT;
  77.  
  78. SetHudSize(SCREEN_WIDTH, SCREEN_HEIGHT, 0);
  79. SetFont("CURSOR");
  80. HudMessage(s:"A"; HUDMSG_PLAIN, 0, CR_UNTRANSLATED, mouseX*1.0, mouseY*1.0, 0.04);
  81. Delay(1);
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement