Wazarr94 / haxball_bot_headless

Ready-to-go scripts and functions for the HaxBall Headless API !
MIT License
46 stars 74 forks source link

Giving admin to the player entering the room. #21

Closed ghost closed 2 years ago

ghost commented 2 years ago

hello, I edited the public bot in my language. but i need your help with something. I do not want the first person to enter the room to be given admin. I just want to give admin to people I want. My room will only be for 10 people. it will be easy to control. so I want to prevent the public bot from giving admin to the players entering the room.

Wazarr94 commented 2 years ago

Hi, The variable that controls this behavior is maxPlayers. Normally in the public script, it is set to 0 already, which means no player should be given admin automatically, unless they have the admin or master role.

ghost commented 2 years ago

When I try with the bot I edited, it gives an admin to the person entering the room. but when I try with your bot, it does not give admin to the person entering the room. I don't know what I did wrong but I will look into it :) Thank you for your help.

Wazarr94 commented 2 years ago

there might be a bug in my script I haven't noticed, can you give me your discord username to help you solve the issue?

ghost commented 2 years ago

My discord account has been disabled for some ridiculous reason. I submitted a support request, I think it will be opened in a few days. When my discord account is opened, I will write my discord username here.

ghost commented 2 years ago

Hello again, I think I found where I went wrong. In the bot I edited, the code would normally be var maxAdmins = 0; I changed it. var maxAdmins = 2; My purpose in doing this is to determine the maximum number of admins that can be in the room. but I guess this script is not doing what I want. var maxAdmins = 0; After doing this, the bot does not give admin to the players when entering the room. I'm just learning new javascript so I tend to make mistakes. but it made me happy to be able to solve the problem.

Wazarr94 commented 2 years ago

Nice. If you aren't already, I recommend you use VSCode, as it has some nice controls to have a better grasp of your script.

I should be commenting more for what the variables do, might do it sometimes this weekend. Closing as it is resolved.