Hey, I made a little script with some interesting features in order to handle rooms
I started javascript 2 months ago so i'd be happy to get a review of my code ^^
If a bug happens, please post it or pm me on ts, i'll try to solve it as quickly as possible
There's a known bug that sometimes the scorer displayed can be the wrong one.
I know other coders have done better than me but nobody posted on fm, so here's the link
https://pastebin.com/e9nxgRQ7features: version 0:
https://pastebin.com/f7AJ5f9G- if the room is empty, the first player who joins will be admin
- if the last admin leaves, the oldest player in the room will be admin
- a player can get admin by typing a password (here it's !admin Anddyisthebest) can be changed line 131 and can't been seen if written ofc
- an admin is able to mute players (or himself ^^) in the room, he can also unmute them
- an admin is able to reset the bans of the room
- a message is written by the host when a goal has been scored, it says who scored, who assisted (if there is), if it's an og, when it has been scored and against who
- a message is written by the host when a match is finished, it globally sum up the previous point for each goals
- a player can see how much goals he scored/assisted/miserably scored against his team
Added in version 1:
https://pastebin.com/UHsbhqa2- A player keeps his previous stats when he refreshs
- A player is now able to see other player's stats with the command "!stats PlayerName" (note: "!stats" command doesnt work anymore without a nickname in argument)
- An admin can unmute himself if he gets muted (pm me on ts if you don't want this feature for your own utility
)
Added in version 1.1:
https://pastebin.com/1unKMnk4- Cleensheet are now implemented, write "!gk" before the first min to be declared as the gk of your team !
Added in version 1.2:
https://pastebin.com/DA5JWYRn- Wins and loses are now implemented !
- Gk will be now determined by saviola's method (the most backward player in the team at the kick off will be set as gk), but the "!gk" command is still working if the bot is wrong.
Added in version 1.3:
hhttps://pastebin.com/T7Rz2bJf- Ranking system based on fm fantasy haxball ! Type "!ranking" to see the best players in the room !
Goal: 5 pts, assist: 3 pts, win: 3 pts, cs: 6 pts, lose: -7 pts, og: -4 pts. (maybe i'll add "!gk" like command to know who is dm, am, st and be more fair about points)
- Fixed a bug where the gk wasn't set if all the red players were behind the ball (near the circle)
Added in version 1.4:
https://pastebin.com/fDdsxRmC- FUCKING BUG FIXED, JAVASCRIPT IS BULLSHIT.
- !swap command (for admins), switch blues and reds when no game are in progress.
- Added points to !stats Player.
- A player with positive points is able to reset his stats with "!resetstats"
- Better ranking display.
Added in version 1.5:
https://pastebin.com/ZGmtR5pm- "!rr" command to restart a game
- "!poss" command, to see the ball possession of the two team in a match. (Don't be scared about NaN% if the ball haven't been touched once)
- New structure for commands, cleaner, easier if you want to remove some features, and a little faster for the machine (thanks saviola)
Fixed a possession bug:
https://pastebin.com/e9nxgRQ7What i'm working on:
- add wins/loses/matchs played/mins played in statistics # just missing mins played, will be added soon
- a player will be able to see other player's stats # Done
- when basro will add private messages in haxball, the host will stop spamming to everyone when someone type a command
- try to fix the sometimes wrong scorer issue # Done
If you have any suggestion, any idea to improve the bot, please don't be shy.