I am making my first public server modification for Crysis Wars and to ensure nobody steals my code, I'm putting as much as possible within the C++ based DLL (the alternative is Lua). To do this I have to put commands in the DLL, some of which require additional variables. Here's an example:
!ban [playername] [time] [reason]
How would I go about retrieving variables playername, time and reason, all of which have different character lengths? The reason variable may also have more than one word (such as 'offensive messages and cheating') that will need to be picked up.
In Lua this will be done with a simple 'string.match'; I suppose I could always do the message sorting in Lua then get it to send back to C++, but this could cause the whole chatcommand system to be dis-organised.
It would need to extract the variables from the 'const char *msg', which is analysed by the system on every message sent. I already analyse it for command messages (those which begin with '!'). What is the best way to do this?
Examples: !ban Con 5 spam- This will kick the player 'Confl!ct' (I already have the partial scan code to identify partial names) for five minutes
!ban Con spam- This will permanently ban the player 'Confl!ct'