Hey guys. Last night I made the in-game chat double as a command console. To type commands, just add a '/' as the first character in the chat. Currently, there are only 2 commands,
/kick [Player]
though more commands will be added for developers, like spawning vehicles and such. The current 2 commands can only be executed by a select number of developers, which at the moment is only me and Chris. More commands for everyone to use will be added soon.
//This is for coding nerds who wants to see how it works
That thing took a lot of splitting and grouping into lists xP. Basically, if it detects that the first char is a '/', it will run a CalculateCommand function. A string is passed into the function, and then it SubString() by 1 to remove the '/'. The resulting string is then Split() by ' ', which is passed into an array. A new string called "MasterCommand" is then set as the first index of this array, and then a new string array, which is the parameters, is set as the rest of the first array. (E.g. parameters[0] = firstArray[1]). Then I just check over the command and make sure it's a command, then checks the amount of parameters, and if everything matches, the command is successfully executed! xD
- William,
RedCrusaderGames