addEventHandler ( "onPlayerChat", getRootElement(), 
    function ( msg ) 
        local splittedMsg = split ( msg, " " ) 
        if ( type ( splittedMsg ) == "table" ) then 
            if ( splittedMsg [ 1 ] == "!money" or splittedMsg [ 1 ] == "!cash" ) then 
                local player = getPlayerFromName ( splittedMsg [ 2 ] ) 
                if ( player ) then 
                    local cash = getPlayerMoney ( player ) 
                    outputChatBox ( "#0188ff".. getPlayerName ( player ) .." Has #ff8801$".. cash, root, 255, 255, 255, true ) 
                else 
                    outputChatBox ( "Player not found!", source, 255, 0, 0 ) 
                end 
            end 
        end 
    end 
) 
  
function getPlayerFromName ( partialName ) 
    if partialName then 
        local matches = {} 
        for i, player in ipairs ( getElementsByType ( "player" ) ) do 
            if getPlayerName ( player ) == partialName then 
                return player 
            end 
            if getPlayerName ( player ) : gsub ( "#%x%x%x%x%x%x" , "" ) : lower ( ) : find ( partialName : lower ( ) ) then 
                table.insert ( matches , player ) 
            end 
        end 
        if #matches == 1 then 
            return matches [ 1 ] 
        end 
    end 
    return false 
end