Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. import alt from 'alt';
  2. import game from 'natives';
  3.  
  4. class InstructionButtonsDrawler {
  5. constructor() {
  6. this.isActive = false;
  7. this.scaleform = undefined;
  8.  
  9. alt.on("update", () => {
  10. if (!this.isActive || !this.scaleform) {
  11. return;
  12. }
  13.  
  14. this.draw();
  15. });
  16. }
  17.  
  18. init() {
  19. this.scaleform = alt.helpers.scaleform.new("instructional_buttons");
  20. }
  21.  
  22. setActive(state) {
  23. this.isActive = state;
  24. }
  25.  
  26. setButtons(...buttons) {
  27. this.scaleform.callFunction("SET_DATA_SLOT_EMPTY");
  28.  
  29. if (Array.isArray(buttons)) {
  30. for (let i = 0; i < buttons.length; i++) {
  31. const button = buttons[i].altControl
  32. ? buttons[i].altControl
  33. : game._0x80C2FD58D720C801(2, buttons[i].control, true);
  34.  
  35. this.scaleform.callFunction("SET_DATA_SLOT", i, button, game.getLabelText(buttons[i].label));
  36. }
  37. }
  38.  
  39. this.scaleform.callFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);
  40. }
  41.  
  42. draw() {
  43. this.scaleform.drawFullscreen();
  44. }
  45.  
  46. dispose() {
  47. this.isActive = false;
  48.  
  49. if (this.scaleform) {
  50. this.scaleform.dispose();
  51. }
  52.  
  53. this.scaleform = undefined;
  54. }
  55. }
  56.  
  57. const instructionButtonsDrawler = new InstructionButtonsDrawler();
  58.  
  59. export default instructionButtonsDrawler;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement