For cmds with ! use this:
function onPlayerChat( player, text )
{
local backupText = text;
local firstChar = backupText.slice( 0, 1 );
if ( firstChar == "!" )
{
// The following function makes any ! commands go to the OnPlayerCommand handler
local splittext = text.slice( 1 );
local params = split( splittext, " " );
if ( params.len() == 1 ) onPlayerCommand( player, params[ 0 ], "" );
else
{
splittext = splittext.slice( splittext.find( " " ) + 1 );
onPlayerCommand( player, params[ 0 ], splittext );
}
}
}
function onPlayerCommand(player, cmd, text)
{
// Your cmds here
}