#(Resolved)

1 messages · Page 1 of 1 (latest)

remote pelican
#

Hi I am making a skygen and I need some help for creating it. like tpa,home,money transfer etc....

craggy adder
#

Sure I can tell what to do

#

@remote pelican

remote pelican
#

umm... i am bit busy but i will give you my tpa system, it's kinda having errors

#
    function tpaGUI(player) {
      let tpaGUI = new ActionFormData()
      let players = world.getAllPlayers()
      tpaGUI.title("TPA MENU")
      tpaGUI.body("Choose one to go")
      for (let player of players) {
        tpaGUI.button(player.name)
    }
    forceUi (tpaGUI,player).then(({selection : index}) => {
      let target = players[index]
      AcceptForm(target,player)
  })
  }```
#
  function AcceptForm(player) {
    let aui = new MessageFormData()
    aui.title("Accept TPA")
    aui.body(`${sender.name} has sent you tpa request. \nDo You Want To Accept It?`)
    aui.button1("Decline")
    aui.button2("Accept")
    forceUi(aui,player).then(({selection : index}) => {
        if (index == 0) {
            sender.teleportFacing(player.location,player.dimension,player.location)
        } else {
            sender.tell(`${player.name} has declined your request`)
        }
    })
}```
craggy adder
#

I can’t fix them right now because I’m at school I fix for you wan I come back in like 2 or 3 hours

remote pelican
#
function forceUi ( form, player, timeout = 20 * 5 ) {
  return new Promise( async (resolve, reject) => {
      system.run(async function run() {
          let response
          
          try {
              response = await form.show( player )
          } catch (error) {
              reject( error )
              return
          }
          
          const { 
              canceled,
              cancelationReason 
          } = response
          
          if (canceled && cancelationReason == FormCancelationReason.userBusy) {
              timeout-- && system.run( run )
              return
          }
          
          resolve( response )
          
      })
          
  })
}```
#

that's it

craggy adder
#

I already have a tpa system I give you that

remote pelican
#

tq

craggy adder
#

Yea

#

And I already have all the system you I just need to give it to you wan I come back

#

I add you bug me in 2 or 3 hours about it so I don’t forget

remote pelican
#

ok

remote pelican
#

hey you came?

#

@craggy adder

opal berryBOT
#
Debug Result

There is an error in this [code](#1148629180301443142 message):

<repl>.js:18:70 - error TS2551: Property 'userBusy' does not exist on type 'typeof FormCancelationReason'. Did you mean 'UserBusy'?

18           if (canceled && cancelationReason == FormCancelationReason.userBusy) {
                                                                        ~~~~~~~~

  @minecraft/server-ui.d.ts:59:13
    59             UserBusy = 'UserBusy',
                   ~~~~~~~~
    'UserBusy' is declared here.

marble kernel
#

@remote pelican
const playerList = [...world.getAllPlayers()].filter(plr => plr.name !== player.name);
const form = new ModalFormData();
form.title('Money transfer');
form.dropdown('Select a target...', ['None', ...playerList.map(plr => plr.name)]);
form.slider("Select a value...", 1, 1000, 2);
form.show(player).then(result => {
if (result.canceled) player.sendMessage('You closed the form!');
if (!result.formValues[0] && !result.formValues[1]) return;
const target = playerList[result.formValues[0] - 1];
const valInput = result.formValues[1];
const senderScore = world.scoreboard.getObjective('money').getScore(player.scoreboardIdentity)
if (valInput > senderScore) {
player.sendMessage(You have insufficient funds to transfer money: ${senderScore});
return;
}
const formattedValInput = Math.floor(valInput);
target.runCommandAsync(scoreboard players add ${target.name} Money ${formattedValInput})
player.runCommandAsync(scoreboard players remove ${player.name} Money ${formattedValInput})
target.sendMessage(Player ${player.name} has sent you §a$${formattedValInput}!);
player.sendMessage(You have sent §a$${formattedValInput}§f to ${target.name}!);
})
}
})

#

money transfer

#

change the objective if needed

gaunt pine
#

i can help too if you want

remote pelican
#

ok:D

remote pelican
remote pelican
#

i am lazy tho

#

and i know how to script

#

if I am having errors then i will ask for help

remote pelican
ruby light
ruby light
#

Also if you know how to script you should know how to do all these features pretty easily

ruby light
#

wtf is this […world.getAllPlayers()] 💀💀💀

remote pelican
reef igloo
#

aight, whats issue here

ruby light
#

where does it say paid

remote pelican
#

😢

#

ok fine

#

i don't want any help from your side

#

i am closing the post

reef igloo
remote pelican
#

(Resolved)

#

Thank you for helping me @marble kernel @craggy adder

remote pelican
#

and thank you for asking me @gaunt pine

dense rock
#

@remote pelican you dont change names

karmic pilot
#

@ruby light bro 😂😂😂😂😂😂😭💔

ruby light
#

what

remote pelican