Author Topic: Auto Creating A Minigame  (Read 1114 times)

Or you could avoid bumping a solved coding help topic with a non helpful response. Default minigame does almost nothing that the OP is asking.
I wouldn't call it 'solved', your code is terrible.
1) You don't need to package anything for a server script to be executed when the game is started. The server.cs is only executed when the game is started so you would just put it in the server.cs outside of a package and the minigame would be created when the server is started, with an additional !isObject check to prevent recreation when the addon is forced to load.
2) Furthermore, that method for checking if the server just started is bad. It would not create until the host finally is connected which means another delay for the minigame to be started when it could just be created straight away. It also won't work on a dedicated server.
3) General things like using %this.name instead of %this.getPlayerName(), checking if the player is a host by their name instead of checking their BL_ID and converting a boolean to a string to check if it's true. You also don't need that return statement, just change the other if to 'else if'

I wouldn't call it 'solved', your code is terrible.
1) You don't need to package anything for a server script to be executed when the game is started. The server.cs is only executed when the game is started so you would just put it in the server.cs outside of a package and the minigame would be created when the server is started, with an additional !isObject check to prevent recreation when the addon is forced to load.
2) Furthermore, that method for checking if the server just started is bad. It would not create until the host finally is connected which means another delay for the minigame to be started when it could just be created straight away. It also won't work on a dedicated server.
3) General things like using %this.name instead of %this.getPlayerName(), checking if the player is a host by their name instead of checking their BL_ID and converting a boolean to a string to check if it's true. You also don't need that return statement, just change the other if to 'else if'
i wasn't basing the fact that it was 'solved' off of the fact that i had a (i know) poorly written code which i had written in 2 seconds to give him an idea of where to go from there. i was basing it off of the fact that the OP hasn't posted anything in this topic about it, which would leave me to believe that he hasn't run into any problems. thanks for the tips anyways.